20 #ifdef GENOM_SERIALIZATION
21 #include <boost/bind.hpp>
22 #include <boost/mem_fn.hpp>
23 #include <boost/archive/binary_iarchive.hpp>
24 #include <boost/archive/binary_oarchive.hpp>
25 #include <boost/serialization/base_object.hpp>
26 #include <boost/serialization/is_abstract.hpp>
27 #include <boost/serialization/map.hpp>
28 #include <boost/serialization/shared_ptr.hpp>
29 #endif //GENOM_SERIALIZATION
35 #ifdef GENOM_SERIALIZATION
38 #endif //GENOM_SERIALIZATION
41 #ifdef GENOM_SERIALIZATION
43 #endif //GENOM_SERIALIZATION
44 #ifdef GENOM_SERIALIZATION
46 #endif //GENOM_SERIALIZATION
54 if(!port || port->getCompositionType() != pRef->getCompositionType()
55 || port->getSize() != pRef->getSize()) {
59 pRef->bindToMasterPort(port);
109 std::map<std::string, ParameterSharedPtr> myParams;
112 oldParams->getOverriddenParameters(mMyContext, myParams);
113 oldParams->unregisterContext(mMyContext);
117 mMyContext = paramMap->getNewContext();
122 if(!myParams.empty()) {
124 paramMap->registerContext(mMyContext, mMaster->getParameterContext());
125 for(std::map<std::string, ParameterSharedPtr>::iterator it = myParams.begin();
126 it != myParams.end(); ++it) {
127 paramMap->set(mMyContext, (*it).first, (*it).second);
134 if(inMaster->getIsExtern()) {
137 if(inMapPortReferences) {
138 PortMapper mapper(inMaster);
140 mPortReferences.applyOnAll(mapper);
166 if(
false == mPortReferences.set(name, inPortRef)) {
171 inPortRef->setParent(getSharedThis());
182 mPortReferences.get(inName, portRef);
193 mNetReferences.get(inName, netRef);
211 if(
false == mPortReferences.remove(inName)) {
234 std::vector<PortReferenceSharedPtr>::const_iterator portRef = inSource.begin();
235 std::vector<PortReferenceSharedPtr>::const_iterator endP = inSource.end();
236 for(; portRef != endP; ++endP) {
238 addPortReference(*portRef);
263 #ifdef GENOM_SERIALIZATION
272 #ifdef GENOM_SERIALIZATION
274 #endif //GENOM_SERIALIZATION
277 #ifdef GENOM_SERIALIZATION
278 template <
class Archive>
void Instance::load(Archive& ar,
unsigned int) {
279 ar & boost::serialization::base_object < Composite<Instance> > (*this);
280 ar & boost::serialization::base_object < Commentable > (*this);
281 ar & boost::serialization::base_object < Nameable > (*this);
282 ar & boost::serialization::base_object < PropertyContainer > (*this);
283 ar & boost::serialization::base_object < Renamable > (*this);
284 ar & boost::serialization::base_object < Visitable > (*this);
291 template <
class Archive>
void Instance::save(Archive& ar,
unsigned int)
const {
292 ar & boost::serialization::base_object < Composite<Instance> > (*this);
293 ar & boost::serialization::base_object < Commentable > (*this);
294 ar & boost::serialization::base_object < Nameable > (*this);
295 ar & boost::serialization::base_object < PropertyContainer > (*this);
296 ar & boost::serialization::base_object < Renamable > (*this);
297 ar & boost::serialization::base_object < Visitable > (*this);
299 mMasterData =
new MasterData();
300 mMasterData->mLibrary =
mMaster->getParent()->getParent()->getName();
301 mMasterData->mCell =
mMaster->getParent()->getName();
302 mMasterData->mView =
mMaster->getName();
309 template void Instance::save<boost::archive::binary_oarchive>(boost::archive::binary_oarchive& ar,
310 const unsigned int)
const;
312 template void Instance::load<boost::archive::binary_iarchive>(boost::archive::binary_iarchive& ar,
315 void Instance::restoreMaster() throw (Error) {
340 CellSharedPtr targetCell = targetLib->findCell(mMasterData->mCell);
344 ViewSharedPtr targetView = targetCell->findView(mMasterData->mView);
350 std::map<std::string, ParameterSharedPtr>::iterator it = mMasterData->mParams.begin();
351 std::map<std::string, ParameterSharedPtr>::iterator end = mMasterData->mParams.end();
352 for(; it != end; ++it) {
358 e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
362 #endif //GENOM_SERIALIZATION
void getValues(std::vector< ValueType > &outValues) const
ParameterContext mMyContext
Represents an instantiation of a cell view in the view of another cell.
An object that has a parent.
virtual void getPortReferences(std::vector< PortReferenceSharedPtr > &) const
Represents objects that have properties.
Represents and EDIF View.
Interface for objects that can be composed within each other.
virtual void bindToMasterView(const ViewSharedPtr &inMaster, bool inMapPortReferences=true)
virtual ParameterContext getParameterContext() const
Represents class that can hold userData.
void applyOnAll(const _Action &action)
SymTab< std::string, PortReferenceSharedPtr > mPortReferences
boost::shared_ptr< NetReference > NetReferenceSharedPtr
void setMaster(const ViewSharedPtr &inMaster)
The Error object thrown by different methods of EdifOM.
virtual void removePortReference(const std::string &inName)
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< PortReference > PortReferenceSharedPtr
virtual ParameterMapSharedPtr getParameters() const
const boost::shared_ptr< View > getParent() const
void saveContextData(const std::string &inName, const boost::any &inSource)
void setDesignator(const std::string &inSource)
ViewSharedPtr getMaster() const
void setTiming(const TimingSharedPtr &inSource)
virtual NetReferenceSharedPtr findNetReference(const std::string &inNetRef)
boost::shared_ptr< View > ViewSharedPtr
boost::shared_ptr< Cell > CellSharedPtr
An object that has a name.
virtual PortReferenceSharedPtr findPortReference(const std::string &inPortRef)
Pointer getSharedThis() const
boost::shared_ptr< Port > PortSharedPtr
virtual void setParent(const boost::shared_ptr< Instance > &inSource)
Represents objects that can be renamed.
virtual void setPortReferences(const std::vector< PortReferenceSharedPtr > &inSource)
boost::shared_ptr< Timing > TimingSharedPtr
virtual void addPortReference(const PortReferenceSharedPtr &inPortRef)
boost::shared_ptr< Root > RootSharedPtr
boost::shared_ptr< ParameterMap > ParameterMapSharedPtr
An object that receives an inoutVisitor.
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)