Salome HOME
Revert "Synchronize adm files"
[modules/yacs.git] / src / runtime / SalomeContainer.hxx
1 // Copyright (C) 2006-2014  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __SALOMECONTAINER_HXX__
21 #define __SALOMECONTAINER_HXX__
22
23 #include "YACSRuntimeSALOMEExport.hxx"
24 #include "Container.hxx"
25 #include "Mutex.hxx"
26 #include <string>
27 #include <vector>
28 #include <SALOMEconfig.h>
29 #include CORBA_CLIENT_HEADER(SALOME_Component)
30 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
31
32 namespace YACS
33 {
34   namespace ENGINE
35   {
36     class SalomeComponent;
37
38     class YACSRUNTIMESALOME_EXPORT SalomeContainer : public Container
39     {
40       friend class SalomeComponent;
41     public:
42       SalomeContainer();
43       SalomeContainer(const SalomeContainer& other);
44       //! For thread safety for concurrent load operation on same Container.
45       void lock();
46       //! For thread safety for concurrent load operation on same Container.
47       void unLock();
48       bool isAlreadyStarted(const ComponentInstance *inst) const;
49       Engines::Container_ptr getContainerPtr(const ComponentInstance *inst) const;
50       void start(const ComponentInstance *inst) throw (Exception);
51       Container *clone() const;
52       std::string getPlacementId(const ComponentInstance *inst) const;
53       std::string getFullPlacementId(const ComponentInstance *inst) const;
54       void checkCapabilityToDealWith(const ComponentInstance *inst) const throw (Exception);
55       virtual void setProperty(const std::string& name, const std::string& value);
56       virtual void addComponentName(std::string name);
57       virtual CORBA::Object_ptr loadComponent(ComponentInstance *inst);
58       virtual void shutdown(int level);
59       // Helper methods
60       void addToComponentList(const std::string & name);
61       void addToResourceList(const std::string & name);
62       virtual std::map<std::string,std::string> getResourceProperties(const std::string& name);
63     protected:
64 #ifndef SWIG
65       virtual ~SalomeContainer();
66 #endif
67     protected:
68       //! thread safety in Salome ???
69       YACS::BASES::Mutex _mutex;
70       Engines::Container_var _trueCont;
71       std::vector<std::string> _componentNames;
72       std::map<const ComponentInstance *,Engines::Container_var> _trueContainers;
73       std::string _type;
74       int _shutdownLevel;
75     public:
76       Engines::ContainerParameters _params;
77     };
78   }
79 }
80
81 #endif