00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_PROPERTYCONTAINER_HPP
00017 #define TORC_GENERIC_OM_PROPERTYCONTAINER_HPP
00018
00019 #include "torc/generic/om/PointerTypes.hpp"
00020 #include "torc/generic/om/DumpRestoreConfig.hpp"
00021
00022
00023 #include <boost/shared_ptr.hpp>
00024 #ifdef GENOM_SERIALIZATION
00025 #include <boost/serialization/access.hpp>
00026 #endif //GENOM_SERIALIZATION
00027
00028 #include "torc/generic/om/SymTab.hpp"
00029
00030 namespace torc { namespace generic { class Property; } }
00031
00032 namespace torc {
00033
00034 namespace generic {
00035
00036
00037
00038
00039
00040
00041 class PropertyContainer {
00042 #ifdef GENOM_SERIALIZATION
00043 friend class boost::serialization::access;
00044 #endif
00045
00046 public:
00047
00048
00049
00050
00051
00052
00053
00054 PropertySharedPtr
00055 getProperty(const std::string & inName) throw();
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 bool
00066 setProperty(const std::string & inName,
00067 const PropertySharedPtr &inProperty) throw();
00068
00069
00070
00071
00072
00073
00074 inline void
00075 getProperties(
00076 std::map< std::string, PropertySharedPtr > &outProperties) const throw();
00077
00078
00079
00080
00081
00082
00083 void
00084 setProperties(
00085 const std::map< std::string, PropertySharedPtr > & inSource) throw();
00086
00087
00088
00089
00090
00091
00092 template<typename _Action>
00093 inline void
00094 applyOnAllProperties( const _Action &action ) throw(Error);
00095
00096 protected:
00097 PropertyContainer();
00098
00099 public:
00100 ~PropertyContainer() throw();
00101
00102 private:
00103 PropertyContainer(const PropertyContainer & source) throw();
00104 PropertyContainer & operator=(const PropertyContainer & source) throw();
00105
00106 #ifdef GENOM_SERIALIZATION
00107 template<class Archive> void
00108 serialize( Archive &ar, unsigned int );
00109 #endif //GENOM_SERIALIZATION
00110
00111 SymTab< std::string, PropertySharedPtr > mProperties;
00112 };
00113
00114
00115
00116
00117
00118
00119 inline void
00120 PropertyContainer::getProperties(
00121 std::map< std::string, PropertySharedPtr > &outProperties ) const throw() {
00122 mProperties.getValueMap( outProperties );
00123 return;
00124 }
00125
00126 template<typename _Action>
00127 inline void
00128 PropertyContainer::applyOnAllProperties( const _Action &action ) throw(Error)
00129 {
00130 try
00131 {
00132 mProperties.applyOnAll( action );
00133 }
00134 catch(Error &e)
00135 {
00136 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00137 throw;
00138 }
00139 }
00140
00141 }
00142
00143 }
00144 #endif // TORC_GENERIC_OM_PROPERTYCONTAINER_HPP