Biorbd
Node.cpp
1 #define BIORBD_API_EXPORTS
2 #include "Utils/Node.h"
3 
4 #include "Utils/String.h"
5 
7  m_name(std::make_shared<biorbd::utils::String>("")),
8  m_parentName(std::make_shared<biorbd::utils::String>("")),
9  m_typeOfNode(std::make_shared<biorbd::utils::NODE_TYPE>(biorbd::utils::NODE_TYPE::NO_NODE_TYPE))
10 {
11 
12 }
13 
15  const biorbd::utils::Node &other)
16 {
17  // Shallow copy
18  m_name = other.m_name;
19  m_parentName = other.m_parentName;
20  m_typeOfNode = other.m_typeOfNode;
21 }
22 
24  m_name(std::make_shared<biorbd::utils::String>(name)),
25  m_parentName(std::make_shared<biorbd::utils::String>("")),
26  m_typeOfNode(std::make_shared<biorbd::utils::NODE_TYPE>(biorbd::utils::NODE_TYPE::NO_NODE_TYPE))
27 {
28 
29 }
30 
32  const biorbd::utils::String &name,
33  const biorbd::utils::String &parentName) :
34  m_name(std::make_shared<biorbd::utils::String>(name)),
35  m_parentName(std::make_shared<biorbd::utils::String>(parentName)),
36  m_typeOfNode(std::make_shared<biorbd::utils::NODE_TYPE>(biorbd::utils::NODE_TYPE::NO_NODE_TYPE))
37 {
38 
39 }
40 
42 {
43 
44 }
45 
47  const biorbd::utils::Node &other)
48 {
49  *m_name = *other.m_name;
50  *m_parentName = *other.m_parentName;
51  *m_typeOfNode = *other.m_typeOfNode;
52 }
53 
55 {
56  *m_name = name;
57 }
58 
60 {
61  return *m_name;
62 }
63 
65 {
66  return *m_parentName;
67 }
68 
70  const biorbd::utils::String &name)
71 {
72  *m_parentName = name;
73 }
74 
75 biorbd::utils::NODE_TYPE biorbd::utils::Node::typeOfNode() const
76 {
77  return *m_typeOfNode;
78 }
biorbd::utils::Node::m_name
std::shared_ptr< biorbd::utils::String > m_name
The name of the node.
Definition: Node.h:91
biorbd::utils::Node::DeepCopy
void DeepCopy(const biorbd::utils::Node &other)
Deep copy of the node in another node.
Definition: Node.cpp:46
biorbd::utils::Node::setParent
void setParent(const biorbd::utils::String &name)
Set the parent name of the node.
Definition: Node.cpp:69
biorbd::utils::Node
A node is an abstract element which is assigned to a parent.
Definition: Node.h:16
biorbd::utils::Node::Node
Node()
Construct Node.
Definition: Node.cpp:6
biorbd::utils::Node::~Node
virtual ~Node()
Destroy class properly.
Definition: Node.cpp:41
biorbd::utils::Node::typeOfNode
biorbd::utils::NODE_TYPE typeOfNode() const
Return the type of node.
Definition: Node.cpp:75
biorbd::utils::Node::name
const biorbd::utils::String & name() const
Return the name of the node.
Definition: Node.cpp:59
biorbd::utils::Node::m_parentName
std::shared_ptr< biorbd::utils::String > m_parentName
The parent name of the node.
Definition: Node.h:92
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17
biorbd::utils::Node::parent
const biorbd::utils::String & parent() const
Return the parent name of the node.
Definition: Node.cpp:64
biorbd::utils::Node::m_typeOfNode
std::shared_ptr< biorbd::utils::NODE_TYPE > m_typeOfNode
The type of the node.
Definition: Node.h:93
biorbd::utils::Node::setName
void setName(const biorbd::utils::String &name)
Set the name of the node.
Definition: Node.cpp:54