Node.cpp 907 Bytes
Newer Older
Thomas Purcell's avatar
Thomas Purcell committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <feature_creation/node/Node.hpp>

Node::Node(int feat_ind, std::string expr, std::vector<double> value, Unit unit, NODE_TYPE tag) :
    _n_samp(value.size()),
    _tag(tag),
    _feat_ind(feat_ind),
    _expr(expr),
    _unit(unit),
    // _value_ptr(nullptr),
    _value_ptr(new double[_n_samp])
{
    // _value_ptr = node_value_arrs::access_value_arr(feat_ind);
    // _value_ptr = _value;
    std::copy_n(value.data(), value.size(), value_ptr());
}

Node::Node(int feat_ind, std::string expr, int n_samp, NODE_TYPE tag) :
    _n_samp(n_samp),
    _tag(tag),
    _feat_ind(feat_ind),
    _expr(expr),
    _unit(),
    _value_ptr(new double[_n_samp])
{}

Node::Node(const Node &o) :
    _n_samp(o._n_samp),
    _tag(o._tag),
    _feat_ind(o._feat_ind),
    _expr(o._expr),
    _unit(o._unit),
    _value_ptr(new double[o._n_samp])
{
    std::copy_n(o._value_ptr.get(), o._n_samp, value_ptr());
}