Version: 8.3.0
YACS::ENGINE::SalomeContainer Class Reference

#include <SalomeContainer.hxx>

Inheritance diagram for YACS::ENGINE::SalomeContainer:
Collaboration diagram for YACS::ENGINE::SalomeContainer:

Public Member Functions

 SalomeContainer ()
 
 SalomeContainer (const SalomeContainer &other)
 
 SalomeContainer (const Container &other, const SalomeContainerTools &sct, const SalomeContainerHelper *lmt, const std::vector< std::string > &componentNames, int shutdownLev)
 
void lock ()
 For thread safety for concurrent load operation on same Container. More...
 
void unLock ()
 For thread safety for concurrent load operation on same Container. More...
 
std::string getKind () const
 
bool isAlreadyStarted (const Task *askingNode) const
 Check if the component instance container is already started. More...
 
Engines::Container_ptr getContainerPtr (const Task *askingNode) const
 
void start (const Task *askingNode) throw (Exception)
 Start a salome container (true salome container not yacs one) with given ContainerParameters (_params) More...
 
Containerclone () const
 WARNING ! clone behaviour MUST be in coherence with what is returned by isAttachedOnCloning() method More...
 
ContainercloneAlways () const
 
std::string getPlacementId (const Task *askingNode) const
 Get the container placement id for a component instance. More...
 
std::string getFullPlacementId (const Task *askingNode) const
 Get the container full path for a component instance. More...
 
void checkCapabilityToDealWith (const ComponentInstance *inst) const throw (Exception)
 
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)
 
void addToResourceList (const std::string &name)
 
virtual CORBA::Object_ptr loadComponent (Task *inst)
 Load a component instance in this container. More...
 
void shutdown (int level)
 
std::map< std::string,
std::string > 
getResourceProperties (const std::string &name) const
 
std::map< std::string,
std::string > 
getProperties () 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 const char KIND [] ="Salome"
 
static const char TYPE_PROPERTY_STR [] ="type"
 
- 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 Member Functions

virtual ~SalomeContainer ()
 
- 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 ()
 

Protected Attributes

YACS::BASES::Mutex _mutex
 thread safety in Salome ??? More...
 
std::vector< std::string > _componentNames
 
SalomeContainerHelper_launchModeType
 
int _shutdownLevel
 
SalomeContainerTools _sct
 
- 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 SalomeComponent
 

Detailed Description

Definition at line 38 of file SalomeContainer.hxx.

Constructor & Destructor Documentation

SalomeContainer::SalomeContainer ( )

Definition at line 59 of file SalomeContainer.cxx.

Referenced by clone(), and cloneAlways().

SalomeContainer::SalomeContainer ( const SalomeContainer other)

Definition at line 63 of file SalomeContainer.cxx.

67  _sct(other._sct)
68 {
69 }
SalomeContainer::SalomeContainer ( const Container other,
const SalomeContainerTools sct,
const SalomeContainerHelper lmt,
const std::vector< std::string > &  componentNames,
int  shutdownLev 
)

Definition at line 71 of file SalomeContainer.cxx.

References YACS::ENGINE::RefCounter::incrRef().

72  :Container(other),_componentNames(componentNames),
73  _launchModeType(const_cast<SalomeContainerHelper *>(lmt)),_shutdownLevel(shutdownLev),_sct(sct)
74 {
75  if(lmt)
76  lmt->incrRef();
77 }
SalomeContainer::~SalomeContainer ( )
protectedvirtual

Definition at line 79 of file SalomeContainer.cxx.

References _launchModeType, and YACS::ENGINE::RefCounter::decrRef().

80 {
82 }

Member Function Documentation

void SalomeContainer::addComponentName ( const std::string &  name)
virtual

Implements YACS::ENGINE::Container.

Definition at line 166 of file SalomeContainer.cxx.

References _componentNames.

167 {
168  _componentNames.push_back(name);
169 }
void SalomeContainer::addToResourceList ( const std::string &  name)

Definition at line 171 of file SalomeContainer.cxx.

References _sct, and YACS::ENGINE::SalomeContainerTools::addToResourceList().

172 {
173  _sct.addToResourceList(name);
174 }
void SalomeContainer::checkCapabilityToDealWith ( const ComponentInstance inst) const throw (Exception)
virtual

Implements YACS::ENGINE::Container.

Definition at line 115 of file SalomeContainer.cxx.

References YACS::ENGINE::SalomeComponent::KIND.

116 {
117  if(inst->getKind()!=SalomeComponent::KIND)
118  throw Exception("SalomeContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
119 }
void SalomeContainer::clearProperties ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 161 of file SalomeContainer.cxx.

References _sct, and YACS::ENGINE::SalomeContainerTools::clearProperties().

162 {
164 }
Container * SalomeContainer::clone ( ) const
virtual

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

Implements YACS::ENGINE::Container.

Definition at line 99 of file SalomeContainer.cxx.

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

100 {
102  {
103  incrRef();
104  return (Container*) (this);
105  }
106  else
107  return new SalomeContainer(*this);
108 }
Container * SalomeContainer::cloneAlways ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 110 of file SalomeContainer.cxx.

References SalomeContainer().

111 {
112  return new SalomeContainer(*this);
113 }
Engines::Container_ptr SalomeContainer::getContainerPtr ( const Task askingNode) const
std::string SalomeContainer::getFullPlacementId ( const Task askingNode) const
virtual

Get the container full path for a component instance.

Parameters
instthe component instance
Returns
the full placement id

Implements YACS::ENGINE::Container.

Definition at line 200 of file SalomeContainer.cxx.

References _launchModeType, and YACS::ENGINE::SalomeContainerTools::GetFullPlacementId().

201 {
203 }
std::string SalomeContainer::getKind ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 94 of file SalomeContainer.cxx.

References KIND.

95 {
96  return KIND;
97 }
std::string SalomeContainer::getPlacementId ( const Task askingNode) const
virtual

Get the container placement id for a component instance.

Parameters
instthe component instance
Returns
the placement id

Implements YACS::ENGINE::Container.

Definition at line 190 of file SalomeContainer.cxx.

References _launchModeType, and YACS::ENGINE::SalomeContainerTools::GetPlacementId().

191 {
193 }
std::map< std::string, std::string > SalomeContainer::getProperties ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 245 of file SalomeContainer.cxx.

References _sct, and YACS::ENGINE::SalomeContainerTools::getProperties().

246 {
247  return _sct.getProperties();
248 }
std::string SalomeContainer::getProperty ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 148 of file SalomeContainer.cxx.

References YACS::ENGINE::Container::_isAttachedOnCloning, _launchModeType, _sct, YACS::ENGINE::Container::AOC_ENTRY, YACS::ENGINE::SalomeContainerTools::getProperty(), YACS::ENGINE::SalomeContainerHelper::getType(), and TYPE_PROPERTY_STR.

149 {
150  if (name == TYPE_PROPERTY_STR)
151  return _launchModeType->getType();
152  if (name==AOC_ENTRY)
153  {
154  int reti(_isAttachedOnCloning);
155  std::ostringstream oss; oss << reti;
156  return oss.str();
157  }
158  return _sct.getProperty(name);
159 }
std::map< std::string, std::string > SalomeContainer::getResourceProperties ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 240 of file SalomeContainer.cxx.

References _sct, and YACS::ENGINE::SalomeContainerTools::getResourceProperties().

241 {
242  return _sct.getResourceProperties(name);
243 }
bool SalomeContainer::isAlreadyStarted ( const Task askingNode) const
virtual

Check if the component instance container is already started.

Parameters
instthe component instance
Returns
true, if the container is already started, else false

Implements YACS::ENGINE::Container.

Definition at line 210 of file SalomeContainer.cxx.

References _launchModeType, and YACS::ENGINE::SalomeContainerHelper::isAlreadyStarted().

Referenced by YACS::ENGINE::SalomeContainerTmpForHP::loadComponent().

211 {
212  return _launchModeType->isAlreadyStarted(askingNode);
213 }
CORBA::Object_ptr SalomeContainer::loadComponent ( Task askingNode)
virtual

Load a component instance in this container.

Parameters
instthe component instance to load

Reimplemented in YACS::ENGINE::SalomeContainerTmpForHP.

Definition at line 180 of file SalomeContainer.cxx.

References _launchModeType, and YACS::ENGINE::SalomeContainerTools::LoadComponent().

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

181 {
183 }
void SalomeContainer::lock ( )
virtual

For thread safety for concurrent load operation on same Container.

Implements YACS::ENGINE::Container.

Definition at line 84 of file SalomeContainer.cxx.

References _mutex.

85 {
86  _mutex.lock();
87 }
void SalomeContainer::setProperty ( const std::string &  name,
const std::string &  value 
)
virtual

Implements YACS::ENGINE::Container.

Definition at line 121 of file SalomeContainer.cxx.

References _launchModeType, _sct, YACS::ENGINE::Container::AOC_ENTRY, YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::Container::setAttachOnCloningStatus(), YACS::ENGINE::SalomeContainerTools::setProperty(), YACS::ENGINE::SalomeContainerMonoHelper::TYPE_NAME, YACS::ENGINE::SalomeContainerMultiHelper::TYPE_NAME, and TYPE_PROPERTY_STR.

122 {
123  if (name == AOC_ENTRY)
124  {
125  std::istringstream iss(value);
126  int val;
127  iss >> val;
128  setAttachOnCloningStatus((bool)val);
129  }
130  else if (name == TYPE_PROPERTY_STR)
131  {
133  {
136  }
137  else if (value == SalomeContainerMultiHelper::TYPE_NAME)
138  {
141  }
142  else
143  throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
144  }
145  _sct.setProperty(name,value);
146 }
void SalomeContainer::shutdown ( int  level)
virtual

Implements YACS::ENGINE::Container.

Definition at line 229 of file SalomeContainer.cxx.

References _launchModeType, YACS::ENGINE::Container::_name, _shutdownLevel, DEBTRACE, and YACS::ENGINE::SalomeContainerHelper::shutdown().

230 {
231  DEBTRACE("SalomeContainer::shutdown: " << _name << "," << level << "," << _shutdownLevel);
232  if(level < _shutdownLevel)
233  return;
234 
235  _shutdownLevel=999;
236  //shutdown the SALOME containers
238 }
void SalomeContainer::start ( const Task askingNode) throw (Exception)
virtual

Start a salome container (true salome container not yacs one) with given ContainerParameters (_params)

Parameters
instthe component instance

Implements YACS::ENGINE::Container.

Definition at line 224 of file SalomeContainer.cxx.

References YACS::ENGINE::SalomeContainerTools::Start().

Referenced by YACS::ENGINE::SalomeContainerTmpForHP::loadComponent().

void SalomeContainer::unLock ( )
virtual

For thread safety for concurrent load operation on same Container.

Implements YACS::ENGINE::Container.

Definition at line 89 of file SalomeContainer.cxx.

References _mutex.

90 {
91  _mutex.unLock();
92 }

Friends And Related Function Documentation

friend class SalomeComponent
friend

Definition at line 40 of file SalomeContainer.hxx.

Member Data Documentation

std::vector<std::string> YACS::ENGINE::SalomeContainer::_componentNames
protected

Definition at line 79 of file SalomeContainer.hxx.

Referenced by addComponentName().

YACS::BASES::Mutex YACS::ENGINE::SalomeContainer::_mutex
protected

thread safety in Salome ???

Definition at line 78 of file SalomeContainer.hxx.

Referenced by lock(), and unLock().

SalomeContainerTools YACS::ENGINE::SalomeContainer::_sct
protected
int YACS::ENGINE::SalomeContainer::_shutdownLevel
protected

Definition at line 81 of file SalomeContainer.hxx.

Referenced by shutdown().

const char SalomeContainer::KIND ="Salome"
static

Definition at line 70 of file SalomeContainer.hxx.

Referenced by getKind().

const char SalomeContainer::TYPE_PROPERTY_STR ="type"
static

Definition at line 71 of file SalomeContainer.hxx.

Referenced by getProperty(), and setProperty().


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