Back to home page

EIC code displayed by LXR

 
 

    


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 namespace tools {
0010 namespace sg {
0011 
0012 class noderef : public node {
0013 public:
0014   TOOLS_NODE(noderef,tools::sg::noderef,node)
0015 public:
0016   virtual void render(render_action& a_action) {
0017     m_node.render(a_action);
0018   }
0019   virtual void pick(pick_action& a_action) {m_node.pick(a_action);}
0020   virtual void bbox(bbox_action& a_action) {m_node.bbox(a_action);}
0021   virtual void event(event_action& a_action) {m_node.event(a_action);}
0022   virtual void search(search_action& a_action) {
0023     if(a_action.do_path()) a_action.path_push(this);
0024     m_node.search(a_action);
0025     if(a_action.done()) return;
0026     if(a_action.do_path()) a_action.path_pop();
0027   }
0028   virtual void get_matrix(get_matrix_action& a_action) {m_node.get_matrix(a_action);}
0029   virtual bool write(write_action& a_action) {return m_node.write(a_action);}
0030   virtual void is_visible(visible_action& a_action) {m_node.is_visible(a_action);}
0031 public:
0032   noderef(node& a_node):parent(),m_node(a_node){}
0033   virtual ~noderef(){}
0034 public:
0035   noderef(const noderef& a_from)
0036   :parent(a_from)
0037   ,m_node(a_from.m_node)
0038   {}
0039   noderef& operator=(const noderef& a_from){
0040     parent::operator=(a_from);
0041     return *this;
0042   }
0043   const sg::node& node() const {return m_node;}
0044   sg::node& node() {return m_node;}
0045 protected:
0046   sg::node& m_node;
0047 };
0048 
0049 template <class NODE>
0050 class clrref : public noderef {
0051 public:
0052   TOOLS_NODE_T(NODE,clrref,tools::sg::clrref,noderef)
0053 public:
0054   clrref(NODE& a_node):parent(a_node){}
0055   virtual ~clrref(){
0056     NODE* _node = safe_cast<sg::node,NODE>(m_node);
0057     if(_node) _node->clear();
0058   }
0059 public:
0060   clrref(const clrref& a_from):parent(a_from){}
0061   clrref& operator=(const clrref& a_from){
0062     parent::operator=(a_from);
0063     return *this;
0064   }
0065 };
0066 
0067 }}
0068 
0069 #endif