torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::_impl::Copier< class Library > Class Template Referenceabstract

#include <Cloning.hpp>

+ Inheritance diagram for torc::generic::_impl::Copier< class Library >:
+ Collaboration diagram for torc::generic::_impl::Copier< class Library >:

Public Types

typedef Library Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

Pointer operator() (const Pointer &inSource, const ObjectFactorySharedPtr &inFactory) throw (Error)
 
void visit (Library &inLibrary) throw (Error)
 
 Copier ()
 
 ~Copier () throw ()
 
virtual void visit (_Tp &client)=0 throw (Error)
 

Private Attributes

ObjectFactorySharedPtr mFactory
 
Pointer mReturnVal
 

Detailed Description

template<>
class torc::generic::_impl::Copier< class Library >

Definition at line 258 of file Cloning.hpp.

Member Typedef Documentation

typedef boost::shared_ptr<Type> torc::generic::_impl::Copier< class Library >::Pointer

Definition at line 261 of file Cloning.hpp.

Definition at line 260 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 321 of file Cloning.hpp.

321  : Type::Visitor(), mFactory(), mReturnVal() {
322  }
torc::generic::_impl::Copier< class Library >::~Copier ( )
throw (
)
inline

Definition at line 324 of file Cloning.hpp.

324  {
325  }

Member Function Documentation

Pointer torc::generic::_impl::Copier< class Library >::operator() ( const Pointer inSource,
const ObjectFactorySharedPtr inFactory 
)
throw (Error
)
inline

Definition at line 263 of file Cloning.hpp.

264  {
265  mFactory = inFactory;
266  inSource->accept(*this);
267  return mReturnVal;
268  }
template<typename _Tp >
virtual void torc::generic::VisitorType< _Tp >::visit ( _Tp &  client)
throw (Error
)
pure virtualinherited

Visit the target object. This will typically be a derived leaf type.

Parameters
[in,out]clientA reference to the target object
Exceptions
ErrorException generated by any of the functions called from inside visit()

+ Here is the caller graph for this function:

void torc::generic::_impl::Copier< class Library >::visit ( Library inLibrary)
throw (Error
)
inline

Definition at line 270 of file Cloning.hpp.

271  {
272  LibrarySharedPtr libPtr;
273  mFactory->create(libPtr);
274 
275  libPtr->setComments(inLibrary.getComments());
276  libPtr->setIsExtern(inLibrary.getIsExtern());
277  libPtr->setName(inLibrary.getName());
278  libPtr->setParent(inLibrary.getParent());
279 
280  std::list < std::string > userData;
281  inLibrary.getUserData(userData);
282  libPtr->setUserData(userData);
283 
284  std::vector<StatusSharedPtr> outStatus;
285  inLibrary.getStatuses(outStatus);
286  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin(); it != outStatus.end();
287  ++it) {
288  StatusSharedPtr clonedStatus = clone(*it, mFactory);
289  libPtr->addStatus(clonedStatus);
290  }
291 
292  std::map<Unit, ScaleFactor> outScaleFactors;
293  outScaleFactors = inLibrary.getScaleFactors();
294  std::map<Unit, ScaleFactor>::iterator it = outScaleFactors.begin();
295  for(; it != outScaleFactors.end(); ++it) {
296  libPtr->setScaleFactor((*it).first, (*it).second);
297  }
298  libPtr->setLevel(inLibrary.getLevel());
299  libPtr->setOriginalName(inLibrary.getOriginalName());
300  std::vector<CellSharedPtr> outCells;
301  inLibrary.getCells(outCells);
302  std::vector<CellSharedPtr>::iterator cellIt = outCells.begin();
303  for(; cellIt != outCells.end(); ++cellIt) {
304  CellSharedPtr newCell = clone(*cellIt, mFactory);
305  libPtr->addCell(newCell);
306  }
307 
308  SimulationInfoSharedPtr simuInfo = inLibrary.getSimulationInfo();
309  if(simuInfo) {
310  SimulationInfoSharedPtr clonedSimuInfo = clone(simuInfo, mFactory);
311  libPtr->setSimulationInfo(clonedSimuInfo);
312  }
313 
314  mReturnVal = libPtr;
315  }
316  catch(Error& e) {
317  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
318  throw;
319  }
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
boost::shared_ptr< Cell > CellSharedPtr
boost::shared_ptr< Status > StatusSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 328 of file Cloning.hpp.

Pointer torc::generic::_impl::Copier< class Library >::mReturnVal
private

Definition at line 329 of file Cloning.hpp.


The documentation for this class was generated from the following file: