00001 // This is gel/gmvl/gmvl_node_cache.h 00002 #ifndef gmvl_node_cache_h_ 00003 #define gmvl_node_cache_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \author crossge@crd.ge.com 00010 00011 #include <vcl_vector.h> 00012 #include <vcl_iosfwd.h> 00013 #include <vcl_utility.h> 00014 00015 #include <gmvl/gmvl_node_sptr.h> 00016 00017 class gmvl_node_cache 00018 { 00019 public: 00020 00021 // constructors and destructors 00022 gmvl_node_cache(); 00023 ~gmvl_node_cache(); 00024 00025 // normal accessors 00026 void add( const gmvl_node_sptr node); 00027 void remove( const gmvl_node_sptr node); 00028 gmvl_node_sptr get( const int index) const { return nodes_[index]; } 00029 00030 bool cached( const gmvl_node_sptr node) const; 00031 00032 // clever accessors 00033 vcl_vector<gmvl_node_sptr> get( const vcl_string type) const; 00034 00035 // input / output 00036 friend vcl_ostream &operator<<( vcl_ostream &os, const gmvl_node_cache &c); 00037 00038 protected: 00039 00040 vcl_vector<gmvl_node_sptr> nodes_; 00041 00042 // node type cache 00043 vcl_vector<vcl_pair<vcl_string,vcl_vector<gmvl_node_sptr> > > typecache_; 00044 00045 void rebuild(); 00046 }; 00047 00048 vcl_ostream &operator<<( vcl_ostream &os, const gmvl_node_cache &c); 00049 00050 #endif // gmvl_node_cache_h_
1.5.1