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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/search_action (Version 11.3.0) and /externals/g4tools/include/tools/sg/search_action (Version 4.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_search_action                    
  5 #define tools_sg_search_action                    
  6                                                   
  7 #include "action"                                 
  8                                                   
  9 #include <vector>                                 
 10                                                   
 11 namespace tools {                                 
 12 namespace sg {                                    
 13   class node;                                     
 14 }}                                                
 15                                                   
 16 namespace tools {                                 
 17 namespace sg {                                    
 18                                                   
 19 class search_action : public action {             
 20   TOOLS_ACTION(search_action,tools::sg::search    
 21 public:                                           
 22   search_action(std::ostream& a_out)              
 23   :parent(a_out)                                  
 24   ,m_what(search_node_of_class)                   
 25   ,m_stop_at_first(false)                         
 26   ,m_node(0) //not owner                          
 27                                                   
 28   ,m_done(false)                                  
 29   {}                                              
 30   virtual ~search_action(){}                      
 31 public:                                           
 32   search_action(const search_action& a_from)      
 33   :parent(a_from)                                 
 34   ,m_what(a_from.m_what)                          
 35   ,m_stop_at_first(a_from.m_stop_at_first)        
 36   ,m_class(a_from.m_class)                        
 37   ,m_node(a_from.m_node)                          
 38                                                   
 39   ,m_done(false)                                  
 40   {}                                              
 41   search_action& operator=(const search_action    
 42     parent::operator=(a_from);                    
 43     if(&a_from==this) return *this;               
 44     m_what = a_from.m_what;                       
 45     m_stop_at_first = a_from.m_stop_at_first;     
 46     m_class = a_from.m_class;                     
 47     m_node = a_from.m_node;                       
 48     reset();                                      
 49     return *this;                                 
 50   }                                               
 51 public:                                           
 52   void reset() {                                  
 53     m_done = false;                               
 54     m_objs.clear();                               
 55     m_path.clear();                               
 56     m_paths.clear();                              
 57   }                                               
 58                                                   
 59   enum search_what {                              
 60     search_node_of_class = 0,                     
 61     search_path_to_node = 1,                      
 62     search_path_to_node_of_class = 2              
 63   };                                              
 64   search_what what() const {return m_what;}       
 65   void set_what(search_what a_v) {m_what = a_v    
 66                                                   
 67   void set_done(bool a_value) {m_done = a_valu    
 68   bool done() const {return m_done;}              
 69                                                   
 70   bool stop_at_first() const {return m_stop_at    
 71   void set_stop_at_first(bool a_v) {m_stop_at_    
 72                                                   
 73   ////////////////////////////////////////////    
 74   /// search_node_of_class : /////////////////    
 75   ////////////////////////////////////////////    
 76   //NOTE : result of a search is not necessary    
 77   //       (For exa in ioda::main, could be a     
 78   void add_obj(void* a_obj) {m_objs.push_back(    
 79   const std::vector<void*>& objs() const {retu    
 80                                                   
 81   void set_class(const std::string& a_class) {    
 82   const std::string& sclass() const {return m_    
 83                                                   
 84   ////////////////////////////////////////////    
 85   /// search_path_to_node : //////////////////    
 86   ////////////////////////////////////////////    
 87   void set_node(sg::node* a_v) {m_node = a_v;}    
 88   sg::node* node() const {return m_node;}         
 89                                                   
 90   void path_push(sg::node* a_v) {m_path.push_b    
 91   void path_pop() {m_path.pop_back();}            
 92                                                   
 93   typedef std::vector<sg::node*> path_t;          
 94   const path_t& path() const {return m_path;}     
 95   //path_t path() {return m_path;}                
 96   void clear_path() {m_path.clear();}             
 97                                                   
 98   bool do_path() const {                          
 99     if(m_what==search_action::search_path_to_n    
100     if(m_what==search_action::search_path_to_n    
101     return false;                                 
102   }                                               
103                                                   
104   ////////////////////////////////////////////    
105   /// search_path_to_node_of_class : /////////    
106   ////////////////////////////////////////////    
107   void add_path(const path_t& a_p) {m_paths.pu    
108                                                   
109   typedef std::vector<path_t> paths_t;            
110   const paths_t& paths() const {return m_paths    
111                                                   
112 protected:                                        
113   search_what m_what;                             
114   bool m_stop_at_first;                           
115                                                   
116   //search_node_of_class :                        
117   std::string m_class;                            
118   std::vector<void*> m_objs;                      
119                                                   
120   //search_path_to_node :                         
121   sg::node* m_node; //not owner.                  
122   path_t m_path;                                  
123                                                   
124   //search_path_to_node_of_class :                
125   std::vector<path_t> m_paths;                    
126                                                   
127   bool m_done;                                    
128 };                                                
129                                                   
130 }}                                                
131                                                   
132 #endif