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/export.hpp>
00027 #endif //GENOM_SERIALIZATION
00028
00029 #include "torc/generic/om/ParameterArray.hpp"
00030 #include "torc/generic/om/VisitorType.hpp"
00031
00032 #ifdef GENOM_SERIALIZATION
00033 BOOST_CLASS_EXPORT( torc::generic::ParameterArray )
00034 #endif //GENOM_SERIALIZATION
00035
00036 namespace torc {
00037
00038 namespace generic {
00039
00040 void
00041 ParameterArray::onChildCreate( const boost::shared_ptr<BaseVectorType::ChildType> &inCreatedChild
00042 ) const throw(Error) {
00043 inCreatedChild->setName( getName() );
00044 }
00045
00046 ParameterArray::ParameterArray()
00047 : Parameter(),
00048 Vector<Parameter,
00049 ParameterArrayElement,
00050 ParameterArrayElement::Factory,
00051 false>() {
00052 }
00053
00054 ParameterArray::~ParameterArray() throw() {
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 ParameterArraySharedPtr
00068 ParameterArray::Factory::newParameterArrayPtr( const std::string &inName,
00069 const size_t &inSize,
00070 const ChildFactorySharedPtr &inFactory,
00071 const std::string &inOriginalName ) throw(Error) {
00072 try
00073 {
00074 std::vector<size_t> limits;
00075 limits.push_back( inSize );
00076 return newParameterArrayPtr( inName, limits, inFactory, inOriginalName );
00077 }
00078 catch( Error &e )
00079 {
00080 e.setCurrentLocation(
00081 __FUNCTION__, __FILE__, __LINE__ );
00082 throw;
00083 }
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 ParameterArraySharedPtr
00099 ParameterArray::Factory::newParameterArrayPtr( const std::string &inName,
00100 const std::vector<size_t> &inLimits,
00101 const ChildFactorySharedPtr &inFactory,
00102 const std::string &inOriginalName ) throw(Error) {
00103 try
00104 {
00105 ParameterArraySharedPtr newParameterArray;
00106 create( newParameterArray );
00107 newParameterArray->setName(inName);
00108 newParameterArray->setOriginalName( inOriginalName );
00109 newParameterArray->constructChildren( inFactory, inLimits);
00110 return newParameterArray;
00111 }
00112 catch( Error &e )
00113 {
00114 e.setCurrentLocation(
00115 __FUNCTION__, __FILE__, __LINE__ );
00116 throw;
00117 }
00118 }
00119
00120 void
00121 ParameterArray::accept(
00122 BaseVisitor &inoutVisitor) throw(Error)
00123 {
00124 try
00125 {
00126 runVisitor( *this, inoutVisitor );
00127 }
00128 catch( Error &e )
00129 {
00130 e.setCurrentLocation(
00131 __FUNCTION__, __FILE__, __LINE__ );
00132 throw;
00133 }
00134 }
00135
00136 #ifdef GENOM_SERIALIZATION
00137 template<class Archive> void
00138 ParameterArray::serialize( Archive &ar, unsigned int) {
00139 ar & boost::serialization::base_object< Parameter >( *this );
00140 ar & boost::serialization::base_object< BaseVectorType >( *this );
00141 }
00142
00143
00144 template void
00145 ParameterArray::serialize<boost::archive::binary_oarchive>(
00146 boost::archive::binary_oarchive & ar, const unsigned int);
00147
00148 template void
00149 ParameterArray::serialize<boost::archive::binary_iarchive>(
00150 boost::archive::binary_iarchive & ar, const unsigned int);
00151
00152 #endif //GENOM_SERIALIZATION
00153
00154
00155 }
00156
00157 }