00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "torc/generic/om/DumpRestoreConfig.hpp"
00017
00018 #ifndef HAVE_CONFIG_H
00019 #include "torc/generic/config.h"
00020 #endif
00021
00022 #ifdef GENOM_SERIALIZATION
00023 #include <boost/archive/binary_iarchive.hpp>
00024 #include <boost/archive/binary_oarchive.hpp>
00025 #endif //GENOM_SERIALIZATION
00026
00027 #include "torc/generic/om/PropertyContainer.hpp"
00028 #include "torc/generic/om/Property.hpp"
00029
00030 namespace torc {
00031
00032 namespace generic {
00033
00034
00035
00036
00037
00038
00039
00040
00041 PropertySharedPtr
00042 PropertyContainer::getProperty(
00043 const std::string & inName) throw() {
00044 PropertySharedPtr property;
00045 if( !inName.empty() )
00046 {
00047 mProperties.get( inName, property );
00048 }
00049 return property;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 bool
00061 PropertyContainer::setProperty(
00062 const std::string & inName,
00063 const PropertySharedPtr &inProperty) throw() {
00064 if( !inName.empty() )
00065 {
00066 return mProperties.set( inName, inProperty );
00067 }
00068 return false;
00069 }
00070
00071
00072
00073
00074
00075
00076 void
00077 PropertyContainer::setProperties(
00078 const std::map< std::string, PropertySharedPtr > & inSource) throw() {
00079 std::map< std::string, PropertySharedPtr >::const_iterator it = inSource.begin();
00080 for( ; it != inSource.end(); it++ )
00081 {
00082 setProperty( (*it).first, (*it).second );
00083 }
00084 }
00085
00086 PropertyContainer::PropertyContainer()
00087 :mProperties() {
00088 }
00089
00090 PropertyContainer::~PropertyContainer() throw() {
00091 }
00092
00093 #ifdef GENOM_SERIALIZATION
00094 template<class Archive> void
00095 PropertyContainer::serialize( Archive &ar, unsigned int ) {
00096 ar & mProperties;
00097 }
00098
00099
00100
00101 template void
00102 PropertyContainer::serialize<boost::archive::binary_iarchive>(
00103 boost::archive::binary_iarchive & ar, const unsigned int);
00104
00105 template void
00106 PropertyContainer::serialize<boost::archive::binary_oarchive>(
00107 boost::archive::binary_oarchive & ar, const unsigned int);
00108
00109 #endif //GENOM_SERIALIZATION
00110
00111 }
00112
00113 }