Version: 8.3.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) throw (YACS::Exception)
 
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 throw (YACS::Exception)
 
bool loadComponentLibrary (const std::string &componentName) throw (YACS::Exception)
 
CppComponentcreateComponentInstance (const std::string &componentName, int studyID=0)
 
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 getDiscreminantStrOfThis (const Task *askingNode) const
 
virtual void setAttachOnCloningStatus (bool val) const
 
virtual void attachOnCloning () const
 
virtual void dettachOnCloning () const
 
virtual bool isAttachedOnCloning () const
 
virtual bool isSupportingRTODefNbOfComp () const
 
virtual void setProperties (const std::map< std::string, std::string > &properties)
 
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 ()
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef ()
 

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 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 ()
 

Detailed Description

Definition at line 103 of file CppContainer.hxx.

Constructor & Destructor Documentation

CppContainer::CppContainer ( )

Local C++ container class constructor

Definition at line 51 of file CppContainer.cxx.

References DEBTRACE.

Referenced by clone(), and cloneAlways().

51  : _trueCont(0L)
52 {
53  DEBTRACE("CppContainer::CppContainer()");
54 }
CppContainer::~CppContainer ( )
virtual

Local C++ container class destructor

Definition at line 63 of file CppContainer.cxx.

References DEBTRACE.

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

Member Function Documentation

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

Implements YACS::ENGINE::Container.

Definition at line 131 of file CppContainer.hxx.

131 { }
void CppContainer::checkCapabilityToDealWith ( const ComponentInstance inst) const throw (YACS::Exception)
virtual

Implements YACS::ENGINE::Container.

Definition at line 171 of file CppContainer.cxx.

References YACS::ENGINE::CppComponent::KIND.

172 {
173  if(inst->getKind()!=CppComponent::KIND)
174  throw Exception("CppContainer::checkCapabilityToDealWith : CppContainer is not able to deal with this type of ComponentInstance.");
175 }
void YACS::ENGINE::CppContainer::clearProperties ( )
inlinevirtual

Implements YACS::ENGINE::Container.

Definition at line 130 of file CppContainer.hxx.

130 { }
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.

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

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

Implements YACS::ENGINE::Container.

Definition at line 109 of file CppContainer.cxx.

References CppContainer().

110 {
111  return new CppContainer(*this);
112 }
CppComponent * CppContainer::createComponentInstance ( const std::string &  componentName,
int  studyID = 0 
)

Definition at line 129 of file CppContainer.cxx.

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

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 }
void CppContainer::createInternalInstance ( const std::string &  componentName,
void *&  obj,
RunFunction r,
TerminateFunction t 
)

Definition at line 141 of file CppContainer.cxx.

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

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

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 }
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 }
std::string CppContainer::getKind ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 78 of file CppContainer.cxx.

References KIND.

79 {
80  return KIND;
81 }
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 }
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>(); }
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(); }
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>(); }
bool CppContainer::isAlreadyStarted ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 83 of file CppContainer.cxx.

References _trueCont.

84 {
85  return NULL != _trueCont;
86 }
bool CppContainer::loadComponentLibrary ( const std::string &  componentName) throw (YACS::Exception)

Definition at line 114 of file CppContainer.cxx.

References YACS::ENGINE::LocalLibrary::good().

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

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  }
void CppContainer::lock ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 68 of file CppContainer.cxx.

References _mutex.

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

69 {
70  _mutex.lock();
71 }
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 { }
void CppContainer::shutdown ( int  level)
virtual

Implements YACS::ENGINE::Container.

Definition at line 93 of file CppContainer.cxx.

94 {
95 
96 }
void CppContainer::start ( const Task askingNode) throw (YACS::Exception)
virtual

Implements YACS::ENGINE::Container.

Definition at line 88 of file CppContainer.cxx.

References YACS::ENGINE::LocalContainer::get().

89 {
91 }
void CppContainer::unLock ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 73 of file CppContainer.cxx.

References _mutex.

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

74 {
75  _mutex.unLock();
76 }
void CppContainer::unregisterComponentInstance ( CppComponent C)

Definition at line 154 of file CppContainer.cxx.

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

155 {
156  if (_trueCont)
158 }

Friends And Related Function Documentation

friend class CppComponent
friend

Definition at line 105 of file CppContainer.hxx.

friend class LocalContainer
friend

Definition at line 106 of file CppContainer.hxx.

Member Data Documentation

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

Definition at line 138 of file CppContainer.hxx.

Referenced by lock(), and unLock().

LocalContainer* YACS::ENGINE::CppContainer::_trueCont
protected
char CppContainer::KIND ="Cpp"
static

Definition at line 136 of file CppContainer.hxx.

Referenced by getKind().


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