torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Cloning.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_CLONING_HPP
17 #define TORC_GENERIC_CLONING_HPP
18 
19 #include <cstdio>
20 #include <iostream>
21 #include <algorithm>
22 #include <vector>
23 #include <boost/bind.hpp>
24 #include <boost/shared_ptr.hpp>
25 
27 #include "torc/generic/Error.hpp"
28 
29 #include "torc/generic/Root.hpp"
30 #include "torc/generic/Library.hpp"
31 #include "torc/generic/Design.hpp"
32 #include "torc/generic/Cell.hpp"
33 #include "torc/generic/View.hpp"
52 
53 namespace torc {
54 namespace generic {
55 
56 namespace _impl {
57 template <typename _Tp> class Copier;
58 }
59 
60 extern void copyParams(const Instance& inOriginal, const InstanceSharedPtr& outCloned,
61  const ObjectFactorySharedPtr& inFactory);
62 
63 template <typename _Tp> boost::shared_ptr<_Tp> clone(const boost::shared_ptr<_Tp>& inPointer,
64  const ObjectFactorySharedPtr& inFactory) throw (Error) {
65  try {
66  return _impl::Copier<_Tp>()(inPointer, inFactory);
67  } catch(Error& e) {
68  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
69  throw;
70  }
71 }
72 
73 template <typename _Tp> boost::shared_ptr<_Tp> cloneJoinedInfo(
74  const boost::shared_ptr<_Tp>& inPointer, const ObjectFactorySharedPtr& inFactory,
75  const ViewSharedPtr& inView) throw (Error) {
76  try {
77  return _impl::Copier<_Tp>()(inPointer, inFactory, inView);
78  } catch(Error& e) {
79  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
80  throw;
81  }
82 }
83 
84 template <typename _Tp> boost::shared_ptr<_Tp> clonePermutable(
85  const boost::shared_ptr<_Tp>& inPointer, const ObjectFactorySharedPtr& inFactory,
86  const ViewSharedPtr& inView) throw (Error) {
87  try {
88  return _impl::Copier<_Tp>()(inPointer, inFactory, inView);
89  } catch(Error& e) {
90  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
91  throw;
92  }
93 }
94 
95 namespace _impl {
96 
97 template <typename _Tp> class Copier {
98 public:
99  typedef _Tp Type;
100  typedef boost::shared_ptr<Type> Pointer;
101 
102 public:
103 
104  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
105  throw (Error) {
106  mFactory = inFactory;
107  throw Error(eMessageIdErrorUnsupoortedOperation, __FUNCTION__, __FILE__, __LINE__);
108  return mReturnVal;
109  }
110 
112  }
113 
114  ~Copier() throw () {
115  }
116 
117 private:
121 };
122 
123 // For Root
124 template <> class Copier<class Root> : public Root::Visitor {
125 public:
126  typedef Root Type;
127  typedef boost::shared_ptr<Type> Pointer;
128 
129  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
130  throw (Error) {
131  mFactory = inFactory;
132  inSource->accept(*this);
133  return mReturnVal;
134  }
135 
136  void visit(Root& inRoot) throw (Error) {
137  try {
138  RootSharedPtr rootPtr;
139  mFactory->create(rootPtr);
140 
141  rootPtr->setComments(inRoot.getComments());
142  rootPtr->setName(inRoot.getName());
143  rootPtr->setOriginalName(inRoot.getOriginalName());
144  rootPtr->setLevel(inRoot.getLevel());
145  rootPtr->setVersion(inRoot.getVersion());
146 
147  std::vector<StatusSharedPtr> outStatus;
148  inRoot.getStatuses(outStatus);
149  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin();
150  it != outStatus.end(); ++it) {
151  StatusSharedPtr clonedStatus = clone(*it, mFactory);
152  rootPtr->addStatus(clonedStatus);
153  }
154 
155  std::vector<LibrarySharedPtr> libraries;
156  inRoot.getLibraries(libraries);
157  std::vector<LibrarySharedPtr>::iterator libIt = libraries.begin();
158  for(; libIt != libraries.end(); ++libIt) {
159  LibrarySharedPtr newLib = clone(*libIt, mFactory);
160  rootPtr->addLibrary(newLib);
161  }
162 
163  std::vector<DesignSharedPtr> outDesigns;
164  inRoot.getDesigns(outDesigns);
165  for(std::vector<DesignSharedPtr>::iterator it = outDesigns.begin();
166  it != outDesigns.end(); ++it) {
167  DesignSharedPtr newDesign = clone(*it, mFactory);
168  rootPtr->addDesign(newDesign);
169  }
170 
171  mReturnVal = rootPtr;
172  } catch(Error& e) {
173  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
174  throw;
175  }
176  }
177 
178  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
179  }
180 
181  ~Copier() throw () {
182  }
183 
184 private:
187 };
188 
189 // For Design
190 template <> class Copier<class Design> : public Design::Visitor {
191 public:
192  typedef Design Type;
193  typedef boost::shared_ptr<Type> Pointer;
194 
195  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
196  throw (Error) {
197  mFactory = inFactory;
198  inSource->accept(*this);
199  return mReturnVal;
200  }
201 
202  void visit(Design& inDesign) throw (Error)
203  try {
204  DesignSharedPtr designPtr;
205  mFactory->create(designPtr);
206 
207  designPtr->setComments(inDesign.getComments());
208  designPtr->setName(inDesign.getName());
209  designPtr->setOriginalName(inDesign.getOriginalName());
210  designPtr->setParent(inDesign.getParent());
211  designPtr->setCellRefName(inDesign.getCellRefName());
212  designPtr->setLibraryRefName(inDesign.getLibraryRefName());
213 
214  std::list < std::string > userData;
215  inDesign.getUserData(userData);
216  designPtr->setUserData(userData);
217 
218  std::vector<StatusSharedPtr> outStatus;
219  inDesign.getStatuses(outStatus);
220  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin(); it != outStatus.end();
221  ++it) {
222  StatusSharedPtr clonedStatus = clone(*it, mFactory);
223  designPtr->addStatus(clonedStatus);
224  }
225 
226  std::map<std::string, PropertySharedPtr> outProperties;
227  std::vector<PropertySharedPtr> properties;
228  inDesign.getProperties(outProperties);
229  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
230  it != outProperties.end(); ++it) {
231  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
232  properties.push_back(clonedProperty);
233  }
234  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
235  it != properties.end(); ++it) {
236  designPtr->setProperty((*it)->getName(), *it);
237  }
238 
239  mReturnVal = designPtr;
240  }
241  catch(Error& e) {
242  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
243  throw;
244  }
245 
246  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
247  }
248 
249  ~Copier() throw () {
250  }
251 
252 private:
255 };
256 
257 // For Library
258 template <> class Copier<class Library> : public Library::Visitor {
259 public:
260  typedef Library Type;
261  typedef boost::shared_ptr<Type> Pointer;
262 
263  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
264  throw (Error) {
265  mFactory = inFactory;
266  inSource->accept(*this);
267  return mReturnVal;
268  }
269 
270  void visit(Library& inLibrary) throw (Error)
271  try {
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  }
320 
321  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
322  }
323 
324  ~Copier() throw () {
325  }
326 
327 private:
330 };
331 
332 // For Cell
333 template <> class Copier<class Cell> : public Cell::Visitor {
334 public:
335  typedef Cell Type;
336  typedef boost::shared_ptr<Type> Pointer;
337 
338  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
339  throw (Error) {
340  mFactory = inFactory;
341  inSource->accept(*this);
342  return mReturnVal;
343  }
344 
345  void visit(Cell& inCell) throw (Error) {
346  try {
347  CellSharedPtr cellPtr;
348  mFactory->create(cellPtr);
349  cellPtr->setComments(inCell.getComments());
350 
351  std::list < std::string > userData;
352  inCell.getUserData(userData);
353  cellPtr->setUserData(userData);
354 
355  std::vector<StatusSharedPtr> outStatus;
356  inCell.getStatuses(outStatus);
357  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin();
358  it != outStatus.end(); ++it) {
359  StatusSharedPtr clonedStatus = clone(*it, mFactory);
360  cellPtr->addStatus(clonedStatus);
361  }
362 
363  cellPtr->setIsExtern(inCell.getIsExtern());
364  cellPtr->setName(inCell.getName());
365  cellPtr->setParent(inCell.getParent());
366 
367  std::map<std::string, PropertySharedPtr> outProperties;
368  std::vector<PropertySharedPtr> properties;
369  inCell.getProperties(outProperties);
370  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
371  it != outProperties.end(); ++it) {
372  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
373  properties.push_back(clonedProperty);
374  }
375  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
376  it != properties.end(); ++it) {
377  cellPtr->setProperty((*it)->getName(), *it);
378  }
379 
380  cellPtr->setType(inCell.getType());
381  cellPtr->setOriginalName(inCell.getOriginalName());
382  std::vector<ViewSharedPtr> outViews;
383  inCell.getViews(outViews);
384  std::vector<ViewSharedPtr>::iterator viewIt = outViews.begin();
385  for(; viewIt != outViews.end(); ++viewIt) {
386  ViewSharedPtr newView = clone(*viewIt, mFactory);
387  cellPtr->addView(newView);
388  }
389  mReturnVal = cellPtr;
390  } catch(Error& e) {
391  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
392  throw;
393  }
394  }
395 
396  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
397  }
398 
399  ~Copier() throw () {
400  }
401 
402 private:
405 };
406 
407 // For Status
408 template <> class Copier<class Status> : public Status::Visitor {
409 public:
410  typedef Status Type;
411  typedef boost::shared_ptr<Type> Pointer;
412 
413  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
414  throw (Error) {
415  mFactory = inFactory;
416  inSource->accept(*this);
417  return mReturnVal;
418  }
419 
420  void visit(Status& inStatus) throw (Error) {
421  try {
422  StatusSharedPtr statusPtr;
423  mFactory->create(statusPtr);
424  statusPtr->setComments(inStatus.getComments());
425 
426  std::list < std::string > userData;
427  inStatus.getUserData(userData);
428  statusPtr->setUserData(userData);
429 
430  std::vector<WrittenSharedPtr> outWrittens;
431  inStatus.getWrittens(outWrittens);
432  for(std::vector<WrittenSharedPtr>::iterator it = outWrittens.begin();
433  it != outWrittens.end(); ++it) {
434  WrittenSharedPtr written = *it;
435  WrittenSharedPtr newWritten;
436  mFactory->create(newWritten);
437  newWritten->setComments(written->getComments());
438 
439  std::list < std::string > userData;
440  written->getUserData(userData);
441  newWritten->setUserData(userData);
442 
443  std::map<std::string, PropertySharedPtr> outProperties;
444  std::vector<PropertySharedPtr> properties;
445  written->getProperties(outProperties);
446  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
447  it != outProperties.end(); ++it) {
448  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
449  properties.push_back(clonedProperty);
450  }
451  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
452  it != properties.end(); ++it) {
453  newWritten->setProperty((*it)->getName(), *it);
454  }
455 
456  newWritten->setTimeStamp(written->getTimeStamp());
457  newWritten->setAuthorName(written->getAuthorName());
458  newWritten->setProgramName(written->getProgramName());
459  newWritten->setProgramVersion(written->getProgramVersion());
460  newWritten->setDataOriginLocationName(written->getDataOriginLocationName());
461  newWritten->setDataOriginVersion(written->getDataOriginVersion());
462  statusPtr->addWritten(newWritten);
463  }
464 
465  mReturnVal = statusPtr;
466  } catch(Error& e) {
467  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
468  throw;
469  }
470  }
471 
472  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
473  }
474 
475  ~Copier() throw () {
476  }
477 
478 private:
481 };
482 
483 // For SimulationInfo
484 template <> class Copier<class SimulationInfo> : public SimulationInfo::Visitor {
485 public:
487  typedef boost::shared_ptr<Type> Pointer;
488 
489  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
490  throw (Error) {
491  mFactory = inFactory;
492  inSource->accept(*this);
493  return mReturnVal;
494  }
495 
496  void visit(SimulationInfo& inSimulationInfo) throw (Error) {
497  try {
498  SimulationInfoSharedPtr simuInfoPtr;
499  mFactory->create(simuInfoPtr);
500  simuInfoPtr->setComments(inSimulationInfo.getComments());
501 
502  std::list < std::string > userData;
503  inSimulationInfo.getUserData(userData);
504  simuInfoPtr->setUserData(userData);
505 
506  simuInfoPtr->setParent(inSimulationInfo.getParent());
507 
508  std::vector<LogicValueSharedPtr> outLogicValues;
509  inSimulationInfo.getLogicValues(outLogicValues);
510  for(std::vector<LogicValueSharedPtr>::iterator it = outLogicValues.begin();
511  it != outLogicValues.end(); ++it) {
512  LogicValueSharedPtr newLogicVal = clone(*it, mFactory);
513  simuInfoPtr->addLogicValue(newLogicVal);
514  }
515 
516  mReturnVal = simuInfoPtr;
517  } catch(Error& e) {
518  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
519  throw;
520  }
521  }
522 
523  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
524  }
525 
526  ~Copier() throw () {
527  }
528 
529 private:
532 };
533 
534 // For LogicValue
535 template <> class Copier<class LogicValue> : public LogicValue::Visitor {
536 public:
537  typedef LogicValue Type;
538  typedef boost::shared_ptr<Type> Pointer;
539 
540  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
541  throw (Error) {
542  mFactory = inFactory;
543  inSource->accept(*this);
544  return mReturnVal;
545  }
546 
547  void visit(LogicValue& inLogicValue) throw (Error) {
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();
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) {
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  }
652 
653  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
654  }
655 
656  ~Copier() throw () {
657  }
658 
659 private:
662 };
663 
664 // For View
665 template <> class Copier<class View> : public View::Visitor {
666 public:
667  typedef View Type;
668  typedef boost::shared_ptr<Type> Pointer;
669 
670  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
671  throw (Error) {
672  mFactory = inFactory;
673  inSource->accept(*this);
674  return mReturnVal;
675  }
676 
677  void visit(View& inView) throw (Error) {
678  try {
679  ViewSharedPtr viewPtr;
680  mFactory->create(viewPtr);
681  viewPtr->setComments(inView.getComments());
682 
683  std::list < std::string > userData;
684  inView.getUserData(userData);
685  viewPtr->setUserData(userData);
686 
687  std::vector<StatusSharedPtr> outStatus;
688  inView.getStatuses(outStatus);
689  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin();
690  it != outStatus.end(); ++it) {
691  StatusSharedPtr clonedStatus = clone(*it, mFactory);
692  viewPtr->addStatus(clonedStatus);
693  }
694 
695  viewPtr->setIsExtern(inView.getIsExtern());
696  viewPtr->setName(inView.getName());
697  viewPtr->setParent(inView.getParent());
698  viewPtr->setType(inView.getType());
699 
700  std::map<std::string, PropertySharedPtr> outProperties;
701  std::vector<PropertySharedPtr> properties;
702  inView.getProperties(outProperties);
703  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
704  it != outProperties.end(); ++it) {
705  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
706  properties.push_back(clonedProperty);
707  }
708  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
709  it != properties.end(); ++it) {
710  viewPtr->setProperty((*it)->getName(), *it);
711  }
712 
713  viewPtr->setOriginalName(inView.getOriginalName());
714 
715  ParameterMapSharedPtr oldParams = inView.getParameters();
716  ParameterMapSharedPtr newParams = viewPtr->getParameters();
717  ParameterContext oldCtx = inView.getParameterContext();
718  ParameterContext newCtx = viewPtr->getParameterContext();
719  std::map<std::string, ParameterSharedPtr> params;
720  oldParams->getAllParameters(oldCtx, params);
721  for(std::map<std::string, ParameterSharedPtr>::iterator it = params.begin();
722  it != params.end(); ++it) {
723  ParameterSharedPtr clonedParam = clone((*it).second, mFactory);
724  newParams->set(newCtx, (*it).first, clonedParam);
725  }
726 
727  std::vector<InstanceSharedPtr> outInstances;
728  inView.getInstances(outInstances);
729  std::vector<InstanceSharedPtr>::iterator instIt = outInstances.begin();
730  for(; instIt != outInstances.end(); ++instIt) {
731  InstanceSharedPtr newInst = clone(*instIt, mFactory);
732  viewPtr->addInstance(newInst);
733  }
734 
735  std::vector<PortSharedPtr> outPorts;
736  inView.getPorts(outPorts);
737  std::vector<PortSharedPtr>::iterator portIt = outPorts.begin();
738  for(; portIt != outPorts.end(); ++portIt) {
739  PortSharedPtr newPort = clone(*portIt, mFactory);
740  viewPtr->addPort(newPort);
741  }
742 
743  std::vector<PermutableSharedPtr> outPermutables;
744  inView.getPermutables(outPermutables);
745  for(std::vector<PermutableSharedPtr>::iterator it = outPermutables.begin();
746  it != outPermutables.end(); ++it) {
747  PermutableSharedPtr clonedPermutable = clonePermutable(*it, mFactory, viewPtr);
748  viewPtr->addPermutable(clonedPermutable);
749  }
750 
751  std::vector<InterfaceJoinedInfoSharedPtr> outJoinedInfos;
752  inView.getInterfaceJoinedInfos(outJoinedInfos);
753  for(std::vector<InterfaceJoinedInfoSharedPtr>::iterator it = outJoinedInfos.begin();
754  it != outJoinedInfos.end(); ++it) {
755  InterfaceJoinedInfoSharedPtr clonedJoinedInfo = cloneJoinedInfo(*it, mFactory,
756  viewPtr);
757  viewPtr->addInterfaceJoinedInfo(clonedJoinedInfo);
758  }
759 
760  std::vector<NetSharedPtr> outNets;
761  inView.getNets(outNets);
762  std::vector<NetSharedPtr>::iterator netIt = outNets.begin();
763  for(; netIt != outNets.end(); ++netIt) {
764  NetSharedPtr netPtr = clone(*netIt, mFactory);
765  viewPtr->addNet(netPtr);
766  connectNets(*netIt, netPtr, viewPtr);
767  }
768  if(NULL != inView.getTiming()) {
769  TimingSharedPtr clonedTiming = clone(inView.getTiming(), mFactory);
770  viewPtr->setTiming(clonedTiming);
771  }
772  if(NULL != inView.getInterfaceAttributes()) {
773  InterfaceAttributesSharedPtr attrib = inView.getInterfaceAttributes();
775  if(!attrib->getDesignator().empty()) {
776  newAttrib->setDesignator(attrib->getDesignator());
777  }
778  if(NULL != attrib->getSimulate()) {
779  SimulateSharedPtr clonedSimulate = clone(attrib->getSimulate(), mFactory);
780  newAttrib->setSimulate(clonedSimulate);
781  }
782  if(NULL != attrib->getTiming()) {
783  TimingSharedPtr clonedTiming = clone(attrib->getTiming(), mFactory);
784  newAttrib->setTiming(clonedTiming);
785  }
786  newAttrib->setComments(attrib->getComments());
787 
788  std::list < std::string > userData;
789  attrib->getUserData(userData);
790  newAttrib->setUserData(userData);
791 
792  viewPtr->setInterfaceAttributes(newAttrib);
793  }
794 
795  if(NULL != inView.getSimulate()) {
796  SimulateSharedPtr clonedSimulate = clone(inView.getSimulate(), mFactory);
797  viewPtr->setSimulate(clonedSimulate);
798  }
799 
800  mReturnVal = viewPtr;
801  } catch(Error& e) {
802  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
803  throw;
804  }
805  }
806 
807  void connectNets(const NetSharedPtr& inNet, const NetSharedPtr& outNet,
808  const ViewSharedPtr& inView) {
809  if(eCompositionTypeBundle == inNet->getCompositionType()) {
810  std::vector<NetSharedPtr> inChildren;
811  std::vector<NetSharedPtr> outChildren;
812  inNet->getChildren(inChildren);
813  outNet->getChildren(outChildren);
814  std::vector<NetSharedPtr>::iterator inIt = inChildren.begin();
815  std::vector<NetSharedPtr>::iterator outIt = outChildren.begin();
816  for(; inIt != inChildren.end(); ++inIt, ++outIt) {
817  connectNets(*inIt, *outIt, inView);
818  }
819  }
820  cloneConnection(inNet, outNet, inView);
821  }
822 
823  void cloneConnection(const NetSharedPtr& inNet, const NetSharedPtr& outNet,
824  const ViewSharedPtr& inView) {
825  try {
826  std::vector<PortSharedPtr> connectedPorts;
827  inNet->getConnectedPorts(connectedPorts, true);
828  for(std::vector<PortSharedPtr>::iterator it = connectedPorts.begin();
829  it != connectedPorts.end(); ++it) {
830  std::vector < std::string > nestedNames;
831  PortSharedPtr actualPort = *it;
832  PortSharedPtr port = actualPort;
833  while(port) {
834  if(eCompositionTypeVectorBit != port->getCompositionType())
835  nestedNames.push_back(port->getName());
836  port = port->getParentCollection();
837  }
838  std::string portName = *nestedNames.rbegin();
839  PortSharedPtr targetPort = inView->findPort(portName);
840  if(!targetPort) {
841  Error e(eMessageIdErrorPointerToItemDoesNotExist, __FUNCTION__, __FILE__,
842  __LINE__);
843  e.saveContextData("Pointer to the target port does not exist", targetPort);
844  throw e;
845  }
846  if(nestedNames.size() > 1) {
847  findLeafConnectable(nestedNames, targetPort);
848  }
849  std::vector < size_t > indices;
850  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
851  indices = IndexFinder<Port, VectorPortBit>()(actualPort);
852  }
853  connectNetToElement(indices, targetPort, outNet);
854  }
855  std::vector<PortReferenceSharedPtr> connectedPortRefs;
856  inNet->getConnectedPortRefs(connectedPortRefs, true);
857  for(std::vector<PortReferenceSharedPtr>::iterator it = connectedPortRefs.begin();
858  it != connectedPortRefs.end(); ++it) {
859  std::vector < std::string > nestedNames;
860  PortReferenceSharedPtr actualPort = *it;
861  PortReferenceSharedPtr port = *it;
862  InstanceSharedPtr instance;
863  while(port) {
864  if(eCompositionTypeVectorBit != port->getCompositionType()) {
865  nestedNames.push_back(port->getName());
866  instance = port->getParent();
867  }
868  port = port->getParentCollection();
869  }
870  std::vector < size_t > indices;
871  if(eCompositionTypeVectorBit == instance->getCompositionType()) {
872  indices = IndexFinder<Instance, InstanceArrayMember>()(instance);
873  instance = instance->getParentCollection();
874  }
875  InstanceSharedPtr targetInst = inView->findInstance(instance->getName());
876  if(!indices.empty()) {
877  targetInst = targetInst->get(indices);
878  }
879  std::string portName = *nestedNames.rbegin();
880  PortReferenceSharedPtr targetPort = targetInst->findPortReference(portName);
881  if(!targetPort) {
882  Error e(eMessageIdErrorPointerToItemDoesNotExist, __FUNCTION__, __FILE__,
883  __LINE__);
884  e.saveContextData("Pointer to the target port does not exist", targetPort);
885  throw e;
886  }
887  if(nestedNames.size() > 1) {
888  findLeafConnectable(nestedNames, targetPort);
889  }
890  std::vector < size_t > portIndices;
891  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
892  portIndices = IndexFinder<PortReference, VectorPortBitReference>()(actualPort);
893  }
894  connectNetToElement(portIndices, targetPort, outNet);
895  }
896  std::vector<PortListSharedPtr> connectedPortLists;
897  inNet->getConnectedPortLists(connectedPortLists);
898  for(std::vector<PortListSharedPtr>::iterator it = connectedPortLists.begin();
899  it != connectedPortLists.end(); ++it) {
900  // PortList Clone has not been called directly because, its only
901  // add child port/portRef to portList
902  PortListSharedPtr cloned;
903  mFactory->create(cloned);
904  std::list<PortList::PortListElement> elements;
905  (*it)->getChildren(elements);
906  for(std::list<PortList::PortListElement>::iterator element = elements.begin();
907  element != elements.end(); ++element) {
908  switch((*element).getType()) {
910  std::vector < std::string > nestedNames;
911  PortSharedPtr actualPort = (*element).getPort();
912  PortSharedPtr port = actualPort;
913  while(port) {
914  if(eCompositionTypeVectorBit != port->getCompositionType())
915  nestedNames.push_back(port->getName());
916  port = port->getParentCollection();
917  }
918  std::vector<std::string>::reverse_iterator name = nestedNames.rbegin();
919  std::string portName = *name;
920  PortSharedPtr targetPort = inView->findPort(portName);
921  if(nestedNames.size() > 1) {
922  findLeafConnectable(nestedNames, targetPort);
923  }
924  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
925  targetPort = targetPort->get(
926  IndexFinder<Port, VectorPortBit>()(actualPort));
927  }
928  cloned->addChildPort(targetPort);
929  break;
930  }
932  std::vector < std::string > nestedNames;
933  PortReferenceSharedPtr actualPort = (*element).getPortReference();
934  PortReferenceSharedPtr port = actualPort;
935  InstanceSharedPtr instance;
936  while(port) {
937  if(eCompositionTypeVectorBit != port->getCompositionType()) {
938  nestedNames.push_back(port->getName());
939  instance = port->getParent();
940  }
941  port = port->getParentCollection();
942  }
943  std::vector < size_t > indices;
944  if(eCompositionTypeVectorBit == instance->getCompositionType()) {
945  indices = IndexFinder<Instance, InstanceArrayMember>()(instance);
946  instance = instance->getParentCollection();
947  }
948  InstanceSharedPtr targetInst = inView->findInstance(instance->getName());
949  if(!indices.empty()) {
950  targetInst = targetInst->get(indices);
951  }
952  std::string portName = *nestedNames.rbegin();
953  PortReferenceSharedPtr targetPort = targetInst->findPortReference(portName);
954  if(!targetPort) {
956  __FILE__, __LINE__);
957  e.saveContextData("Pointer to the target port does not exist",
958  targetPort);
959  throw e;
960  }
961  if(nestedNames.size() > 1) {
962  findLeafConnectable(nestedNames, targetPort);
963  }
964  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
965  targetPort = targetPort->get(
967  }
968  cloned->addChildPortReference(targetPort);
969  break;
970  }
971  }
972  }
973  cloned->connect(outNet);
974  }
975  } catch(Error& e) {
976  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
977  throw;
978  }
979  }
980 
981  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
982  }
983 
984  ~Copier() throw () {
985  }
986 
987 private:
990 };
991 
992 // For ScalarPort
993 template <typename _PointerType> void copyObject(ScalarPort& inPort,
994  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
995  try {
996  ScalarPortSharedPtr scalarPort;
997  inFactory->create(scalarPort);
998  scalarPort->setComments(inPort.getComments());
999  scalarPort->setName(inPort.getName());
1000  scalarPort->setDirection(inPort.getDirection());
1001  scalarPort->setOriginalName(inPort.getOriginalName());
1002  scalarPort->setAttributes(inPort.getAttributes());
1003  scalarPort->setIsExtern(inPort.getIsExtern());
1004  scalarPort->setParent(inPort.getParent());
1005  scalarPort->setParentCollection(inPort.getParentCollection());
1006 
1007  std::list < std::string > userData;
1008  inPort.getUserData(userData);
1009  scalarPort->setUserData(userData);
1010 
1011  std::map<std::string, PropertySharedPtr> outProperties;
1012  std::vector<PropertySharedPtr> properties;
1013  inPort.getProperties(outProperties);
1014  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1015  it != outProperties.end(); ++it) {
1016  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1017  properties.push_back(clonedProperty);
1018  }
1019  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1020  it != properties.end(); ++it) {
1021  scalarPort->setProperty((*it)->getName(), *it);
1022  }
1023 
1024  outPointer = scalarPort;
1025  } catch(Error& e) {
1026  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1027  throw;
1028  }
1029 }
1030 
1031 template <> class Copier<class ScalarPort> : public ScalarPort::Visitor {
1032 public:
1033  typedef ScalarPort Type;
1034  typedef boost::shared_ptr<Type> Pointer;
1035 
1036  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1037  throw (Error) {
1038  mFactory = inFactory;
1039  inSource->accept(*this);
1040  return mReturnVal;
1041  }
1042 
1043  void visit(ScalarPort& inPort) throw (Error) {
1044  try {
1045  copyObject(inPort, mFactory, mReturnVal);
1046  } catch(Error& e) {
1047  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1048  throw;
1049  }
1050  }
1051 
1052  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1053  }
1054 
1055  ~Copier() throw () {
1056  }
1057 
1058 private:
1061 };
1062 
1063 // For ScalarPortReference
1064 template <typename _PointerType> void copyObject(ScalarPortReference& inPortRef,
1065  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1066  try {
1067  ScalarPortReferenceSharedPtr portRefPtr;
1068  inFactory->create(portRefPtr);
1069  portRefPtr->setParent(inPortRef.getParent());
1070  portRefPtr->setParentCollection(inPortRef.getParentCollection());
1071  portRefPtr->setParent(inPortRef.getParent());
1072  portRefPtr->bindToMasterPort(inPortRef.getMaster());
1073  outPointer = portRefPtr;
1074  } catch(Error& e) {
1075  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1076  throw;
1077  }
1078 }
1079 
1080 template <> class Copier<class ScalarPortReference> : public ScalarPortReference::Visitor {
1081 public:
1083  typedef boost::shared_ptr<Type> Pointer;
1084 
1085  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1086  throw (Error) {
1087  mFactory = inFactory;
1088  inSource->accept(*this);
1089  return mReturnVal;
1090  }
1091 
1092  void visit(ScalarPortReference& inPort) throw (Error) {
1093  try {
1094  copyObject(inPort, mFactory, mReturnVal);
1095  } catch(Error& e) {
1096  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1097  throw;
1098  }
1099  }
1100 
1101  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1102  }
1103 
1104  ~Copier() throw () {
1105  }
1106 
1107 private:
1110 };
1111 
1112 // For VectorPort
1113 template <typename _PointerType> void copyObject(VectorPort& inPort,
1114  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1115  try {
1116  VectorPortSharedPtr vectorPortPtr;
1117  inFactory->create(vectorPortPtr);
1118  vectorPortPtr->setComments(inPort.getComments());
1119  vectorPortPtr->setName(inPort.getName());
1120  vectorPortPtr->setDirection(inPort.getDirection());
1121  vectorPortPtr->setOriginalName(inPort.getOriginalName());
1122  vectorPortPtr->setAttributes(inPort.getAttributes());
1123  vectorPortPtr->setIsExtern(inPort.getIsExtern());
1124  vectorPortPtr->setParent(inPort.getParent());
1125  vectorPortPtr->setParentCollection(inPort.getParentCollection());
1126 
1127  std::list < std::string > userData;
1128  inPort.getUserData(userData);
1129  vectorPortPtr->setUserData(userData);
1130 
1131  std::map<std::string, PropertySharedPtr> outProperties;
1132  std::vector<PropertySharedPtr> properties;
1133  inPort.getProperties(outProperties);
1134  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1135  it != outProperties.end(); ++it) {
1136  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1137  properties.push_back(clonedProperty);
1138  }
1139  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1140  it != properties.end(); ++it) {
1141  vectorPortPtr->setProperty((*it)->getName(), *it);
1142  }
1143 
1144  //CREATE AND POPULATE CHILDREN
1145  std::vector < size_t > outLimits;
1146  inPort.getLimits(outLimits);
1147  vectorPortPtr->constructChildren(inFactory, outLimits);
1148  VectorPort::BaseType::List children;
1149  inPort.getCreatedChildren(children);
1150  for(VectorPort::BaseType::List::iterator it = children.begin(); it != children.end();
1151  ++it) {
1152  PortSharedPtr child = *it;
1153  PortSharedPtr clonedChild = vectorPortPtr->get(
1155  clonedChild->setComments(child->getComments());
1156  clonedChild->setName(child->getName());
1157  clonedChild->setDirection(child->getDirection());
1158  clonedChild->setOriginalName(child->getOriginalName());
1159  clonedChild->setAttributes(child->getAttributes());
1160  clonedChild->setIsExtern(child->getIsExtern());
1161  clonedChild->setParent(child->getParent());
1162 
1163  std::map < std::string, PropertySharedPtr > outProperties;
1164  std::vector < PropertySharedPtr > properties;
1165  child->getProperties(outProperties);
1166  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1167  it != outProperties.end(); ++it) {
1168  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1169  properties.push_back(clonedProperty);
1170  }
1171  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1172  it != properties.end(); ++it) {
1173  clonedChild->setProperty((*it)->getName(), *it);
1174  }
1175  }
1176  //CONNECTIONS ARE NOT COPIED
1177  outPointer = vectorPortPtr;
1178  } catch(Error& e) {
1179  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1180  throw;
1181  }
1182 }
1183 
1184 template <> class Copier<class VectorPort> : public VectorPort::Visitor {
1185 public:
1186  typedef VectorPort Type;
1187  typedef boost::shared_ptr<Type> Pointer;
1188 
1189  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1190  throw (Error) {
1191  mFactory = inFactory;
1192  inSource->accept(*this);
1193  return mReturnVal;
1194  }
1195 
1196  void visit(VectorPort& inPort) throw (Error) {
1197  try {
1198  copyObject(inPort, mFactory, mReturnVal);
1199  } catch(Error& e) {
1200  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1201  throw;
1202  }
1203  }
1204 
1205  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1206  }
1207 
1208  ~Copier() throw () {
1209  }
1210 
1211 private:
1214 };
1215 
1216 // For VectorPortReference
1217 template <typename _PointerType> void copyObject(VectorPortReference& inPortRef,
1218  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1219  try {
1220  VectorPortReferenceSharedPtr vectorPortRefPtr;
1221  inFactory->create(vectorPortRefPtr);
1222  //CREATE AND POPULATE CHILDREN
1223  std::vector < size_t > outLimits;
1224  inPortRef.getLimits(outLimits);
1225  vectorPortRefPtr->constructChildren(inFactory, outLimits);
1226  vectorPortRefPtr->setParent(inPortRef.getParent());
1227  vectorPortRefPtr->setParentCollection(inPortRef.getParentCollection());
1228  vectorPortRefPtr->bindToMasterPort(inPortRef.getMaster());
1230  inPortRef.getCreatedChildren(children);
1231  for(VectorPortReference::BaseType::List::iterator it = children.begin();
1232  it != children.end(); ++it) {
1233  PortReferenceSharedPtr child = *it;
1234  PortReferenceSharedPtr clonedChild = vectorPortRefPtr->get(
1236  clonedChild->setParent(child->getParent());
1237  // clonedChild->bindToMasterPort(child->getMaster());
1238  }
1239  //CONNECTIONS ARE NOT COPIED
1240  outPointer = vectorPortRefPtr;
1241  } catch(Error& e) {
1242  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1243  throw;
1244  }
1245 }
1246 
1247 template <> class Copier<class VectorPortReference> : public VectorPortReference::Visitor {
1248 public:
1250  typedef boost::shared_ptr<Type> Pointer;
1251 
1252  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1253  throw (Error) {
1254  mFactory = inFactory;
1255  inSource->accept(*this);
1256  return mReturnVal;
1257  }
1258 
1259  void visit(VectorPortReference& inPort) throw (Error) {
1260  try {
1261  copyObject(inPort, mFactory, mReturnVal);
1262  } catch(Error& e) {
1263  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1264  throw;
1265  }
1266  }
1267 
1268  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1269  }
1270 
1271  ~Copier() throw () {
1272  }
1273 
1274 private:
1277 };
1278 
1279 // For PortBundle
1280 template <typename _PointerType> void copyObject(PortBundle& inPort,
1281  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1282  try {
1283  PortBundleSharedPtr portBundlePtr;
1284  inFactory->create(portBundlePtr);
1285  portBundlePtr->setComments(inPort.getComments());
1286  portBundlePtr->setName(inPort.getName());
1287  portBundlePtr->setIsExtern(inPort.getIsExtern());
1288  portBundlePtr->setParent(inPort.getParent());
1289  portBundlePtr->setParentCollection(inPort.getParentCollection());
1290 
1291  std::list < std::string > userData;
1292  inPort.getUserData(userData);
1293  portBundlePtr->setUserData(userData);
1294 
1295  std::map<std::string, PropertySharedPtr> outProperties;
1296  std::vector<PropertySharedPtr> properties;
1297  inPort.getProperties(outProperties);
1298  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1299  it != outProperties.end(); ++it) {
1300  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1301  properties.push_back(clonedProperty);
1302  }
1303  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1304  it != properties.end(); ++it) {
1305  portBundlePtr->setProperty((*it)->getName(), *it);
1306  }
1307 
1308  portBundlePtr->setDirection(inPort.getDirection());
1309  portBundlePtr->setAttributes(inPort.getAttributes());
1310  portBundlePtr->setOriginalName(inPort.getOriginalName());
1311  std::vector<PortSharedPtr> children;
1312  inPort.getChildren(children);
1313  for(std::vector<PortSharedPtr>::iterator it = children.begin(); it != children.end();
1314  ++it) {
1315  PortSharedPtr clonedPort = clone(*it, inFactory);
1316  portBundlePtr->addChild(clonedPort);
1317  }
1318  //CONNECTIONS ARE NOT COPIED
1319  outPointer = portBundlePtr;
1320  } catch(Error& e) {
1321  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1322  throw;
1323  }
1324 }
1325 
1326 template <> class Copier<class PortBundle> : public PortBundle::Visitor {
1327 public:
1328  typedef PortBundle Type;
1329  typedef boost::shared_ptr<Type> Pointer;
1330 
1331  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1332  throw (Error) {
1333  mFactory = inFactory;
1334  inSource->accept(*this);
1335  return mReturnVal;
1336  }
1337 
1338  void visit(PortBundle& inPort) throw (Error) {
1339  try {
1340  copyObject(inPort, mFactory, mReturnVal);
1341  } catch(Error& e) {
1342  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1343  throw;
1344  }
1345  }
1346 
1347  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1348  }
1349 
1350  ~Copier() throw () {
1351  }
1352 
1353 private:
1356 };
1357 
1358 // For PortBundleReference
1359 template <typename _PointerType> void copyObject(PortBundleReference& inPortRef,
1360  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1361  try {
1362  PortBundleReferenceSharedPtr portBundleRefPtr;
1363  inFactory->create(portBundleRefPtr);
1364  portBundleRefPtr->setParent(inPortRef.getParent());
1365  portBundleRefPtr->setParentCollection(inPortRef.getParentCollection());
1366  std::vector<PortReferenceSharedPtr> children;
1367  inPortRef.getChildren(children);
1368  for(std::vector<PortReferenceSharedPtr>::iterator it = children.begin();
1369  it != children.end(); ++it) {
1370  PortReferenceSharedPtr clonedPortRef = clone(*it, inFactory);
1371  portBundleRefPtr->addChild(clonedPortRef);
1372  }
1373  portBundleRefPtr->bindToMasterPort(inPortRef.getMaster());
1374 
1375  //CONNECTIONS ARE NOT COPIED
1376  outPointer = portBundleRefPtr;
1377  } catch(Error& e) {
1378  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1379  throw;
1380  }
1381 }
1382 
1383 template <> class Copier<class PortBundleReference> : public PortBundleReference::Visitor {
1384 public:
1386  typedef boost::shared_ptr<Type> Pointer;
1387 
1388  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1389  throw (Error) {
1390  mFactory = inFactory;
1391  inSource->accept(*this);
1392  return mReturnVal;
1393  }
1394 
1395  void visit(PortBundleReference& inPort) throw (Error) {
1396  try {
1397  copyObject(inPort, mFactory, mReturnVal);
1398  } catch(Error& e) {
1399  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1400  throw;
1401  }
1402  }
1403 
1404  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1405  }
1406 
1407  ~Copier() throw () {
1408  }
1409 
1410 private:
1413 };
1414 
1415 // For SingleInstance
1416 template <typename _PointerType> void copyObject(SingleInstance& inInstance,
1417  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1418  try {
1419  SingleInstanceSharedPtr instPtr;
1420  inFactory->create(instPtr);
1421  instPtr->setComments(inInstance.getComments());
1422  instPtr->setName(inInstance.getName());
1423  instPtr->setOriginalName(inInstance.getOriginalName());
1424  instPtr->setParent(inInstance.getParent());
1425 
1426  std::vector<PortReferenceSharedPtr> outPortRefs;
1427  inInstance.getPortReferences(outPortRefs);
1428  for(std::vector<PortReferenceSharedPtr>::iterator it = outPortRefs.begin();
1429  it != outPortRefs.end(); ++it) {
1430  PortReferenceSharedPtr clonedRef = clone(*it, inFactory);
1431  instPtr->addPortReference(clonedRef);
1432  }
1433  instPtr->bindToMasterView(inInstance.getMaster());
1434  //THIS SHOULD BIND ALL THE CLONED PORTREFS TO THE MASTERS
1435  copyParams(inInstance, instPtr, inFactory);
1436 
1437  std::list < std::string > userData;
1438  inInstance.getUserData(userData);
1439  instPtr->setUserData(userData);
1440 
1441  std::map<std::string, PropertySharedPtr> outProperties;
1442  std::vector<PropertySharedPtr> properties;
1443  inInstance.getProperties(outProperties);
1444  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1445  it != outProperties.end(); ++it) {
1446  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1447  properties.push_back(clonedProperty);
1448  }
1449  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1450  it != properties.end(); ++it) {
1451  instPtr->setProperty((*it)->getName(), *it);
1452  }
1453 
1454  if(NULL != inInstance.getTiming()) {
1455  TimingSharedPtr clonedTiming = clone(inInstance.getTiming(), inFactory);
1456  instPtr->setTiming(clonedTiming);
1457  }
1458 
1459  outPointer = instPtr;
1460  } catch(Error& e) {
1461  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1462  throw;
1463  }
1464 }
1465 
1466 //For SingleInstance
1467 template <> class Copier<class SingleInstance> : public SingleInstance::Visitor {
1468 public:
1470  typedef boost::shared_ptr<Type> Pointer;
1471 
1472  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1473  throw (Error) {
1474  mFactory = inFactory;
1475  inSource->accept(*this);
1476  return mReturnVal;
1477  }
1478 
1479  void visit(SingleInstance& inPort) throw (Error) {
1480  try {
1481  copyObject(inPort, mFactory, mReturnVal);
1482  } catch(Error& e) {
1483  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1484  throw;
1485  }
1486  }
1487 
1488  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1489  }
1490 
1491  ~Copier() throw () {
1492  }
1493 
1494 private:
1497 };
1498 
1499 // For ScalarNet
1500 template <typename _PointerType> void copyObject(ScalarNet& inNet,
1501  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1502  try {
1503  ScalarNetSharedPtr netPtr;
1504  inFactory->create(netPtr);
1505  netPtr->setComments(inNet.getComments());
1506  netPtr->setName(inNet.getName());
1507  netPtr->setParent(inNet.getParent());
1508  netPtr->setOriginalName(inNet.getOriginalName());
1509 
1510  std::list < std::string > userData;
1511  inNet.getUserData(userData);
1512  netPtr->setUserData(userData);
1513 
1514  std::map<std::string, PropertySharedPtr> outProperties;
1515  std::vector<PropertySharedPtr> properties;
1516  inNet.getProperties(outProperties);
1517  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1518  it != outProperties.end(); ++it) {
1519  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1520  properties.push_back(clonedProperty);
1521  }
1522  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1523  it != properties.end(); ++it) {
1524  netPtr->setProperty((*it)->getName(), *it);
1525  }
1526 
1527  std::vector<NetSharedPtr> outNets;
1528  inNet.getSubnets(outNets);
1529  std::vector<NetSharedPtr>::iterator netIt = outNets.begin();
1530  for(; netIt != outNets.end(); ++netIt) {
1531  NetSharedPtr childNet = clone(*netIt, inFactory);
1532  netPtr->addSubnet(childNet);
1533  }
1534  //DO NOT CONNECT
1535  outPointer = netPtr;
1536  } catch(Error& e) {
1537  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1538  throw;
1539  }
1540 }
1541 
1542 template <> class Copier<class ScalarNet> : public ScalarNet::Visitor {
1543 public:
1544  typedef ScalarNet Type;
1545  typedef boost::shared_ptr<Type> Pointer;
1546 
1547  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1548  throw (Error) {
1549  mFactory = inFactory;
1550  inSource->accept(*this);
1551  return mReturnVal;
1552  }
1553 
1554  void visit(ScalarNet& inPort) throw (Error) {
1555  try {
1556  copyObject(inPort, mFactory, mReturnVal);
1557  } catch(Error& e) {
1558  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1559  throw;
1560  }
1561  }
1562 
1563  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1564  }
1565 
1566  ~Copier() throw () {
1567  }
1568 
1569 private:
1572 };
1573 
1574 // For NetBundle
1575 template <typename _PointerType> void copyObject(NetBundle& inNet,
1576  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1577  try {
1578  NetBundleSharedPtr netBundlePtr;
1579  inFactory->create(netBundlePtr);
1580  netBundlePtr->setComments(inNet.getComments());
1581  netBundlePtr->setName(inNet.getName());
1582  netBundlePtr->setParent(inNet.getParent());
1583  netBundlePtr->setOriginalName(inNet.getOriginalName());
1584 
1585  std::list < std::string > userData;
1586  inNet.getUserData(userData);
1587  netBundlePtr->setUserData(userData);
1588 
1589  std::map<std::string, PropertySharedPtr> outProperties;
1590  std::vector<PropertySharedPtr> properties;
1591  inNet.getProperties(outProperties);
1592  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1593  it != outProperties.end(); ++it) {
1594  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1595  properties.push_back(clonedProperty);
1596  }
1597  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1598  it != properties.end(); ++it) {
1599  netBundlePtr->setProperty((*it)->getName(), *it);
1600  }
1601 
1602  std::vector<NetSharedPtr> outChildren;
1603  inNet.getChildren(outChildren);
1604  std::vector<NetSharedPtr>::iterator it = outChildren.begin();
1605  for(; it != outChildren.end(); ++it) {
1606  NetSharedPtr clonedChild = clone(*it, inFactory);
1607  netBundlePtr->addChild(clonedChild);
1608  }
1609  std::vector<NetSharedPtr> outNets;
1610  inNet.getSubnets(outNets);
1611  std::vector<NetSharedPtr>::iterator netIt = outNets.begin();
1612  for(; netIt != outNets.end(); ++netIt) {
1613  NetSharedPtr childNet = clone(*netIt, inFactory);
1614  netBundlePtr->addSubnet(childNet);
1615  }
1616  outPointer = netBundlePtr;
1617  } catch(Error& e) {
1618  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1619  throw;
1620  }
1621 }
1622 
1623 template <> class Copier<class NetBundle> : public NetBundle::Visitor {
1624 public:
1625  typedef NetBundle Type;
1626  typedef boost::shared_ptr<Type> Pointer;
1627 
1628  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1629  throw (Error) {
1630  mFactory = inFactory;
1631  inSource->accept(*this);
1632  return mReturnVal;
1633  }
1634 
1635  void visit(NetBundle& inPort) throw (Error) {
1636  try {
1637  copyObject(inPort, mFactory, mReturnVal);
1638  } catch(Error& e) {
1639  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1640  throw;
1641  }
1642  }
1643 
1644  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1645  }
1646 
1647  ~Copier() throw () {
1648  }
1649 
1650 private:
1653 };
1654 
1655 // For VectorNet
1656 template <typename _PointerType> void copyObject(VectorNet& inNet,
1657  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1658  try {
1659  VectorNetSharedPtr vectorNetPtr;
1660  inFactory->create(vectorNetPtr);
1661  vectorNetPtr->setComments(inNet.getComments());
1662  vectorNetPtr->setName(inNet.getName());
1663  vectorNetPtr->setParent(inNet.getParent());
1664  vectorNetPtr->setOriginalName(inNet.getOriginalName());
1665 
1666  std::list < std::string > userData;
1667  inNet.getUserData(userData);
1668  vectorNetPtr->setUserData(userData);
1669 
1670  std::map<std::string, PropertySharedPtr> outProperties;
1671  std::vector<PropertySharedPtr> properties;
1672  inNet.getProperties(outProperties);
1673  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1674  it != outProperties.end(); ++it) {
1675  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1676  properties.push_back(clonedProperty);
1677  }
1678  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1679  it != properties.end(); ++it) {
1680  vectorNetPtr->setProperty((*it)->getName(), *it);
1681  }
1682 
1683  //CREATE AND POPULATE CHILDREN
1684  std::vector < size_t > outLimits;
1685  inNet.getLimits(outLimits);
1686  vectorNetPtr->constructChildren(inFactory, outLimits);
1687  VectorNet::BaseType::List children;
1688  inNet.getCreatedChildren(children);
1689  for(VectorNet::BaseType::List::iterator it = children.begin(); it != children.end(); ++it) {
1690  NetSharedPtr child = *it;
1691  NetSharedPtr clonedChild = vectorNetPtr->get(IndexFinder<Net, VectorNetBit>()(child));
1692  clonedChild->setComments(child->getComments());
1693  clonedChild->setName(child->getName());
1694  clonedChild->setParent(child->getParent());
1695  clonedChild->setOriginalName(child->getOriginalName());
1696 
1697  std::map < std::string, PropertySharedPtr > outProperties;
1698  std::vector < PropertySharedPtr > properties;
1699  child->getProperties(outProperties);
1700  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1701  it != outProperties.end(); ++it) {
1702  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1703  properties.push_back(clonedProperty);
1704  }
1705  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1706  it != properties.end(); ++it) {
1707  clonedChild->setProperty((*it)->getName(), *it);
1708  }
1709 
1710  std::vector<NetSharedPtr> outNets;
1711  child->getSubnets(outNets);
1712  std::vector<NetSharedPtr>::iterator netIt = outNets.begin();
1713  for(; netIt != outNets.end(); ++netIt) {
1714  NetSharedPtr clonedChildNet = clone(*netIt, inFactory);
1715  clonedChild->addSubnet(clonedChildNet);
1716  }
1717  }
1718  //CONNECTIONS ARE NOT COPIED
1719  std::vector<NetSharedPtr> outNets;
1720  inNet.getSubnets(outNets);
1721  std::vector<NetSharedPtr>::iterator netIt = outNets.begin();
1722  for(; netIt != outNets.end(); ++netIt) {
1723  NetSharedPtr childNet = clone(*netIt, inFactory);
1724  vectorNetPtr->addSubnet(childNet);
1725  }
1726 
1727  outPointer = vectorNetPtr;
1728  } catch(Error& e) {
1729  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1730  throw;
1731  }
1732 }
1733 
1734 template <> class Copier<class VectorNet> : public VectorNet::Visitor {
1735 public:
1736  typedef VectorNet Type;
1737  typedef boost::shared_ptr<Type> Pointer;
1738 
1739  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1740  throw (Error) {
1741  mFactory = inFactory;
1742  inSource->accept(*this);
1743  return mReturnVal;
1744  }
1745 
1746  void visit(VectorNet& inPort) throw (Error) {
1747  try {
1748  copyObject(inPort, mFactory, mReturnVal);
1749  } catch(Error& e) {
1750  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1751  throw;
1752  }
1753  }
1754 
1755  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1756  }
1757 
1758  ~Copier() throw () {
1759  }
1760 
1761 private:
1764 };
1765 
1766 // For InstanceArray
1767 template <typename _PointerType> void copyObject(InstanceArray& inInstanceArray,
1768  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1769  try {
1770  InstanceArraySharedPtr instArrayPtr;
1771  inFactory->create(instArrayPtr);
1772  instArrayPtr->setComments(inInstanceArray.getComments());
1773  instArrayPtr->setName(inInstanceArray.getName());
1774  instArrayPtr->setParent(inInstanceArray.getParent());
1775  instArrayPtr->setOriginalName(inInstanceArray.getOriginalName());
1776 
1777  std::list < std::string > userData;
1778  inInstanceArray.getUserData(userData);
1779  instArrayPtr->setUserData(userData);
1780 
1781  std::map<std::string, PropertySharedPtr> outProperties;
1782  std::vector<PropertySharedPtr> properties;
1783  inInstanceArray.getProperties(outProperties);
1784  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1785  it != outProperties.end(); ++it) {
1786  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1787  properties.push_back(clonedProperty);
1788  }
1789  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1790  it != properties.end(); ++it) {
1791  instArrayPtr->setProperty((*it)->getName(), *it);
1792  }
1793 
1794  //WE intentionally bind here
1795  //This will help when children are bound to different masters
1796  //The actual child binding will be done later
1797  instArrayPtr->bindToMasterView(inInstanceArray.getMaster());
1798  copyParams(inInstanceArray, instArrayPtr, inFactory);
1799 
1800  //CREATE AND POPULATE CHILDREN
1801  std::vector < size_t > outLimits;
1802  inInstanceArray.getLimits(outLimits);
1803  instArrayPtr->constructChildren(inFactory, outLimits);
1805  inInstanceArray.getChildren(children);
1806  for(InstanceArray::BaseVectorType::List::iterator it = children.begin();
1807  it != children.end(); ++it) {
1808  InstanceSharedPtr orig = *it;
1809  InstanceSharedPtr cloned = instArrayPtr->get(
1811  cloned->setComments(orig->getComments());
1812  cloned->setName(orig->getName());
1813  cloned->setOriginalName(orig->getOriginalName());
1814  cloned->setParent(orig->getParent());
1815 
1816  std::list < std::string > userData;
1817  orig->getUserData(userData);
1818  cloned->setUserData(userData);
1819 
1820  std::map < std::string, PropertySharedPtr > outProperties;
1821  std::vector < PropertySharedPtr > properties;
1822  orig->getProperties(outProperties);
1823  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
1824  it != outProperties.end(); ++it) {
1825  PropertySharedPtr clonedProperty = clone((*it).second, inFactory);
1826  properties.push_back(clonedProperty);
1827  }
1828  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
1829  it != properties.end(); ++it) {
1830  cloned->setProperty((*it)->getName(), *it);
1831  }
1832 
1833  std::vector<PortReferenceSharedPtr> outPortRefs;
1834  orig->getPortReferences(outPortRefs);
1835  for(std::vector<PortReferenceSharedPtr>::iterator pit = outPortRefs.begin();
1836  pit != outPortRefs.end(); ++pit) {
1837  PortReferenceSharedPtr clonedRef = clone(*pit, inFactory);
1838  cloned->addPortReference(clonedRef);
1839  }
1840  cloned->bindToMasterView(orig->getMaster());
1841  copyParams(*orig, cloned, inFactory);
1842  }
1843  outPointer = instArrayPtr;
1844  } catch(Error& e) {
1845  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1846  throw;
1847  }
1848 }
1849 
1850 template <> class Copier<class InstanceArray> : public InstanceArray::Visitor {
1851 public:
1853  typedef boost::shared_ptr<Type> Pointer;
1854 
1855  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1856  throw (Error) {
1857  mFactory = inFactory;
1858  inSource->accept(*this);
1859  return mReturnVal;
1860  }
1861 
1862  void visit(InstanceArray& inPort) throw (Error) {
1863  try {
1864  copyObject(inPort, mFactory, mReturnVal);
1865  } catch(Error& e) {
1866  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1867  throw;
1868  }
1869  }
1870 
1871  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1872  }
1873 
1874  ~Copier() throw () {
1875  }
1876 
1877 private:
1880 };
1881 
1882 // For SingleParameter
1883 template <typename _PointerType> void copyObject(SingleParameter& inSingleParameter,
1884  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1885  try {
1886  SingleParameterSharedPtr singleParameterPtr;
1887  inFactory->create(singleParameterPtr);
1888  singleParameterPtr->setName(inSingleParameter.getName());
1889  singleParameterPtr->setUnit(inSingleParameter.getUnit());
1890  singleParameterPtr->setValue(inSingleParameter.getValue());
1891  singleParameterPtr->setOriginalName(inSingleParameter.getOriginalName());
1892  outPointer = singleParameterPtr;
1893  } catch(Error& e) {
1894  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1895  throw;
1896  }
1897 }
1898 
1899 template <> class Copier<class SingleParameter> : public SingleParameter::Visitor {
1900 public:
1902  typedef boost::shared_ptr<Type> Pointer;
1903 
1904  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1905  throw (Error) {
1906  mFactory = inFactory;
1907  inSource->accept(*this);
1908  return mReturnVal;
1909  }
1910 
1911  void visit(SingleParameter& inPort) throw (Error) {
1912  try {
1913  copyObject(inPort, mFactory, mReturnVal);
1914  } catch(Error& e) {
1915  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1916  throw;
1917  }
1918  }
1919 
1920  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1921  }
1922 
1923  ~Copier() throw () {
1924  }
1925 
1926 private:
1929 };
1930 
1931 // For ParameterArray
1932 template <typename _PointerType> void copyObject(ParameterArray& inParamArray,
1933  ObjectFactorySharedPtr& inFactory, _PointerType& outPointer) throw (Error) {
1934  try {
1935  ParameterArraySharedPtr paramArrayPtr;
1936  inFactory->create(paramArrayPtr);
1937  paramArrayPtr->setName(inParamArray.getName());
1938  paramArrayPtr->setOriginalName(inParamArray.getOriginalName());
1939 
1940  std::vector < size_t > outLimits;
1941  inParamArray.getLimits(outLimits);
1942  paramArrayPtr->constructChildren(inFactory, outLimits);
1944  inParamArray.getChildren(children);
1945  ParameterArray::BaseVectorType::List::iterator it = children.begin();
1946  for(; it != children.end(); ++it) {
1947  ParameterSharedPtr orig = *it;
1948  ParameterSharedPtr cloned = paramArrayPtr->get(
1950  cloned->setName(orig->getName());
1951  cloned->setUnit(orig->getUnit());
1952  cloned->setValue(orig->getValue());
1953  }
1954  outPointer = paramArrayPtr;
1955  } catch(Error& e) {
1956  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1957  throw;
1958  }
1959 }
1960 
1961 template <> class Copier<class ParameterArray> : public ParameterArray::Visitor {
1962 public:
1964  typedef boost::shared_ptr<Type> Pointer;
1965 
1966  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
1967  throw (Error) {
1968  mFactory = inFactory;
1969  inSource->accept(*this);
1970  return mReturnVal;
1971  }
1972 
1973  void visit(ParameterArray& inPort) throw (Error) {
1974  try {
1975  copyObject(inPort, mFactory, mReturnVal);
1976  } catch(Error& e) {
1977  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
1978  throw;
1979  }
1980  }
1981 
1982  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
1983  }
1984 
1985  ~Copier() throw () {
1986  }
1987 
1988 private:
1991 };
1992 
1993 // For Property
1994 template <> class Copier<class Property> : public Property::Visitor {
1995 public:
1996  typedef Property Type;
1997  typedef boost::shared_ptr<Type> Pointer;
1998 
1999  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2000  throw (Error) {
2001  mFactory = inFactory;
2002  inSource->accept(*this);
2003  return mReturnVal;
2004  }
2005 
2006  void visit(Property& inProperty) throw (Error) {
2007  try {
2008  PropertySharedPtr propertyPtr;
2009  mFactory->create(propertyPtr);
2010  propertyPtr->setComments(inProperty.getComments());
2011  propertyPtr->setName(inProperty.getName());
2012  propertyPtr->setOriginalName(inProperty.getOriginalName());
2013  propertyPtr->setOwner(inProperty.getOwner());
2014  propertyPtr->setUnit(inProperty.getUnit());
2015  propertyPtr->setValue(inProperty.getValue());
2016 
2017  std::map<std::string, PropertySharedPtr> outValues;
2018  inProperty.getChildren(outValues);
2019  for(std::map<std::string, PropertySharedPtr>::iterator it = outValues.begin();
2020  it != outValues.end(); ++it) {
2021  PropertySharedPtr childProperty = clone((*it).second, mFactory);
2022  propertyPtr->addChildProperty((*it).first, childProperty);
2023  }
2024  mReturnVal = propertyPtr;
2025  } catch(Error& e) {
2026  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2027  throw;
2028  }
2029  }
2030 
2031  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2032  }
2033 
2034  ~Copier() throw () {
2035  }
2036 
2037 private:
2040 };
2041 
2042 template <> class Copier<class Port> : public ScalarPort::Visitor, public VectorPort::Visitor,
2043  public PortBundle::Visitor {
2044 public:
2045  typedef Port Type;
2046  typedef boost::shared_ptr<Type> Pointer;
2047 
2048  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2049  throw (Error) {
2050  mFactory = inFactory;
2051  inSource->accept(*this);
2052  return mReturnVal;
2053  }
2054 
2055  void visit(ScalarPort& inPort) throw (Error) {
2056  try {
2057  copyObject(inPort, mFactory, mReturnVal);
2058  } catch(Error& e) {
2059  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2060  throw;
2061  }
2062  }
2063 
2064  void visit(VectorPort& inPort) throw (Error) {
2065  try {
2066  copyObject(inPort, mFactory, mReturnVal);
2067  } catch(Error& e) {
2068  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2069  throw;
2070  }
2071  }
2072 
2073  void visit(PortBundle& inPort) throw (Error) {
2074  try {
2075  copyObject(inPort, mFactory, mReturnVal);
2076  } catch(Error& e) {
2077  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2078  throw;
2079  }
2080  }
2081 
2082  Copier() : ScalarPort::Visitor(), VectorPort::Visitor(), PortBundle::Visitor(), mFactory(),
2083  mReturnVal() {
2084  }
2085 
2086  ~Copier() throw () {
2087  }
2088 
2089 private:
2092 };
2093 
2094 template <> class Copier<class PortReference> : public ScalarPortReference::Visitor,
2096 public:
2098  typedef boost::shared_ptr<Type> Pointer;
2099 
2100  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2101  throw (Error) {
2102  mFactory = inFactory;
2103  inSource->accept(*this);
2104  return mReturnVal;
2105  }
2106 
2107  void visit(ScalarPortReference& inPortReference) throw (Error) {
2108  try {
2109  copyObject(inPortReference, mFactory, mReturnVal);
2110  } catch(Error& e) {
2111  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2112  throw;
2113  }
2114  }
2115 
2116  void visit(VectorPortReference& inPortReference) throw (Error) {
2117  try {
2118  copyObject(inPortReference, mFactory, mReturnVal);
2119  } catch(Error& e) {
2120  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2121  throw;
2122  }
2123  }
2124 
2125  void visit(PortBundleReference& inPortReference) throw (Error) {
2126  try {
2127  copyObject(inPortReference, mFactory, mReturnVal);
2128  } catch(Error& e) {
2129  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2130  throw;
2131  }
2132  }
2133 
2134  Copier() : ScalarPortReference::Visitor(), VectorPortReference::Visitor(),
2135  PortBundleReference::Visitor(), mFactory(), mReturnVal() {
2136  }
2137 
2138  ~Copier() throw () {
2139  }
2140 
2141 private:
2144 };
2145 
2146 template <> class Copier<class Net> : public ScalarNet::Visitor, public VectorNet::Visitor,
2147  public NetBundle::Visitor {
2148 public:
2149  typedef Net Type;
2150  typedef boost::shared_ptr<Type> Pointer;
2151 
2152  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2153  throw (Error) {
2154  mFactory = inFactory;
2155  inSource->accept(*this);
2156  return mReturnVal;
2157  }
2158 
2159  void visit(ScalarNet& inNet) throw (Error) {
2160  try {
2161  copyObject(inNet, mFactory, mReturnVal);
2162  } catch(Error& e) {
2163  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2164  throw;
2165  }
2166  }
2167 
2168  void visit(VectorNet& inNet) throw (Error) {
2169  try {
2170  copyObject(inNet, mFactory, mReturnVal);
2171  } catch(Error& e) {
2172  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2173  throw;
2174  }
2175  }
2176 
2177  void visit(NetBundle& inNet) throw (Error) {
2178  try {
2179  copyObject(inNet, mFactory, mReturnVal);
2180  } catch(Error& e) {
2181  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2182  throw;
2183  }
2184  }
2185 
2186  Copier() : ScalarNet::Visitor(), VectorNet::Visitor(), NetBundle::Visitor(), mFactory(),
2187  mReturnVal() {
2188  }
2189 
2190  ~Copier() throw () {
2191  }
2192 
2193 private:
2196 };
2197 
2198 //For Instance
2199 template <> class Copier<class Instance> : public SingleInstance::Visitor,
2200  public InstanceArray::Visitor {
2201 public:
2202  typedef Instance Type;
2203  typedef boost::shared_ptr<Type> Pointer;
2204 
2205  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2206  throw (Error) {
2207  mFactory = inFactory;
2208  inSource->accept(*this);
2209  return mReturnVal;
2210  }
2211 
2212  void visit(SingleInstance& inInstance) throw (Error) {
2213  try {
2214  copyObject(inInstance, mFactory, mReturnVal);
2215  } catch(Error& e) {
2216  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2217  throw;
2218  }
2219  }
2220 
2221  void visit(InstanceArray& inInstance) throw (Error) {
2222  try {
2223  copyObject(inInstance, mFactory, mReturnVal);
2224  } catch(Error& e) {
2225  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2226  throw;
2227  }
2228  }
2229 
2230  Copier() : SingleInstance::Visitor(), InstanceArray::Visitor(), mFactory(), mReturnVal() {
2231  }
2232 
2233  ~Copier() throw () {
2234  }
2235 
2236 private:
2239 };
2240 
2241 //For Parameter
2242 template <> class Copier<class Parameter> : public SingleParameter::Visitor,
2243  public ParameterArray::Visitor {
2244 public:
2245  typedef Parameter Type;
2246  typedef boost::shared_ptr<Type> Pointer;
2247 
2248  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2249  throw (Error) {
2250  mFactory = inFactory;
2251  inSource->accept(*this);
2252  return mReturnVal;
2253  }
2254 
2255  void visit(SingleParameter& inParameter) throw (Error) {
2256  try {
2257  copyObject(inParameter, mFactory, mReturnVal);
2258  } catch(Error& e) {
2259  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2260  throw;
2261  }
2262  }
2263 
2264  void visit(ParameterArray& inParameter) throw (Error) {
2265  try {
2266  copyObject(inParameter, mFactory, mReturnVal);
2267  } catch(Error& e) {
2268  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2269  throw;
2270  }
2271  }
2272 
2273  Copier() : SingleParameter::Visitor(), ParameterArray::Visitor(), mFactory(), mReturnVal() {
2274  }
2275 
2276  ~Copier() throw () {
2277  }
2278 
2279 private:
2282 };
2283 
2284 // For Permutable
2285 template <> class Copier<class Permutable> : public Permutable::Visitor {
2286 public:
2287  typedef Permutable Type;
2288  typedef boost::shared_ptr<Type> Pointer;
2289 
2290  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory,
2291  const ViewSharedPtr& inView) throw (Error) {
2292  mFactory = inFactory;
2293  mView = inView;
2294  inSource->accept(*this);
2295  return mReturnVal;
2296  }
2297 
2298  void visit(Permutable& inPermutable) throw (Error) {
2299  try {
2300  PermutableSharedPtr permutablePtr;
2301  mFactory->create(permutablePtr);
2302  permutablePtr->setPermutableType(inPermutable.getPermutableType());
2303  permutablePtr->setIsNonPermutable(inPermutable.getIsNonPermutable());
2304 
2305  std::vector<PortSharedPtr> outPorts;
2306  inPermutable.getPorts(outPorts);
2307  std::vector<PortSharedPtr>::iterator portIt = outPorts.begin();
2308  for(; portIt != outPorts.end(); ++portIt) {
2309  PortSharedPtr actualPort = *portIt;
2310  PortSharedPtr port = actualPort;
2311  std::vector < std::string > nestedNames;
2312  while(port) {
2313  if(eCompositionTypeVectorBit != port->getCompositionType())
2314  nestedNames.push_back(port->getName());
2315  port = port->getParentCollection();
2316  }
2317  std::string portName = *nestedNames.rbegin();
2318  PortSharedPtr targetPort = mView->findPort(portName);
2319  if(nestedNames.size() > 1) {
2320  findLeafConnectable(nestedNames, targetPort);
2321  }
2322  std::vector < size_t > indices;
2323  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
2324  targetPort = targetPort->get(IndexFinder<Port, VectorPortBit>()(actualPort));
2325  indices = IndexFinder<Port, VectorNetBit>()(actualPort);
2326  }
2327  if(!indices.empty()) {
2328  targetPort = targetPort->get(indices);
2329  }
2330  permutablePtr->addPort(targetPort);
2331  }
2332 
2333  std::vector<PermutableSharedPtr> outPermutables;
2334  inPermutable.getChildren(outPermutables);
2335  for(std::vector<PermutableSharedPtr>::iterator it = outPermutables.begin();
2336  it != outPermutables.end(); ++it) {
2337  PermutableSharedPtr childPermutable = clonePermutable(*it, mFactory, mView);
2338  permutablePtr->addChildPermutable(childPermutable);
2339  }
2340 
2341  mReturnVal = permutablePtr;
2342  } catch(Error& e) {
2343  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2344  throw;
2345  }
2346 
2347  }
2348 
2349  Copier() : Type::Visitor(), mFactory(), mReturnVal(), mView() {
2350  }
2351 
2352  ~Copier() throw () {
2353  }
2354 
2355 private:
2359 };
2360 
2361 // For InterfaceJoinedInfo
2362 template <> class Copier<class InterfaceJoinedInfo> : public InterfaceJoinedInfo::Visitor {
2363 public:
2365  typedef boost::shared_ptr<Type> Pointer;
2366 
2367  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory,
2368  const ViewSharedPtr& inView) throw (Error) {
2369  mFactory = inFactory;
2370  mView = inView;
2371  inSource->accept(*this);
2372  return mReturnVal;
2373  }
2374 
2375  void visit(InterfaceJoinedInfo& inInterfaceJoinedInfo) throw (Error) {
2376  try {
2377  InterfaceJoinedInfoSharedPtr joinedInfoPtr;
2378  mFactory->create(joinedInfoPtr);
2379  joinedInfoPtr->setJoinedType(inInterfaceJoinedInfo.getJoinedType());
2380 
2381  std::list<PortSharedPtr> outPorts;
2382  inInterfaceJoinedInfo.getPorts(outPorts);
2383  std::list<PortSharedPtr>::iterator portIt = outPorts.begin();
2384  for(; portIt != outPorts.end(); ++portIt) {
2385  PortSharedPtr actualPort = *portIt;
2386  PortSharedPtr port = actualPort;
2387  std::vector < std::string > nestedNames;
2388  while(port) {
2389  if(eCompositionTypeVectorBit != port->getCompositionType())
2390  nestedNames.push_back(port->getName());
2391  port = port->getParentCollection();
2392  }
2393  std::string portName = *nestedNames.rbegin();
2394  PortSharedPtr targetPort = mView->findPort(portName);
2395  if(nestedNames.size() > 1) {
2396  findLeafConnectable(nestedNames, targetPort);
2397  }
2398  std::vector < size_t > indices;
2399  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
2400  targetPort = targetPort->get(IndexFinder<Port, VectorPortBit>()(actualPort));
2401  indices = IndexFinder<Port, VectorNetBit>()(actualPort);
2402  }
2403  if(!indices.empty()) {
2404  targetPort = targetPort->get(indices);
2405  }
2406 
2407  joinedInfoPtr->addPort(targetPort);
2408  }
2409 
2410  std::list<PortListSharedPtr> outPortLists;
2411  inInterfaceJoinedInfo.getPortLists(outPortLists);
2412  std::list<PortListSharedPtr>::iterator portListIt = outPortLists.begin();
2413  for(; portListIt != outPortLists.end(); ++portListIt) {
2414  PortListSharedPtr newPortList = clone(*portListIt, mFactory);
2415  joinedInfoPtr->addPortList(newPortList);
2416  }
2417 
2418  std::vector<InterfaceJoinedInfoSharedPtr> outJoinedInfos;
2419  inInterfaceJoinedInfo.getChildren(outJoinedInfos);
2420  for(std::vector<InterfaceJoinedInfoSharedPtr>::iterator it = outJoinedInfos.begin();
2421  it != outJoinedInfos.end(); ++it) {
2422  InterfaceJoinedInfoSharedPtr childJoinedInfo = cloneJoinedInfo(*it, mFactory,
2423  mView);
2424  joinedInfoPtr->addChildJoinedInfo(childJoinedInfo);
2425  }
2426 
2427  mReturnVal = joinedInfoPtr;
2428  } catch(Error& e) {
2429  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2430  throw;
2431  }
2432  }
2433 
2434  Copier() : Type::Visitor(), mFactory(), mReturnVal(), mView() {
2435  }
2436 
2437  ~Copier() throw () {
2438  }
2439 
2440 private:
2444 };
2445 
2446 // For PortList
2447 template <> class Copier<class PortList> : public PortList::Visitor {
2448 public:
2449  typedef PortList Type;
2450  typedef boost::shared_ptr<Type> Pointer;
2451 
2452  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2453  throw (Error) {
2454  mFactory = inFactory;
2455  inSource->accept(*this);
2456  return mReturnVal;
2457  }
2458 
2459  void visit(PortList& inPortList) throw (Error) {
2460  try {
2461  PortListSharedPtr portList;
2462  mFactory->create(portList);
2463  std::list<PortList::PortListElement> elements;
2464  inPortList.getChildren(elements);
2465  for(std::list<PortList::PortListElement>::iterator it = elements.begin();
2466  it != elements.end(); ++it) {
2467  switch((*it).getType()) {
2469  portList->addChildPort((*it).getPort());
2470  break;
2471  }
2473  portList->addChildPortReference((*it).getPortReference());
2474  break;
2475  }
2476  }
2477  }
2478 
2479  mReturnVal = portList;
2480  } catch(Error& e) {
2481  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2482  throw;
2483  }
2484  }
2485 
2486  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2487  }
2488 
2489  ~Copier() throw () {
2490  }
2491 
2492 private:
2495 };
2496 
2497 // For Simulate
2498 template <> class Copier<class Simulate> : public Simulate::Visitor {
2499 public:
2500  typedef Simulate Type;
2501  typedef boost::shared_ptr<Type> Pointer;
2502 
2503  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2504  throw (Error) {
2505  mFactory = inFactory;
2506  inSource->accept(*this);
2507  return mReturnVal;
2508  }
2509 
2510  void visit(Simulate& inSimulate) throw (Error) {
2511  try {
2512  SimulateSharedPtr simulatePtr;
2513  mFactory->create(simulatePtr);
2514  simulatePtr->setComments(inSimulate.getComments());
2515 
2516  std::list < std::string > userData;
2517  inSimulate.getUserData(userData);
2518  simulatePtr->setUserData(userData);
2519 
2520  simulatePtr->setName(inSimulate.getName());
2521  simulatePtr->setOriginalName(inSimulate.getOriginalName());
2522 
2523  std::vector<PortListAliasSharedPtr> outPortListAliases;
2524  inSimulate.getPortListAliases(outPortListAliases);
2525  for(std::vector<PortListAliasSharedPtr>::iterator it = outPortListAliases.begin();
2526  it != outPortListAliases.end(); ++it) {
2527  PortListAliasSharedPtr newPortListAlias;
2528  mFactory->create(newPortListAlias);
2529  newPortListAlias->setName((*it)->getName());
2530  PortListSharedPtr clonedPortList = clone((*it)->getPortList(), mFactory);
2531  newPortListAlias->setPortList(clonedPortList);
2532  simulatePtr->addPortListAlias(newPortListAlias);
2533  }
2534 
2535  std::vector<WaveValueSharedPtr> outWaveValues;
2536  inSimulate.getWaveValues(outWaveValues);
2537  for(std::vector<WaveValueSharedPtr>::iterator it = outWaveValues.begin();
2538  it != outWaveValues.end(); ++it) {
2539  WaveValueSharedPtr newWaveValue;
2540  mFactory->create(newWaveValue);
2541  newWaveValue->setName((*it)->getName());
2542  newWaveValue->setDeltaTimeDuration((*it)->getDeltaTimeDuration());
2543  if(NULL != (*it)->getLogicWaveform()) {
2544  LogicElementSharedPtr clonedLogicElem = clone((*it)->getLogicWaveform(),
2545  mFactory);
2546  newWaveValue->setLogicWaveform(clonedLogicElem);
2547  }
2548  simulatePtr->addWaveValue(newWaveValue);
2549  }
2550 
2551  std::vector<ApplySharedPtr> outAllApply;
2552  inSimulate.getAllApply(outAllApply);
2553  for(std::vector<ApplySharedPtr>::iterator it = outAllApply.begin();
2554  it != outAllApply.end(); ++it) {
2555  ApplySharedPtr newApply;
2556  mFactory->create(newApply);
2557  newApply->setComments((*it)->getComments());
2558 
2559  std::list < std::string > userData;
2560  (*it)->getUserData(userData);
2561  newApply->setUserData(userData);
2562 
2563  newApply->setNoOfCycle((*it)->getNoOfCycle());
2564  newApply->setCycleDuration((*it)->getCycleDuration());
2565 
2566  std::list<LogicalResponseSharedPtr> outLogicResponces;
2567  (*it)->getLogicResponses(outLogicResponces);
2568  for(std::list<LogicalResponseSharedPtr>::iterator it = outLogicResponces.begin();
2569  it != outLogicResponces.end(); ++it) {
2570  LogicalResponseSharedPtr clonedLogicalResponse = clone((*it), mFactory);
2571  newApply->addLogicResponse(clonedLogicalResponse);
2572  }
2573  simulatePtr->addApply(newApply);
2574  }
2575 
2576  mReturnVal = simulatePtr;
2577  } catch(Error& e) {
2578  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2579  throw;
2580  }
2581  }
2582 
2583  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2584  }
2585 
2586  ~Copier() throw () {
2587  }
2588 
2589 private:
2592 };
2593 
2594 // For LogicalResponse
2595 template <> class Copier<class LogicalResponse> : public LogicalResponse::Visitor {
2596 public:
2598  typedef boost::shared_ptr<Type> Pointer;
2599 
2600  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2601  throw (Error) {
2602  mFactory = inFactory;
2603  inSource->accept(*this);
2604  return mReturnVal;
2605  }
2606 
2607  void visit(LogicalResponse& inLogicalResponse) throw (Error) {
2608  try {
2609  LogicalResponseSharedPtr logicalResponsePtr;
2610  mFactory->create(logicalResponsePtr);
2611  logicalResponsePtr->setResponseType(inLogicalResponse.getResponseType());
2612  if(NULL != inLogicalResponse.getConnectedPort()) {
2613 
2614  PortSharedPtr clonedPort = clone(inLogicalResponse.getConnectedPort(), mFactory);
2615  logicalResponsePtr->setConnectedPort(clonedPort);
2616  }
2617  if(NULL != inLogicalResponse.getConnectedPortListAlias()) {
2618  PortListAliasSharedPtr newPortListAlias;
2619  mFactory->create(newPortListAlias);
2620  newPortListAlias->setName(inLogicalResponse.getConnectedPortListAlias()->getName());
2621  PortListSharedPtr clonedPortList = clone(
2622  inLogicalResponse.getConnectedPortListAlias()->getPortList(), mFactory);
2623  newPortListAlias->setPortList(clonedPortList);
2624  logicalResponsePtr->setConnectedPortListAlias(newPortListAlias);
2625  }
2626  if(NULL != inLogicalResponse.getConnectedPortList()) {
2627  PortListSharedPtr clonedPortList = clone(inLogicalResponse.getConnectedPortList(),
2628  mFactory);
2629  logicalResponsePtr->setConnectedPortList(clonedPortList);
2630  }
2631 
2632  LogicElementSharedPtr clonedLogicElem = clone(inLogicalResponse.getLogicWaveForm(),
2633  mFactory);
2634  logicalResponsePtr->setLogicWaveForm(clonedLogicElem);
2635 
2636  mReturnVal = logicalResponsePtr;
2637  } catch(Error& e) {
2638  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2639  throw;
2640  }
2641  }
2642 
2643  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2644  }
2645 
2646  ~Copier() throw () {
2647  }
2648 
2649 private:
2652 };
2653 
2654 // For Timing
2655 template <> class Copier<class Timing> : public Timing::Visitor {
2656 public:
2657  typedef Timing Type;
2658  typedef boost::shared_ptr<Type> Pointer;
2659 
2660  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2661  throw (Error) {
2662  mFactory = inFactory;
2663  inSource->accept(*this);
2664  return mReturnVal;
2665  }
2666 
2667  void visit(Timing& inTiming) throw (Error) {
2668  try {
2669  TimingSharedPtr timingPtr;
2670  mFactory->create(timingPtr);
2671  timingPtr->setComments(inTiming.getComments());
2672 
2673  std::list < std::string > userData;
2674  inTiming.getUserData(userData);
2675  timingPtr->setUserData(userData);
2676 
2677  timingPtr->setDerivation(inTiming.getDerivation());
2678  std::list<PathDelaySharedPtr> outPathDelays;
2679  inTiming.getPathDelays(outPathDelays);
2680  std::list<PathDelaySharedPtr>::iterator pathDelayIt = outPathDelays.begin();
2681  for(; pathDelayIt != outPathDelays.end(); pathDelayIt++) {
2682  PathDelaySharedPtr pathDelay = *pathDelayIt;
2683  PathDelaySharedPtr newPathDelay;
2684  mFactory->create(newPathDelay);
2685  newPathDelay->setDelay(pathDelay->getDelay());
2686 
2687  std::list<EventSharedPtr> outEvents;
2688  pathDelay->getEvents(outEvents);
2689  std::list<EventSharedPtr>::iterator eventIt = outEvents.begin();
2690  for(; eventIt != outEvents.end(); eventIt++) {
2691  EventSharedPtr clonedEvent = clone(*eventIt, mFactory);
2692  newPathDelay->addEvent(clonedEvent);
2693  }
2694 
2695  timingPtr->addPathDelay(newPathDelay);
2696  }
2697 
2698  std::list<ForbiddenEventSharedPtr> outForbiddentEvents;
2699  inTiming.getForbiddentEvents(outForbiddentEvents);
2700  std::list<ForbiddenEventSharedPtr>::iterator forbiddentEventIt =
2701  outForbiddentEvents.begin();
2702  for(; forbiddentEventIt != outForbiddentEvents.end(); forbiddentEventIt++) {
2703  ForbiddenEventSharedPtr clonedForbiddenEvent = clone(*forbiddentEventIt, mFactory);
2704  timingPtr->addForbiddenEvent(clonedForbiddenEvent);
2705  }
2706 
2707  mReturnVal = timingPtr;
2708  } catch(Error& e) {
2709  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2710  throw;
2711  }
2712  }
2713 
2714  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2715  }
2716 
2717  ~Copier() throw () {
2718  }
2719 
2720 private:
2723 };
2724 
2725 // For ForbiddenEvent
2726 template <> class Copier<class ForbiddenEvent> : public ForbiddenEvent::Visitor {
2727 public:
2729  typedef boost::shared_ptr<Type> Pointer;
2730 
2731  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2732  throw (Error) {
2733  mFactory = inFactory;
2734  inSource->accept(*this);
2735  return mReturnVal;
2736  }
2737 
2738  void visit(ForbiddenEvent& inForbiddenEvent) throw (Error) {
2739  try {
2740  ForbiddenEventSharedPtr forbiddenEventPtr;
2741  mFactory->create(forbiddenEventPtr);
2742  if(NULL != inForbiddenEvent.getStartTimeInterval()) {
2743  EventSharedPtr clonedEvent = clone(inForbiddenEvent.getStartTimeInterval(),
2744  mFactory);
2745  forbiddenEventPtr->setStartTimeInterval(clonedEvent);
2746  }
2747  if(NULL != inForbiddenEvent.getEndTimeInterval()) {
2748  EventSharedPtr clonedEvent = clone(inForbiddenEvent.getEndTimeInterval(), mFactory);
2749  forbiddenEventPtr->setEndTimeInterval(clonedEvent);
2750  } else {
2751  forbiddenEventPtr->setDuration(inForbiddenEvent.getDuration());
2752  }
2753  std::list<EventSharedPtr> outEvents;
2754  inForbiddenEvent.getEvents(outEvents);
2755  std::list<EventSharedPtr>::iterator eventIt = outEvents.begin();
2756  for(; eventIt != outEvents.end(); eventIt++) {
2757  EventSharedPtr clonedEvent = clone(*eventIt, mFactory);
2758  forbiddenEventPtr->addEvent(clonedEvent);
2759  }
2760 
2761  mReturnVal = forbiddenEventPtr;
2762  } catch(Error& e) {
2763  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2764  throw;
2765  }
2766  }
2767 
2768  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2769  }
2770 
2771  ~Copier() throw () {
2772  }
2773 
2774 private:
2777 };
2778 
2779 // For Event
2780 template <> class Copier<class Event> : public Event::Visitor {
2781 public:
2782  typedef Event Type;
2783  typedef boost::shared_ptr<Type> Pointer;
2784 
2785  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2786  throw (Error) {
2787  mFactory = inFactory;
2788  inSource->accept(*this);
2789  return mReturnVal;
2790  }
2791 
2792  void visit(Event& inEvent) throw (Error) {
2793  try {
2794  EventSharedPtr eventPtr;
2795  mFactory->create(eventPtr);
2796  eventPtr->setType(inEvent.getType());
2797  if(Event::eTypeOffsetEvent == inEvent.getType()) {
2798  eventPtr->setOffsetTime(inEvent.getOffsetTime());
2799  }
2800 
2801  std::list<PortElement> outPortElements;
2802  inEvent.getPortElements(outPortElements);
2803  std::list<PortElement>::iterator portElem = outPortElements.begin();
2804  std::list<PortElement>::iterator end = outPortElements.end();
2805  for(; portElem != end; ++portElem) {
2806  switch((*portElem).getType()) {
2808  PortSharedPtr newPort = clone((*portElem).getPort(), mFactory);
2809  eventPtr->addPort(newPort);
2810  break;
2811  }
2813  PortReferenceSharedPtr clonedRef = clone((*portElem).getPortReference(),
2814  mFactory);
2815  eventPtr->addPortReference(clonedRef);
2816  break;
2817  }
2818  }
2819  }
2820 
2821  if(NULL != inEvent.getPortList()) {
2822  PortListSharedPtr clonedPortList = clone(inEvent.getPortList(), mFactory);
2823  eventPtr->setPortList(clonedPortList);
2824  }
2825 
2826  std::list<NetSharedPtr> outNets;
2827  inEvent.getNets(outNets);
2828  std::list<NetSharedPtr>::iterator netIt = outNets.begin();
2829 
2830  for(; netIt != outNets.end(); ++netIt) {
2831  NetSharedPtr netPtr = clone(*netIt, mFactory);
2832  eventPtr->addNet(netPtr);
2833  }
2834 
2835  if(NULL != inEvent.getTransition()) {
2836  LogicElementSharedPtr clonedLogicElem = clone(inEvent.getTransition(), mFactory);
2837  eventPtr->setTransition(clonedLogicElem);
2838  }
2839 
2840  mReturnVal = eventPtr;
2841  } catch(Error& e) {
2842  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2843  throw;
2844  }
2845  }
2846 
2847  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2848  }
2849 
2850  ~Copier() throw () {
2851  }
2852 
2853 private:
2856 };
2857 
2858 // For LogicElement
2859 template <> class Copier<class LogicElement> : public LogicElement::Visitor {
2860 public:
2862  typedef boost::shared_ptr<Type> Pointer;
2863 
2864  Pointer operator()(const Pointer& inSource, const ObjectFactorySharedPtr& inFactory)
2865  throw (Error) {
2866  mFactory = inFactory;
2867  inSource->accept(*this);
2868  return mReturnVal;
2869  }
2870 
2871  void visit(LogicElement& inLogicElement) throw (Error) {
2872  try {
2873  LogicElementSharedPtr logicElementPtr;
2874  mFactory->create(logicElementPtr);
2875  logicElementPtr->setType(inLogicElement.getType());
2876  if(LogicElement::eTypeSingle == inLogicElement.getType()) {
2877  logicElementPtr->setName(inLogicElement.getName());
2878  }
2879  std::vector<LogicElementSharedPtr> outLogicElements;
2880  inLogicElement.getChildren(outLogicElements);
2881  for(std::vector<LogicElementSharedPtr>::iterator it = outLogicElements.begin();
2882  it != outLogicElements.end(); ++it) {
2883  LogicElementSharedPtr clonedLogicElement = clone(*it, mFactory);
2884  logicElementPtr->addChildLogicElement(clonedLogicElement);
2885  }
2886 
2887  mReturnVal = logicElementPtr;
2888  } catch(Error& e) {
2889  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2890  throw;
2891  }
2892  }
2893 
2894  Copier() : Type::Visitor(), mFactory(), mReturnVal() {
2895  }
2896 
2897  ~Copier() throw () {
2898  }
2899 
2900 private:
2903 };
2904 
2905 } //namespace _impl
2906 
2907 } // namespace generic
2908 } // namespace torc
2909 #endif // TORC_GENERIC_CLONING_HPP
boost::shared_ptr< LogicValue > LogicValueSharedPtr
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
Represents an EDIF cell.
Definition: Cell.hpp:55
boost::shared_ptr< Instance > InstanceSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2731
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2660
Represents areference to a standalone port.
void connectNets(const NetSharedPtr &inNet, const NetSharedPtr &outNet, const ViewSharedPtr &inView)
Definition: Cloning.hpp:807
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1085
void visit(InterfaceJoinedInfo &inInterfaceJoinedInfo)
Definition: Cloning.hpp:2375
void visit(LogicValue &inLogicValue)
Definition: Cloning.hpp:547
Represents a reference to a port array.
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:668
Represents an instantiation of a cell view in the view of another cell.
void findLeafConnectable(std::vector< std::string > &nestedNames, boost::shared_ptr< _Connectable > &conn)
Represents a bundle of ports.
Definition: PortBundle.hpp:44
void visit(SimulationInfo &inSimulationInfo)
Definition: Cloning.hpp:496
boost::shared_ptr< ParameterArray > ParameterArraySharedPtr
Represents the usable instance of a port of a cell in another cell.
boost::shared_ptr< ScalarPort > ScalarPortSharedPtr
void visit(PortBundleReference &inPortReference)
Definition: Cloning.hpp:2125
boost::shared_ptr< WaveValue > WaveValueSharedPtr
Represents and EDIF View.
Definition: View.hpp:61
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2100
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1628
boost::shared_ptr< ScalarNet > ScalarNetSharedPtr
void visit(ParameterArray &inParameter)
Definition: Cloning.hpp:2264
boost::shared_ptr< LogicElement > LogicElementSharedPtr
boost::shared_ptr< PortBundle > PortBundleSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:670
void connectNetToElement(const std::vector< size_t > &inIndices, const boost::shared_ptr< _Connectable > &inConn, const NetSharedPtr &inNet)
void visit(VectorPortReference &inPortReference)
Definition: Cloning.hpp:2116
boost::shared_ptr< Permutable > PermutableSharedPtr
Represents an EDIF Net.
Definition: generic/Net.hpp:58
An EDIF cell library.
Definition: Library.hpp:60
This structure is for logicRef and libraryRef used in logicMapInput/logicMapOutput.
Permutable is used to describe a relationship in which ports are interchangeable. ...
Definition: Permutable.hpp:40
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1472
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1388
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1999
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1331
boost::shared_ptr< Parameter > ParameterSharedPtr
Represents a single instance of the view of a cell.
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1739
This class is used to hold all information about the logic values used within a library.
boost::shared_ptr< _Tp > clonePermutable(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView)
Definition: Cloning.hpp:84
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1252
boost::shared_ptr< Written > WrittenSharedPtr
boost::shared_ptr< ObjectFactory > ObjectFactorySharedPtr
boost::shared_ptr< InstanceArray > InstanceArraySharedPtr
boost::shared_ptr< ScalarPortReference > ScalarPortReferenceSharedPtr
This class is used within simulationInfo construct to define a logic value to use for modeling in the...
Definition: LogicValue.hpp:42
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:540
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2048
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:338
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2503
boost::shared_ptr< Simulate > SimulateSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1855
std::string string
boost::shared_ptr< Design > DesignSharedPtr
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:2046
void visit(ScalarPortReference &inPortReference)
Definition: Cloning.hpp:2107
boost::shared_ptr< VectorPort > VectorPortSharedPtr
boost::shared_ptr< VectorNet > VectorNetSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
Represents a parameter object in EDIF.
Definition: Parameter.hpp:38
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
Represents a port array.
Definition: VectorPort.hpp:45
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1189
boost::shared_ptr< Net > NetSharedPtr
Represents a parameter array.
void visit(InstanceArray &inInstance)
Definition: Cloning.hpp:2221
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< PortReference > PortReferenceSharedPtr
Represents a net array.
Definition: VectorNet.hpp:42
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2864
void visit(SingleParameter &inParameter)
Definition: Cloning.hpp:2255
Represents a standalone port.
Definition: ScalarPort.hpp:42
Represents the Interface joining information.
This class is used to provide a set of path delays or timing constrains (forbidden events) ...
Definition: Timing.hpp:40
Represents an array of instances.
boost::shared_ptr< ForbiddenEvent > ForbiddenEventSharedPtr
Represents a standalone net.
Definition: ScalarNet.hpp:42
boost::shared_ptr< PortList > PortListSharedPtr
boost::shared_ptr< Apply > ApplySharedPtr
void saveContextData(const std::string &inName, const boost::any &inSource)
Definition: Error.cpp:79
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2452
ForbiddenEvent class lists events which are forbidden during a period of times which is specified by ...
Represents attributes of a view interface.
boost::shared_ptr< Event > EventSharedPtr
void visit(LogicElement &inLogicElement)
Definition: Cloning.hpp:2871
void visit(ForbiddenEvent &inForbiddenEvent)
Definition: Cloning.hpp:2738
boost::shared_ptr< _Tp > cloneJoinedInfo(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView)
Definition: Cloning.hpp:73
boost::shared_ptr< SingleParameter > SingleParameterSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2205
ObjectFactorySharedPtr mFactory
Definition: Cloning.hpp:118
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2248
Represents different logic elements which holds array of logic values.
This class is used within simulationInfo construct to define a logic value to use for modeling...
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView)
Definition: Cloning.hpp:2290
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:104
void visit(LogicalResponse &inLogicalResponse)
Definition: Cloning.hpp:2607
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:127
boost::shared_ptr< InterfaceAttributes > InterfaceAttributesSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1904
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:195
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:100
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:413
Represents an ordered list of port references.
Definition: PortList.hpp:43
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView)
Definition: Cloning.hpp:2367
Root of the EDIF Object Model.
Definition: Root.hpp:66
This class is used to model logicInput/logicOutput construct. This class holds information of logical...
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2785
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2600
Represents a bundle of nets.
Definition: NetBundle.hpp:43
Interface for an EDIF port object.
boost::shared_ptr< View > ViewSharedPtr
boost::shared_ptr< Cell > CellSharedPtr
Event is used to describe an event on a port or a net using logic state transitions. Events can also be described for unordered groups of ports or nets using portGroup or netGroup. An ordered list of ports may also be used using a portList.
Definition: Event.hpp:45
boost::shared_ptr< InterfaceJoinedInfo > InterfaceJoinedInfoSharedPtr
void copyParams(const Instance &inOriginal, const InstanceSharedPtr &outCloned, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.cpp:21
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:2150
boost::shared_ptr< PortListAlias > PortListAliasSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:263
boost::shared_ptr< Port > PortSharedPtr
boost::shared_ptr< PathDelay > PathDelaySharedPtr
boost::shared_ptr< Property > PropertySharedPtr
boost::shared_ptr< SingleInstance > SingleInstanceSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:2152
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1036
boost::shared_ptr< LogicValueAttributes > LogicValueAttributesSharedPtr
void copyObject(ScalarPort &inPort, ObjectFactorySharedPtr &inFactory, _PointerType &outPointer)
Definition: Cloning.hpp:993
boost::shared_ptr< Timing > TimingSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1547
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:489
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:1966
boost::shared_ptr< Status > StatusSharedPtr
boost::shared_ptr< VectorPortReference > VectorPortReferenceSharedPtr
boost::shared_ptr< NetBundle > NetBundleSharedPtr
This class is to model simulate construct which is a named collection of simulation stimulus and resp...
Definition: Simulate.hpp:46
Represents EDIF status construct.
Definition: Status.hpp:42
Represents a reference to a bundle of ports.
void visit(Permutable &inPermutable)
Definition: Cloning.hpp:2298
boost::shared_ptr< Root > RootSharedPtr
void cloneConnection(const NetSharedPtr &inNet, const NetSharedPtr &outNet, const ViewSharedPtr &inView)
Definition: Cloning.hpp:823
boost::shared_ptr< ParameterMap > ParameterMapSharedPtr
boost::shared_ptr< Type > Pointer
Definition: Cloning.hpp:336
void visit(SingleInstance &inInstance)
Definition: Cloning.hpp:2212
boost::shared_ptr< PortBundleReference > PortBundleReferenceSharedPtr
Pointer operator()(const Pointer &inSource, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:129
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73
std::vector< Pointer > List
Definition: Composite.hpp:61