00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_CELL_HPP
00017 #define TORC_GENERIC_OM_CELL_HPP
00018
00019 #include "torc/generic/om/DumpRestoreConfig.hpp"
00020
00021
00022 #ifdef GENOM_SERIALIZATION
00023 #include <boost/serialization/access.hpp>
00024 #endif //GENOM_SERIALIZATION
00025
00026 #include "torc/generic/om/PointerTypes.hpp"
00027 #include "torc/generic/om/Commentable.hpp"
00028 #include "torc/generic/util/Error.hpp"
00029 #include "torc/generic/om/Extern.hpp"
00030 #include "torc/generic/om/FactoryType.hpp"
00031 #include "torc/generic/om/Nameable.hpp"
00032 #include "torc/generic/om/ParameterMap.hpp"
00033 #include "torc/generic/om/ParentedObject.hpp"
00034 #include "torc/generic/om/PropertyContainer.hpp"
00035 #include "torc/generic/om/Renamable.hpp"
00036 #include "torc/generic/om/SelfReferencing.hpp"
00037 #include "torc/generic/om/Visitable.hpp"
00038 #include "torc/generic/om/VisitorType.hpp"
00039 #include "torc/generic/om/UserDataContainer.hpp"
00040 #include "torc/generic/om/StatusContainer.hpp"
00041
00042 namespace torc { namespace generic { class BaseVisitor; } }
00043 namespace torc { namespace generic { class Library; } }
00044 namespace torc { namespace generic { class View; } }
00045
00046 namespace torc {
00047
00048 namespace generic {
00049
00050
00051
00052
00053
00054
00055
00056
00057 class Cell :
00058 public Commentable,
00059 public Extern,
00060 public Nameable,
00061 public ParentedObject<Library>,
00062 public PropertyContainer,
00063 public Renamable,
00064 public Visitable,
00065 public SelfReferencing<Cell>,
00066 public UserDataContainer,
00067 public StatusContainer
00068 {
00069 #ifdef GENOM_SERIALIZATION
00070 friend class boost::serialization::access;
00071 friend class RestoredCellUpdater;
00072 #endif
00073
00074 friend class FactoryType<Cell>;
00075
00076 public:
00077
00078
00079
00080
00081
00082 enum Type
00083 {
00084 eTypeTie = 0,
00085 eTypeRipper,
00086 eTypeGeneric
00087 };
00088
00089
00090
00091
00092 typedef VisitorType<Cell> Visitor;
00093
00094
00095
00096
00097 class Factory: public FactoryType<Cell>
00098 {
00099 public:
00100 using FactoryType<Cell>::create;
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 virtual CellSharedPtr
00112 newCellPtr( const std::string &inName,
00113 const LibrarySharedPtr &inLibraryPtr,
00114 const Cell::Type &inCellType = Cell::eTypeGeneric,
00115 const std::string &inOriginalName = std::string()) throw(Error);
00116 };
00117
00118 virtual void
00119 accept(BaseVisitor & inoutVisitor) throw(Error);
00120
00121
00122
00123
00124
00125
00126 inline const Type
00127 getType() const throw();
00128
00129
00130
00131
00132
00133
00134 void
00135 setType(const Type & inSource) throw();
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 void
00160 addView(const ViewSharedPtr & inView) throw(Error);
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 ViewSharedPtr
00183 findView(const std::string &inName) throw();
00184
00185
00186
00187
00188
00189
00190
00191
00192 void
00193 removeView(const std::string &inName ) throw(Error);
00194
00195
00196
00197
00198
00199
00200 inline void
00201 getViews(
00202 std::vector< ViewSharedPtr > &outViews
00203 ) const throw();
00204
00205
00206
00207
00208
00209
00210 template<typename _Action>
00211 inline void
00212 applyOnAllViews( const _Action &action ) throw(Error);
00213
00214
00215 virtual ~Cell() throw();
00216
00217 protected:
00218 Cell();
00219
00220 private:
00221 #ifdef GENOM_SERIALIZATION
00222 template<class Archive> void
00223 serialize( Archive &ar, unsigned int );
00224
00225 void
00226 restoreActions() throw(Error);
00227 #endif //GENOM_SERIALIZATION
00228
00229 Cell( const Cell &rhs);
00230
00231 Cell &
00232 operator = ( const Cell &rhs);
00233
00234 SymTab< std::string,
00235 ViewSharedPtr > mViewSymTab;
00236 Type mType;
00237 ParameterMapSharedPtr mParameters;
00238 };
00239
00240
00241
00242
00243
00244
00245 inline const Cell::Type
00246 Cell::getType() const throw() {
00247 return mType;
00248 }
00249
00250
00251
00252
00253
00254
00255 inline void
00256 Cell::getViews(
00257 std::vector< ViewSharedPtr > &outViews) const throw() {
00258 mViewSymTab.getValues( outViews );
00259 }
00260
00261 template<typename _Action>
00262 inline void
00263 Cell::applyOnAllViews( const _Action &action ) throw(Error)
00264 {
00265 try
00266 {
00267 mViewSymTab.applyOnAll( action );
00268 }
00269 catch(Error &e)
00270 {
00271 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00272 throw;
00273 }
00274 }
00275
00276 }
00277
00278 }
00279 #endif // TORC_GENERIC_OM_CELL_HPP