inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/sg/search_action
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_sg_search_action
00005 #define inlib_sg_search_action
00006 
00007 // inheritance :
00008 #include "action"
00009 
00010 //#include "../cast"
00011 
00012 #include <vector>
00013 
00014 //namespace inlib {
00015 //namespace sg {
00016 //  class node;
00017 //}}
00018 
00019 namespace inlib {
00020 namespace sg {
00021 
00022 class search_action : public action {
00023 //public:
00024   //static const std::string& s_class() {
00025   //  static const std::string s_v("inlib::sg::search_action");
00026   //  return s_v;
00027   //}
00028 public:
00029 /*
00030   virtual void* cast(const std::string& a_class) const {
00031     if(void* p = inlib::cmp_cast<search_action>(this,a_class)) {return p;}
00032     if(void* p = inlib::cmp_cast<action>(this,a_class)) {return p;}
00033     return 0;
00034   }
00035 */
00036 public:
00037   search_action(std::ostream& a_out)
00038   : action(a_out)
00039   ,m_done(false)
00040   {}
00041   virtual ~search_action(){}
00042 private:
00043   search_action(const inlib::sg::search_action& a_from)
00044   : action(a_from)
00045   {}
00046   inlib::sg::search_action& operator=(const inlib::sg::search_action& a_from){
00047     action::operator=(a_from);
00048     return *this;
00049   }
00050 public:
00051   void reset() {
00052     m_done = false;
00053     m_objs.clear();
00054   }
00055 
00056   void set_done(bool a_value) {m_done = a_value;}
00057   bool done() const {return m_done;}
00058 
00059   //NOTE : result of a search is not necessary a sg::node.
00060   //       (For exa in ioda::main, could be a base_button).
00061   void add_obj(void* a_obj) {m_objs.push_back(a_obj);}
00062   const std::vector<void*>& objs() const {return m_objs;}
00063 
00064   void set_class(const std::string& a_class) {m_class = a_class;}
00065   std::string sclass() {return m_class;}
00066   const std::string& sclass() const {return m_class;}
00067 private:
00068   bool m_done;
00069   std::string m_class;
00070   std::vector<void*> m_objs;
00071 };
00072 
00073 }}
00074 
00075 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines