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 #include <boost/serialization/base_object.hpp>
00026 #include <boost/serialization/is_abstract.hpp>
00027 #include <boost/serialization/string.hpp>
00028 #endif //GENOM_SERIALIZATION
00029
00030 #include "torc/generic/om/Property.hpp"
00031
00032 namespace torc {
00033
00034 namespace generic {
00035
00036 void
00037 Property::accept(BaseVisitor & inoutVisitor) throw(Error) {
00038 try
00039 {
00040 runVisitor( *this, inoutVisitor );
00041 }
00042 catch( Error &e )
00043 {
00044 e.setCurrentLocation(
00045 __FUNCTION__, __FILE__, __LINE__ );
00046 throw;
00047 }
00048 }
00049
00050 Property::Property()
00051 :Commentable(),
00052 Renamable(),
00053 SelfReferencing<Property>(),
00054 Visitable() {
00055 }
00056
00057 Property::~Property() throw() {
00058 }
00059
00060
00061
00062
00063
00064
00065 void
00066 Property::setValue(const Value & inSource) throw() {
00067 mValue = inSource;
00068 }
00069
00070
00071
00072
00073
00074
00075 void
00076 Property::setUnit(const Unit & inSource) throw() {
00077 mUnit = inSource;
00078 }
00079
00080
00081
00082
00083
00084
00085 void
00086 Property::setOwner(const std::string & inSource) throw() {
00087 mOwner = inSource;
00088 }
00089
00090
00091
00092
00093
00094
00095 void
00096 Property::setChildren(
00097 const std::map< std::string, PropertySharedPtr > & inSource) throw() {
00098 std::map< std::string, PropertySharedPtr >::const_iterator entry = inSource.begin();
00099 std::map< std::string, PropertySharedPtr >::const_iterator end = inSource.end();
00100 for(; entry != end; ++entry )
00101 {
00102 addChildProperty( (*entry).first, (*entry).second );
00103 }
00104 }
00105
00106
00107
00108
00109
00110
00111
00112 bool
00113 Property::addChildProperty(
00114 const std::string &inName,
00115 const PropertySharedPtr &inProperty) throw() {
00116 if( !inName.empty() )
00117 {
00118 return mChildren.set( inName, inProperty );
00119 }
00120 return false;
00121 }
00122
00123 #ifdef GENOM_SERIALIZATION
00124
00125
00126 template<class Archive> void
00127 Property::serialize( Archive &ar, unsigned int ) {
00128 ar & boost::serialization::base_object<Commentable>(*this);
00129 ar & boost::serialization::base_object<Nameable>(*this);
00130 ar & boost::serialization::base_object<Renamable>(*this);
00131 ar & boost::serialization::base_object< SelfReferencing<Property> >(
00132 *this);
00133 ar & boost::serialization::base_object< Visitable >( *this );
00134 ar & mOwner;
00135 ar & mUnit;
00136 ar & mValue;
00137 ar & mChildren;
00138 }
00139
00140
00141 template void
00142 Property::serialize<boost::archive::binary_iarchive>(
00143 boost::archive::binary_iarchive & ar, const unsigned int);
00144
00145 template void
00146 Property::serialize<boost::archive::binary_oarchive>(
00147 boost::archive::binary_oarchive & ar, const unsigned int);
00148
00149 #endif //GENOM_SERIALIZATION
00150 }
00151
00152 }