1 #include "ComponentInstance.hxx"
2 #include "Container.hxx"
8 #include "YacsTrace.hxx"
10 using namespace YACS::ENGINE;
13 const char ComponentInstance::KIND[]="";
14 int ComponentInstance::_total = 0;
17 const char ComponentInstance::NULL_FILE_REPR[]="No repr specified for ComponentInstance";
19 void ComponentInstance::setContainer(Container *cont)
21 if (cont == _container) return;
24 cont->checkCapabilityToDealWith(this);
26 _container->decrRef();
29 _container->incrRef();
32 ComponentInstance::ComponentInstance(const std::string& name):_compoName(name),_isAttachedOnCloning(false),_container(0)
35 stringstream instName;
36 instName << _compoName << "_" << _numId;
37 _instanceName = instName.str();
40 ComponentInstance::ComponentInstance(const ComponentInstance& other):_compoName(other._compoName),
42 _isAttachedOnCloning(other._isAttachedOnCloning)
45 stringstream instName;
46 instName << _compoName << "_" << _numId;
47 _instanceName = instName.str();
49 _container=other._container->clone();
52 ComponentInstance::~ComponentInstance()
55 _container->decrRef();
59 * By calling this method the current container 'this' is not destined to be deeply copied on clone call.
61 void ComponentInstance::attachOnCloning() const
63 _isAttachedOnCloning=true;
66 std::string ComponentInstance::getFileRepr() const
68 return NULL_FILE_REPR;
72 * By calling this method the current container 'this' will be deeply copied on clone call.
74 void ComponentInstance::dettachOnCloning() const
76 _isAttachedOnCloning=false;
79 bool ComponentInstance::isAttachedOnCloning() const
81 return _isAttachedOnCloning;
84 string ComponentInstance::getKind() const