Warning, /include/Geant4/tools/sg/noderef is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_sg_noderef
0005 #define tools_sg_noderef
0006
0007 #include "node"
0008
0009 //#define TOOLS_SG_NODEREF_DEBUG
0010
0011 namespace tools {
0012 namespace sg {
0013
0014 class noderef : public node {
0015 public:
0016 TOOLS_NODE(noderef,tools::sg::noderef,node)
0017 public:
0018 virtual void render(render_action& a_action) {
0019 #ifdef TOOLS_SG_NODEREF_DEBUG
0020 std::ostream& out = a_action.out();
0021 out << "debug : tools::sg::noderef::render : " << m_node.s_cls() << " begin : " << std::endl;
0022 m_node.render(a_action);
0023 out << "debug : tools::sg::noderef::render : " << m_node.s_cls() << " end," << std::endl;
0024 #else
0025 m_node.render(a_action);
0026 #endif
0027 }
0028 virtual void pick(pick_action& a_action) {m_node.pick(a_action);}
0029 virtual void bbox(bbox_action& a_action) {m_node.bbox(a_action);}
0030 virtual void event(event_action& a_action) {m_node.event(a_action);}
0031 virtual void search(search_action& a_action) {
0032 if(a_action.do_path()) a_action.path_push(this);
0033 m_node.search(a_action);
0034 if(a_action.done()) return;
0035 if(a_action.do_path()) a_action.path_pop();
0036 }
0037 virtual void get_matrix(get_matrix_action& a_action) {m_node.get_matrix(a_action);}
0038 virtual bool write(write_action& a_action) {return m_node.write(a_action);}
0039 virtual void is_visible(visible_action& a_action) {m_node.is_visible(a_action);}
0040 public:
0041 noderef(node& a_node):parent(),m_node(a_node){}
0042 virtual ~noderef(){}
0043 public:
0044 noderef(const noderef& a_from)
0045 :parent(a_from)
0046 ,m_node(a_from.m_node)
0047 {}
0048 noderef& operator=(const noderef& a_from){
0049 parent::operator=(a_from);
0050 return *this;
0051 }
0052 const sg::node& node() const {return m_node;}
0053 sg::node& node() {return m_node;}
0054 protected:
0055 sg::node& m_node;
0056 };
0057
0058 template <class NODE>
0059 class clrref : public noderef {
0060 public:
0061 TOOLS_NODE_T(NODE,clrref,tools::sg::clrref,noderef)
0062 public:
0063 clrref(NODE& a_node):parent(a_node){}
0064 virtual ~clrref(){
0065 NODE* _node = safe_cast<sg::node,NODE>(m_node);
0066 if(_node) _node->clear();
0067 }
0068 public:
0069 clrref(const clrref& a_from):parent(a_from){}
0070 clrref& operator=(const clrref& a_from){
0071 parent::operator=(a_from);
0072 return *this;
0073 }
0074 };
0075
0076 }}
0077
0078 #endif