Salome HOME
f4c5d0994cb7c51623becfacdabd890c01749a76
[modules/yacs.git] / src / engine / Container.hxx
1 // Copyright (C) 2006-2013  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.
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 __CONTAINER_HXX__
21 #define __CONTAINER_HXX__
22
23 #include "YACSlibEngineExport.hxx"
24 #include "Exception.hxx"
25 #include "RefCounter.hxx"
26
27 #include <list>
28 #include <map>
29
30 namespace YACS
31 {
32   namespace ENGINE
33   {
34     class ComponentInstance;
35     class Proc;
36     /*!
37      * This is an abstract class, that represents an abstract process in which ComponentInstances can be launched and run.
38      */
39     class YACSLIBENGINE_EXPORT Container : public RefCounter
40     {
41     protected:
42       Container();
43 #ifndef SWIG
44       virtual ~Container();
45 #endif
46     public:
47       //Execution only methods
48       virtual bool isAlreadyStarted(const ComponentInstance *inst) const = 0;
49       virtual void start(const ComponentInstance *inst) throw(Exception) = 0;
50       virtual std::string getPlacementId(const ComponentInstance *inst) const = 0;
51       virtual std::string getFullPlacementId(const ComponentInstance *inst) const = 0;
52       //Edition only methods
53       virtual void attachOnCloning() const;
54       virtual void dettachOnCloning() const;
55       bool isAttachedOnCloning() const;
56       //! \b WARNING ! clone behaviour \b MUST be in coherence with what is returned by isAttachedOnCloning() method
57       virtual Container *clone() const = 0;
58       virtual bool isSupportingRTODefNbOfComp() const;
59       virtual void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception) = 0;
60       virtual void setProperty(const std::string& name,const std::string& value);
61       virtual std::string getProperty(const std::string& name);
62       std::map<std::string,std::string> getProperties() { return _propertyMap; };
63       virtual void setProperties(std::map<std::string,std::string> properties);
64       std::string getName() const { return _name; };
65       //! \b WARNING ! name is used in edition to identify different containers, it is not the runtime name of the container
66       void setName(std::string name) { _name = name; };
67       void setProc(Proc* proc) { _proc = proc; };
68       Proc* getProc() { return _proc; };
69       virtual void shutdown(int level);
70       virtual std::map<std::string,std::string> getResourceProperties(const std::string& name) { return _propertyMap; };
71
72     protected:
73       std::string _name;
74       mutable bool _isAttachedOnCloning;
75       std::map<std::string,std::string> _propertyMap;
76       Proc* _proc;
77     };
78   }
79 }
80
81 #endif