Version: 9.16.0
YACS::ENGINE::CppContainer Class Reference

#include <CppContainer.hxx>

Inheritance diagram for YACS::ENGINE::CppContainer:
Collaboration diagram for YACS::ENGINE::CppContainer:

Public Member Functions

 CppContainer ()
 
virtual ~CppContainer ()
 
std::string getKind () const
 
bool isAlreadyStarted (const Task *askingNode) const
 
void start (const Task *askingNode)
 
void shutdown (int level)
 
std::string getPlacementId (const Task *askingNode) const
 
std::string getFullPlacementId (const Task *askingNode) const
 
YACS::ENGINE::Containerclone () const
 WARNING ! clone behaviour MUST be in coherence with what is returned by isAttachedOnCloning() method More...
 
ContainercloneAlways () const
 
void lock ()
 
void unLock ()
 
void checkCapabilityToDealWith (const ComponentInstance *inst) const
 
bool loadComponentLibrary (const std::string &componentName)
 
CppComponentcreateComponentInstance (const std::string &componentName)
 
void createInternalInstance (const std::string &componentName, void *&obj, RunFunction &r, TerminateFunction &t)
 
void unregisterComponentInstance (CppComponent *C)
 
void setProperty (const std::string &name, const std::string &value)
 
std::string getProperty (const std::string &name) const
 
void clearProperties ()
 
void addComponentName (const std::string &name)
 
std::map< std::string, std::string > getProperties () const
 
std::map< std::string, std::string > getResourceProperties (const std::string &name) const
 
- Public Member Functions inherited from YACS::ENGINE::Container
virtual std::string getKind () const =0
 
virtual std::string getDiscreminantStrOfThis (const Task *askingNode) const
 
virtual bool isAlreadyStarted (const Task *askingNode) const =0
 
virtual void start (const Task *askingNode)=0
 
virtual void start (const Task *askingNode, const std::string &resource_name, const std::string &container_name)
 
virtual bool canAcceptImposedResource ()
 
virtual bool isUsingPythonCache ()
 
virtual void usePythonCache (bool v)
 
virtual std::string getPlacementId (const Task *askingNode) const =0
 
virtual std::string getFullPlacementId (const Task *askingNode) const =0
 
virtual void setAttachOnCloningStatus (bool val) const
 
virtual void attachOnCloning () const
 
virtual void dettachOnCloning () const
 
virtual bool isAttachedOnCloning () const
 
virtual void lock ()=0
 
virtual void unLock ()=0
 
virtual Containerclone () const =0
 WARNING ! clone behaviour MUST be in coherence with what is returned by isAttachedOnCloning() method More...
 
virtual ContainercloneAlways () const =0
 
virtual bool isSupportingRTODefNbOfComp () const
 
virtual void checkCapabilityToDealWith (const ComponentInstance *inst) const =0
 
virtual void setProperty (const std::string &name, const std::string &value)=0
 
virtual std::string getProperty (const std::string &name) const =0
 
virtual void clearProperties ()=0
 
virtual void addComponentName (const std::string &name)=0
 
virtual std::map< std::string, std::string > getProperties () const =0
 
virtual std::map< std::string, std::string > getResourceProperties (const std::string &name) const =0
 
virtual void setProperties (const std::map< std::string, std::string > &properties)
 
virtual std::string getName () const
 
void setName (std::string name)
 WARNING ! name is used in edition to identify different containers, it is not the runtime name of the container More...
 
void setProc (Proc *proc)
 
ProcgetProc ()
 
virtual void shutdown (int level)=0
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Static Public Attributes

static char KIND [] ="Cpp"
 
- Static Public Attributes inherited from YACS::ENGINE::Container
static const char KIND_ENTRY [] ="container_kind"
 
static const char AOC_ENTRY [] ="attached_on_cloning"
 
static const char USE_PYCACHE_PROPERTY [] ="use_py_cache"
 
- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 

Protected Attributes

YACS::BASES::Mutex _mutex
 
LocalContainer_trueCont
 
- Protected Attributes inherited from YACS::ENGINE::Container
std::string _name
 
bool _isAttachedOnCloning
 
Proc_proc
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Friends

class CppComponent
 
class LocalContainer
 

Additional Inherited Members

- Protected Member Functions inherited from YACS::ENGINE::Container
 Container ()
 
virtual ~Container ()
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 

Detailed Description

Definition at line 103 of file CppContainer.hxx.

Constructor & Destructor Documentation

◆ CppContainer()

CppContainer::CppContainer ( )

Local C++ container class constructor

Definition at line 51 of file CppContainer.cxx.

51 : _trueCont(0L)
52{
53 DEBTRACE("CppContainer::CppContainer()");
54}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
LocalContainer * _trueCont

References DEBTRACE.

Referenced by clone(), and cloneAlways().

◆ ~CppContainer()

CppContainer::~CppContainer ( )
virtual

Local C++ container class destructor

Definition at line 63 of file CppContainer.cxx.

64{
65 DEBTRACE("CppContainer::~CppContainer()");
66}

References DEBTRACE.

Member Function Documentation

◆ addComponentName()

void YACS::ENGINE::CppContainer::addComponentName ( const std::string &  name)
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 131 of file CppContainer.hxx.

131{ }

◆ checkCapabilityToDealWith()

void CppContainer::checkCapabilityToDealWith ( const ComponentInstance inst) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 171 of file CppContainer.cxx.

172{
173 if(inst->getKind()!=CppComponent::KIND)
174 throw Exception("CppContainer::checkCapabilityToDealWith : CppContainer is not able to deal with this type of ComponentInstance.");
175}
virtual std::string getKind() const
Return the component kind.
static const char KIND[]

References YACS::ENGINE::ComponentInstance::getKind(), and YACS::ENGINE::CppComponent::KIND.

◆ clearProperties()

void YACS::ENGINE::CppContainer::clearProperties ( )
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 130 of file CppContainer.hxx.

130{ }

◆ clone()

Container * CppContainer::clone ( ) const
virtual

WARNING ! clone behaviour MUST be in coherence with what is returned by isAttachedOnCloning() method

Implements YACS::ENGINE::Container.

Definition at line 98 of file CppContainer.cxx.

99{
101 {
102 incrRef();
103 return (Container*) (this);
104 }
105 else
106 return new CppContainer(*this);
107}

References YACS::ENGINE::Container::_isAttachedOnCloning, CppContainer(), and YACS::ENGINE::RefCounter::incrRef().

◆ cloneAlways()

Container * CppContainer::cloneAlways ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 109 of file CppContainer.cxx.

110{
111 return new CppContainer(*this);
112}

References CppContainer().

◆ createComponentInstance()

CppComponent * CppContainer::createComponentInstance ( const std::string &  componentName)

Definition at line 129 of file CppContainer.cxx.

130{
131 DEBTRACE("CppContainer::createComponentInstance");
132 if (_trueCont)
133 return _trueCont->createComponentInstance(componentName.c_str());
134 else
135 {
136 std::string mesg = "CppContainer not started";
137 throw YACS::Exception(mesg);
138 }
139}
CppComponent * createComponentInstance(const char *componentName)
Find or create a new C++ component instance.

References _trueCont, YACS::ENGINE::LocalContainer::createComponentInstance(), and DEBTRACE.

◆ createInternalInstance()

void CppContainer::createInternalInstance ( const std::string &  componentName,
void *&  obj,
RunFunction r,
TerminateFunction t 
)

Definition at line 141 of file CppContainer.cxx.

143{
144 DEBTRACE("CppContainer::createInternalInstance");
145 if (_trueCont)
146 _trueCont->createInternalInstance(name.c_str(), obj, r, t);
147 else
148 {
149 std::string mesg = "CppContainer not started";
150 throw YACS::Exception(mesg);
151 }
152}
void createInternalInstance(const char *componentName, void *&obj, RunFunction &r, TerminateFunction &t)

References _trueCont, YACS::ENGINE::LocalContainer::createInternalInstance(), DEBTRACE, testCppPluginInvokation::r, and gui.Appli::t.

Referenced by YACS::ENGINE::CppComponent::load().

◆ getFullPlacementId()

std::string CppContainer::getFullPlacementId ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 166 of file CppContainer.cxx.

167{
168 return "/";
169}

◆ getKind()

std::string CppContainer::getKind ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 78 of file CppContainer.cxx.

79{
80 return KIND;
81}

References KIND.

◆ getPlacementId()

std::string CppContainer::getPlacementId ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 161 of file CppContainer.cxx.

162{
163 return "/";
164}

◆ getProperties()

std::map< std::string, std::string > YACS::ENGINE::CppContainer::getProperties ( ) const
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 132 of file CppContainer.hxx.

132{ return std::map<std::string,std::string>(); }

◆ getProperty()

std::string YACS::ENGINE::CppContainer::getProperty ( const std::string &  name) const
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 129 of file CppContainer.hxx.

129{ return std::string(); }

◆ getResourceProperties()

std::map< std::string, std::string > YACS::ENGINE::CppContainer::getResourceProperties ( const std::string &  name) const
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 133 of file CppContainer.hxx.

133{ return std::map<std::string,std::string>(); }

◆ isAlreadyStarted()

bool CppContainer::isAlreadyStarted ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 83 of file CppContainer.cxx.

84{
85 return NULL != _trueCont;
86}

References _trueCont.

◆ loadComponentLibrary()

bool CppContainer::loadComponentLibrary ( const std::string &  componentName)

Definition at line 114 of file CppContainer.cxx.

115 {
116 if (_trueCont)
117 {
118 LocalLibrary L = _trueCont->loadComponentLibrary(componentName);
119 return L.good();
120 }
121 else
122 {
123 std::string mesg = "CppContainer not started";
124 throw YACS::Exception(mesg);
125 }
126 return false;
127 }
LocalLibrary loadComponentLibrary(const std::string &, const char *prefix=NULL, bool forcedLoad=false)

References _trueCont, YACS::ENGINE::LocalLibrary::good(), and YACS::ENGINE::LocalContainer::loadComponentLibrary().

Referenced by YACS::ENGINE::CppComponent::load().

◆ lock()

void CppContainer::lock ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 68 of file CppContainer.cxx.

69{
70 _mutex.lock();
71}
YACS::BASES::Mutex _mutex

References _mutex.

Referenced by YACS::ENGINE::CppComponent::load().

◆ setProperty()

void YACS::ENGINE::CppContainer::setProperty ( const std::string &  name,
const std::string &  value 
)
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 128 of file CppContainer.hxx.

128{ }

◆ shutdown()

void CppContainer::shutdown ( int  level)
virtual

Implements YACS::ENGINE::Container.

Definition at line 93 of file CppContainer.cxx.

94{
95
96}

◆ start()

void CppContainer::start ( const Task askingNode)
virtual

Implements YACS::ENGINE::Container.

Definition at line 88 of file CppContainer.cxx.

89{
91}
static YACS::ENGINE::LocalContainer * get()

References _trueCont, and YACS::ENGINE::LocalContainer::get().

◆ unLock()

void CppContainer::unLock ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 73 of file CppContainer.cxx.

74{
75 _mutex.unLock();
76}

References _mutex.

Referenced by YACS::ENGINE::CppComponent::load().

◆ unregisterComponentInstance()

void CppContainer::unregisterComponentInstance ( CppComponent C)

Definition at line 154 of file CppContainer.cxx.

155{
156 if (_trueCont)
158}
void unregisterComponentInstance(CppComponent *C)

References _trueCont, and YACS::ENGINE::LocalContainer::unregisterComponentInstance().

Friends And Related Function Documentation

◆ CppComponent

friend class CppComponent
friend

Definition at line 105 of file CppContainer.hxx.

◆ LocalContainer

friend class LocalContainer
friend

Definition at line 106 of file CppContainer.hxx.

Member Data Documentation

◆ _mutex

YACS::BASES::Mutex YACS::ENGINE::CppContainer::_mutex
protected

Definition at line 138 of file CppContainer.hxx.

Referenced by lock(), and unLock().

◆ _trueCont

LocalContainer* YACS::ENGINE::CppContainer::_trueCont
protected

◆ KIND

char CppContainer::KIND ="Cpp"
static

Definition at line 136 of file CppContainer.hxx.

Referenced by YACS::ENGINE::RuntimeSALOME::createContainer(), and getKind().


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