1 // Copyright (C) 2006-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __SALOMEHPCONTAINER_HXX__
21 #define __SALOMEHPCONTAINER_HXX__
23 #include "YACSRuntimeSALOMEExport.hxx"
24 #include "HomogeneousPoolContainer.hxx"
25 #include "SalomeContainerHelper.hxx"
26 #include "SalomeContainerTools.hxx"
27 #include "SalomeHPContainerTools.hxx"
32 #include <SALOMEconfig.h>
33 #include CORBA_CLIENT_HEADER(SALOME_Component)
34 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
41 class SalomeComponent;
43 class YACSRUNTIMESALOME_EXPORT SalomeHPContainer : public HomogeneousPoolContainer
47 SalomeHPContainer(const SalomeHPContainer& other);
49 void setSizeOfPool(int sz);
50 int getSizeOfPool() const;
51 std::size_t getNumberOfFreePlace() const;
52 void allocateFor(const std::vector<const Task *>& nodes);
53 void release(const Task *node);
54 //! For thread safety for concurrent load operation on same Container.
56 //! For thread safety for concurrent load operation on same Container.
59 std::string getKind() const;
60 std::string getDiscreminantStrOfThis(const Task *askingNode) const;
61 bool isAlreadyStarted(const Task *askingNode) const;
62 void start(const Task *askingNode) throw(Exception);
63 void shutdown(int level);
64 std::string getPlacementId(const Task *askingNode) const;
65 std::string getFullPlacementId(const Task *askingNode) const;
66 Container *clone() const;
67 Container *cloneAlways() const;
68 void setProperty(const std::string& name,const std::string& value);
69 std::string getProperty(const std::string& name) const;
70 void clearProperties();
71 void addComponentName(const std::string& name);
72 std::map<std::string,std::string> getProperties() const;
73 std::map<std::string,std::string> getResourceProperties(const std::string& name) const;
74 void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception);
77 std::size_t locateTask(const Task *askingNode) const { return _launchModeType.locateTask(askingNode); }
78 const SalomeContainerTools &getContainerInfo() const { return _sct; }
79 std::vector<std::string> getComponentNames() const { return _componentNames; }
80 int getShutdownLev() const { return _shutdownLevel; }
81 SalomeContainerMonoHelper *getHelperOfTask(const Task *node) { return _launchModeType.getHelperOfTask(node); }
82 const SalomeContainerMonoHelper *getHelperOfTask(const Task *node) const { return _launchModeType.getHelperOfTask(node); }
84 YACS::BASES::Mutex& getLocker() { return _mutex; }
87 static const char KIND[];
94 SalomeContainerTools _sct;
95 YACS::BASES::Mutex _mutex;
96 std::vector<std::string> _componentNames;
98 SalomeHPContainerVectOfHelper _launchModeType;
99 std::string _initScript;