Version: 8.3.0
YACS::ENGINE::SalomeHPContainer Class Reference

#include <SalomeHPContainer.hxx>

Inheritance diagram for YACS::ENGINE::SalomeHPContainer:
Collaboration diagram for YACS::ENGINE::SalomeHPContainer:

Public Member Functions

 SalomeHPContainer ()
 
 SalomeHPContainer (const SalomeHPContainer &other)
 
void setSizeOfPool (int sz)
 
int getSizeOfPool () const
 
std::size_t getNumberOfFreePlace () const
 
void allocateFor (const std::vector< const Task * > &nodes)
 
void release (const Task *node)
 
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
 
std::string getDiscreminantStrOfThis (const Task *askingNode) const
 
bool isAlreadyStarted (const Task *askingNode) const
 
void start (const Task *askingNode) throw (Exception)
 
void shutdown (int level)
 
std::string getPlacementId (const Task *askingNode) const
 
std::string getFullPlacementId (const Task *askingNode) const
 
Containerclone () const
 
ContainercloneAlways () const
 
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
 
void checkCapabilityToDealWith (const ComponentInstance *inst) const throw (YACS::Exception)
 
std::size_t locateTask (const Task *askingNode) const
 
const SalomeContainerToolsgetContainerInfo () const
 
std::vector< std::string > getComponentNames () const
 
int getShutdownLev () const
 
SalomeContainerMonoHelpergetHelperOfTask (const Task *node)
 
const SalomeContainerMonoHelpergetHelperOfTask (const Task *node) const
 
YACS::BASES::Mutex & getLocker ()
 
- Public Member Functions inherited from YACS::ENGINE::HomogeneousPoolContainer
void attachOnCloning () const
 
void dettachOnCloning () const
 
bool isAttachedOnCloning () const
 
void setAttachOnCloningStatus (bool val) const
 
- Public Member Functions inherited from YACS::ENGINE::Container
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 [] ="HPSalome"
 
- Static Public Attributes inherited from YACS::ENGINE::HomogeneousPoolContainer
static const char SIZE_OF_POOL_KEY [] ="SizeOfPool"
 
static const char INITIALIZE_SCRIPT_KEY [] ="InitializeScriptKey"
 
- 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

 ~SalomeHPContainer ()
 
- Protected Member Functions inherited from YACS::ENGINE::HomogeneousPoolContainer
 HomogeneousPoolContainer ()
 
virtual ~HomogeneousPoolContainer ()
 
- 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

int _shutdownLevel
 
SalomeContainerTools _sct
 
YACS::BASES::Mutex _mutex
 
std::vector< std::string > _componentNames
 
SalomeHPContainerVectOfHelper _launchModeType
 
std::string _initScript
 

Detailed Description

Definition at line 43 of file SalomeHPContainer.hxx.

Constructor & Destructor Documentation

SalomeHPContainer::SalomeHPContainer ( )

Definition at line 31 of file SalomeHPContainer.cxx.

Referenced by cloneAlways().

31  :_shutdownLevel(999)
32 {
33 }
SalomeHPContainer::SalomeHPContainer ( const SalomeHPContainer other)

Definition at line 35 of file SalomeHPContainer.cxx.

36 {
37 }
SalomeHPContainer::~SalomeHPContainer ( )
protected

Definition at line 64 of file SalomeHPContainer.cxx.

65 {
66 }

Member Function Documentation

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

Implements YACS::ENGINE::Container.

Definition at line 191 of file SalomeHPContainer.cxx.

References _componentNames.

192 {
193  _componentNames.push_back(name);
194 }
void SalomeHPContainer::allocateFor ( const std::vector< const Task * > &  nodes)
virtual
void SalomeHPContainer::checkCapabilityToDealWith ( const ComponentInstance inst) const throw (YACS::Exception)
virtual

Implements YACS::ENGINE::Container.

Definition at line 211 of file SalomeHPContainer.cxx.

References YACS::ENGINE::SalomeHPComponent::KIND.

212 {
213  if(inst->getKind()!=SalomeHPComponent::KIND)
214  throw Exception("SalomeHPContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
215 }
void SalomeHPContainer::clearProperties ( )
virtual

Implements YACS::ENGINE::Container.

Definition at line 185 of file SalomeHPContainer.cxx.

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

186 {
187  _initScript.clear();
189 }
Container * SalomeHPContainer::clone ( ) const
virtual

It is not a bug here ! clone for homogeneous container is not supposed to be copied !

Implements YACS::ENGINE::Container.

Definition at line 136 of file SalomeHPContainer.cxx.

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

137 {
138  incrRef();
139  return const_cast<SalomeHPContainer*>(this);
140 }
Container * SalomeHPContainer::cloneAlways ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 142 of file SalomeHPContainer.cxx.

References SalomeHPContainer().

143 {
144  return new SalomeHPContainer(*this);
145 }
std::vector<std::string> YACS::ENGINE::SalomeHPContainer::getComponentNames ( ) const
inline

Definition at line 79 of file SalomeHPContainer.hxx.

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

79 { return _componentNames; }
const SalomeContainerTools& YACS::ENGINE::SalomeHPContainer::getContainerInfo ( ) const
inline

Definition at line 78 of file SalomeHPContainer.hxx.

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

78 { return _sct; }
std::string SalomeHPContainer::getDiscreminantStrOfThis ( const Task askingNode) const
virtual

Reimplemented from YACS::ENGINE::Container.

Definition at line 83 of file SalomeHPContainer.cxx.

References YACS::ENGINE::SalomeContainerTmpForHP::BuildFrom(), and YACS::ENGINE::SalomeContainerTmpForHP::getDiscreminantStrOfThis().

84 {
86  return tmpCont->getDiscreminantStrOfThis(askingNode);
87 }
std::string SalomeHPContainer::getFullPlacementId ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 123 of file SalomeHPContainer.cxx.

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

124 {
125  const SalomeContainerMonoHelper *helper(0);
126  {
127  YACS::BASES::AutoLocker<Container> alckCont(const_cast<SalomeHPContainer *>(this));
128  helper=_launchModeType.getHelperOfTask(askingNode);
129  }
130  return SalomeContainerTools::GetFullPlacementId(helper,this,askingNode);
131 }
SalomeContainerMonoHelper* YACS::ENGINE::SalomeHPContainer::getHelperOfTask ( const Task node)
inline

Definition at line 81 of file SalomeHPContainer.hxx.

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

81 { return _launchModeType.getHelperOfTask(node); }
const SalomeContainerMonoHelper* YACS::ENGINE::SalomeHPContainer::getHelperOfTask ( const Task node) const
inline

Definition at line 82 of file SalomeHPContainer.hxx.

82 { return _launchModeType.getHelperOfTask(node); }
std::string SalomeHPContainer::getKind ( ) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 78 of file SalomeHPContainer.cxx.

References KIND.

79 {
80  return KIND;
81 }
YACS::BASES::Mutex& YACS::ENGINE::SalomeHPContainer::getLocker ( )
inline

Definition at line 84 of file SalomeHPContainer.hxx.

84 { return _mutex; }
std::size_t SalomeHPContainer::getNumberOfFreePlace ( ) const
virtual
std::string SalomeHPContainer::getPlacementId ( const Task askingNode) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 113 of file SalomeHPContainer.cxx.

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

114 {
115  const SalomeContainerMonoHelper *helper(0);
116  {
117  YACS::BASES::AutoLocker<Container> alckCont(const_cast<SalomeHPContainer *>(this));
118  helper=_launchModeType.getHelperOfTask(askingNode);
119  }
120  return SalomeContainerTools::GetPlacementId(helper,this,askingNode);
121 }
std::map< std::string, std::string > SalomeHPContainer::getProperties ( ) const
virtual
std::string SalomeHPContainer::getProperty ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 166 of file SalomeHPContainer.cxx.

References _initScript, _sct, YACS::ENGINE::Container::AOC_ENTRY, YACS::ENGINE::SalomeContainerTools::getProperty(), getSizeOfPool(), YACS::ENGINE::HomogeneousPoolContainer::INITIALIZE_SCRIPT_KEY, and YACS::ENGINE::HomogeneousPoolContainer::SIZE_OF_POOL_KEY.

167 {
168  if(name==AOC_ENTRY)
169  {
170  return std::string("1");
171  }
172  else if(name==SIZE_OF_POOL_KEY)
173  {
174  std::ostringstream oss; oss << getSizeOfPool();
175  return oss.str();
176  }
177  else if(name==INITIALIZE_SCRIPT_KEY)
178  {
179  return _initScript;
180  }
181  else
182  return _sct.getProperty(name);
183 }
std::map< std::string, std::string > SalomeHPContainer::getResourceProperties ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Container.

Definition at line 206 of file SalomeHPContainer.cxx.

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

207 {
208  return _sct.getResourceProperties(name);
209 }
int YACS::ENGINE::SalomeHPContainer::getShutdownLev ( ) const
inline

Definition at line 80 of file SalomeHPContainer.hxx.

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

80 { return _shutdownLevel; }
int SalomeHPContainer::getSizeOfPool ( ) const
virtual
bool SalomeHPContainer::isAlreadyStarted ( const Task askingNode) const
virtual
std::size_t YACS::ENGINE::SalomeHPContainer::locateTask ( const Task askingNode) const
inline

Definition at line 77 of file SalomeHPContainer.hxx.

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

77 { return _launchModeType.locateTask(askingNode); }
void SalomeHPContainer::lock ( )
virtual

For thread safety for concurrent load operation on same Container.

Implements YACS::ENGINE::Container.

Definition at line 68 of file SalomeHPContainer.cxx.

References _mutex.

69 {
70  _mutex.lock();
71 }
void SalomeHPContainer::release ( const Task node)
virtual
void SalomeHPContainer::setProperty ( const std::string &  name,
const std::string &  value 
)
virtual

Implements YACS::ENGINE::Container.

Definition at line 147 of file SalomeHPContainer.cxx.

References _initScript, _sct, YACS::ENGINE::Container::AOC_ENTRY, YACS::ENGINE::HomogeneousPoolContainer::INITIALIZE_SCRIPT_KEY, YACS::ENGINE::SalomeContainerTools::setProperty(), setSizeOfPool(), and YACS::ENGINE::HomogeneousPoolContainer::SIZE_OF_POOL_KEY.

148 {
149  if(name==AOC_ENTRY)//no sense to set it ! It is always true ! ignore it !
150  return ;
151  else if(name==SIZE_OF_POOL_KEY)
152  {
153  std::istringstream iss(value);
154  int val(0);
155  iss >> val;
156  setSizeOfPool(val);
157  }
158  else if(name==INITIALIZE_SCRIPT_KEY)
159  {
160  _initScript=value;
161  }
162  else
163  _sct.setProperty(name,value);
164 }
void SalomeHPContainer::setSizeOfPool ( int  sz)
virtual
void SalomeHPContainer::shutdown ( int  level)
virtual
void SalomeHPContainer::start ( const Task askingNode) throw (Exception)
virtual
void SalomeHPContainer::unLock ( )
virtual

For thread safety for concurrent load operation on same Container.

Implements YACS::ENGINE::Container.

Definition at line 73 of file SalomeHPContainer.cxx.

References _mutex.

74 {
75  _mutex.unLock();
76 }

Member Data Documentation

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

Definition at line 96 of file SalomeHPContainer.hxx.

Referenced by addComponentName().

std::string YACS::ENGINE::SalomeHPContainer::_initScript
protected

Definition at line 99 of file SalomeHPContainer.hxx.

Referenced by clearProperties(), getProperties(), getProperty(), and setProperty().

SalomeHPContainerVectOfHelper YACS::ENGINE::SalomeHPContainer::_launchModeType
protected
YACS::BASES::Mutex YACS::ENGINE::SalomeHPContainer::_mutex
protected

Definition at line 95 of file SalomeHPContainer.hxx.

Referenced by lock(), and unLock().

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

Definition at line 93 of file SalomeHPContainer.hxx.

Referenced by shutdown().

const char SalomeHPContainer::KIND ="HPSalome"
static

Definition at line 87 of file SalomeHPContainer.hxx.

Referenced by getKind().


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