cgv
Loading...
Searching...
No Matches
node.cxx
1#include "node.h"
2
3namespace cgv {
4 namespace base {
5
6node::node(const std::string& _name) : named(_name)
7{
8}
10{
11 return parent;
12}
14{
15 node_ptr np(const_cast<node*>(this));
16 do {
17 base_ptr bp = np->get_parent();
18 if (!bp)
19 return np;
20 np = bp->get_node();
21 if (!np)
22 return bp;
23 }
24 while (true);
25}
31{
32 return node_ptr(this);
33}
38std::string node::get_type_name() const
39{
40 return "node";
41}
42
43 }
44}
base class for all gui types
Definition named.h:20
The node class keeps a pointer to its parent.
Definition node.h:19
node_ptr parent
store a pointer to the parent node
Definition node.h:24
node_ptr get_parent() const
return the parent node
Definition node.cxx:9
node(const std::string &name="")
construct from name
Definition node.cxx:6
node_ptr get_node()
cast upward to node
Definition node.cxx:30
const_node_ptr get_node_const()
cast upward to const node
Definition node.cxx:34
void set_parent(node_ptr _parent)
set a new parent node
Definition node.cxx:26
std::string get_type_name() const
overload to return the type name of this object
Definition node.cxx:38
base_ptr get_root() const
return the root node by traversing parents until no more parent is available
Definition node.cxx:13
complete implementation of method actions that only call one method when entering a node
Definition action.h:113
data::ref_ptr< const node, true > const_node_ptr
ref counted pointer to a const node
Definition node.h:15
data::ref_ptr< node, true > node_ptr
ref counted pointer to a node
Definition node.h:13
the cgv namespace
Definition print.h:11