Node.cpp 931 Bytes
Newer Older
Thomas Purcell's avatar
Thomas Purcell committed
1
2
#include <feature_creation/node/Node.hpp>

Thomas Purcell's avatar
Thomas Purcell committed
3
4
5
Node::Node()
{}

Thomas Purcell's avatar
Thomas Purcell committed
6
7
8
9
10
11
12
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),
Thomas Purcell's avatar
Thomas Purcell committed
13
    _value_ptr(_n_samp)
Thomas Purcell's avatar
Thomas Purcell committed
14
15
16
17
18
19
20
21
22
23
24
25
{
    // _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(),
Thomas Purcell's avatar
Thomas Purcell committed
26
    _value_ptr(_n_samp)
Thomas Purcell's avatar
Thomas Purcell committed
27
28
29
30
31
32
33
34
{}

Node::Node(const Node &o) :
    _n_samp(o._n_samp),
    _tag(o._tag),
    _feat_ind(o._feat_ind),
    _expr(o._expr),
    _unit(o._unit),
Thomas Purcell's avatar
Thomas Purcell committed
35
    _value_ptr(o._n_samp)
Thomas Purcell's avatar
Thomas Purcell committed
36
{
Thomas Purcell's avatar
Thomas Purcell committed
37
    std::copy_n(o._value_ptr.data(), o._n_samp, value_ptr());
Thomas Purcell's avatar
Thomas Purcell committed
38
}
Thomas Purcell's avatar
Thomas Purcell committed
39
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Node)
Thomas Purcell's avatar
Thomas Purcell committed
40