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

#include <Cloning.hpp>

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

Public Types

typedef LogicValue Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

Pointer operator() (const Pointer &inSource, const ObjectFactorySharedPtr &inFactory) throw (Error)
 
void visit (LogicValue &inLogicValue) 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 LogicValue >

Definition at line 535 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 538 of file Cloning.hpp.

Definition at line 537 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 653 of file Cloning.hpp.

653  : Type::Visitor(), mFactory(), mReturnVal() {
654  }
torc::generic::_impl::Copier< class LogicValue >::~Copier ( )
throw (
)
inline

Definition at line 656 of file Cloning.hpp.

656  {
657  }

Member Function Documentation

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

Definition at line 540 of file Cloning.hpp.

541  {
542  mFactory = inFactory;
543  inSource->accept(*this);
544  return mReturnVal;
545  }
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 LogicValue >::visit ( LogicValue inLogicValue)
throw (Error
)
inline

Definition at line 547 of file Cloning.hpp.

547  {
548  try {
549  LogicValueSharedPtr logicValPtr;
550  mFactory->create(logicValPtr);
551  logicValPtr->setName(inLogicValue.getName());
552  logicValPtr->setOriginalName(inLogicValue.getOriginalName());
553  logicValPtr->setParent(inLogicValue.getParent());
554  logicValPtr->setComments(inLogicValue.getComments());
555 
556  std::map<std::string, PropertySharedPtr> outProperties;
557  std::vector<PropertySharedPtr> properties;
558  inLogicValue.getProperties(outProperties);
559  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
560  it != outProperties.end(); ++it) {
561  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
562  properties.push_back(clonedProperty);
563  }
564  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
565  it != properties.end(); ++it) {
566  logicValPtr->setProperty((*it)->getName(), *it);
567  }
568 
569  std::list < std::string > userData;
570  inLogicValue.getUserData(userData);
571  logicValPtr->setUserData(userData);
572 
573  LogicValueAttributesSharedPtr attrib = inLogicValue.getAttributes();
574  LogicValueAttributesSharedPtr newAttrib(new LogicValueAttributes());
575  if(attrib->getIsVoltageMapSet()) {
576  newAttrib->setVoltageMap(attrib->getVoltageMap());
577  }
578  if(attrib->getIsCurrentMapSet()) {
579  newAttrib->setCurrentMap(attrib->getCurrentMap());
580  }
581  if(attrib->getIsBooleanMapSet()) {
582  newAttrib->setBooleanMap(attrib->getBooleanMap());
583  }
584  SimulationInfoSharedPtr simuInfo = logicValPtr->getParent();
585  if(attrib->getWeakLogicValue()) {
586  LogicValueSharedPtr logicVal = simuInfo->findLogicValue(
587  attrib->getWeakLogicValue()->getName());
588  newAttrib->setWeakLogicValue(logicVal);
589  }
590  if(attrib->getStrongLogicValue()) {
591  LogicValueSharedPtr logicVal = simuInfo->findLogicValue(
592  attrib->getStrongLogicValue()->getName());
593  newAttrib->setStrongLogicValue(logicVal);
594  }
595  {
596  std::list<LogicValueSharedPtr> outLogicValues;
597  attrib->getCompoundLogicValues(outLogicValues);
598  std::list<LogicValueSharedPtr> logicValues;
599  for(std::list<LogicValueSharedPtr>::iterator it = outLogicValues.begin();
600  it != outLogicValues.end(); ++it) {
601  LogicValueSharedPtr logicVal = simuInfo->findLogicValue((*it)->getName());
602  logicValues.push_back(logicVal);
603  }
604  newAttrib->setCompoundLogicValues(logicValues);
605  }
606  {
607  std::list<LogicValueSharedPtr> outLogicValues;
608  attrib->getDominatedLogicValues(outLogicValues);
609  std::list<LogicValueSharedPtr> logicValues;
610  for(std::list<LogicValueSharedPtr>::iterator it = outLogicValues.begin();
611  it != outLogicValues.end(); ++it) {
612  LogicValueSharedPtr logicVal = simuInfo->findLogicValue((*it)->getName());
613  logicValues.push_back(logicVal);
614  }
615  newAttrib->setDominatedLogicValues(logicValues);
616  }
617  {
618  std::list<LogicValueSharedPtr> outLogicValues;
619  attrib->getResolvedLogicValues(outLogicValues);
620  std::list<LogicValueSharedPtr> logicValues;
621  for(std::list<LogicValueSharedPtr>::iterator it = outLogicValues.begin();
622  it != outLogicValues.end(); ++it) {
623  LogicValueSharedPtr logicVal = simuInfo->findLogicValue((*it)->getName());
624  logicValues.push_back(logicVal);
625  }
626  newAttrib->setResolvedLogicValues(logicValues);
627  }
628  if(attrib->getIsIsolated()) {
629  newAttrib->setIsIsolated(attrib->getIsIsolated());
630  }
631  {
632  typedef LogicValueAttributes::LogicMap LogicMap;
633  std::list<LogicMap*> outLogicMaps;
634  attrib->getLogicMaps(outLogicMaps);
635  for(std::list<LogicMap*>::iterator it = outLogicMaps.begin();
636  it != outLogicMaps.end(); ++it) {
637  LogicValueAttributes::LogicMap *logicMap = new LogicValueAttributes::LogicMap();
638  logicMap->mLogicRef = (*it)->mLogicRef;
639  logicMap->mLibraryRef = (*it)->mLibraryRef;
640  logicMap->mLogicMapType = (*it)->mLogicMapType;
641  newAttrib->addLogicMap(logicMap);
642  }
643  }
644  logicValPtr->setAttributes(newAttrib);
645 
646  mReturnVal = logicValPtr;
647  } catch(Error& e) {
648  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
649  throw;
650  }
651  }
boost::shared_ptr< LogicValue > LogicValueSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
boost::shared_ptr< Property > PropertySharedPtr
boost::shared_ptr< LogicValueAttributes > LogicValueAttributesSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 660 of file Cloning.hpp.

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

Definition at line 661 of file Cloning.hpp.


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