]> SALOME platform Git repositories - modules/yacs.git/blob - src/hmi/guiContext.hxx
Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / src / hmi / guiContext.hxx
1 //  Copyright (C) 2006-2008  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 #ifndef _GUICONTEXT_HXX_
20 #define _GUICONTEXT_HXX_
21
22 #include "Proc.hxx"
23 #include "Catalog.hxx"
24 #include "commandsProc.hxx"
25 #include "guiObservers.hxx"
26
27 #include <map>
28 #include <string>
29
30 namespace YACS
31 {
32   namespace HMI
33   {
34
35     class GuiContext: public Subject
36     {
37     public:
38       GuiContext();
39       virtual ~GuiContext();
40       virtual void setProc(YACS::ENGINE::Proc* proc);
41       long getNewId(YACS::HMI::TypeOfElem type);
42
43       inline YACS::ENGINE::Catalog* getBuiltinCatalog()        {return _builtinCatalog; };
44       inline YACS::ENGINE::Catalog* getSessionCatalog()        {return _sessionCatalog; };
45       inline YACS::ENGINE::Catalog* getProcCatalog()           {return _procCatalog; };
46       inline YACS::ENGINE::Catalog* getCurrentCatalog()        {return _currentCatalog; };
47
48       inline YACS::ENGINE::Proc* getProc()                     {return _proc; };
49       inline YACS::HMI::ProcInvoc* getInvoc()                  {return _invoc; };
50       inline YACS::HMI::SubjectProc* getSubjectProc()          {return _subjectProc; };
51       inline long getNewId()                                   {return _numItem++; };
52       inline std::string getXMLSchema()                        {return _xmlSchema; };
53       inline std::pair<std::string, std::string> getYACSCont() {return _YACSEngineContainer; }
54
55       inline void setSessionCatalog(YACS::ENGINE::Catalog* cata)           {_sessionCatalog = cata; };
56       inline void setProcCatalog(YACS::ENGINE::Catalog* cata)              {_procCatalog = cata; };
57       inline void setCurrentCatalog(YACS::ENGINE::Catalog* cata)           {_currentCatalog = cata; };
58       inline void setXMLSchema(std::string xmlSchema)                      {_xmlSchema = xmlSchema; };
59       inline void setYACSContainer(std::pair<std::string, std::string> yc) {_YACSEngineContainer = yc; };
60
61       inline static GuiContext* getCurrent()             {return _current; };
62       inline static void setCurrent(GuiContext* context) { _current=context; };
63
64       std::map<YACS::ENGINE::Node*,YACS::HMI::SubjectNode*>                                        _mapOfSubjectNode;
65       std::map<YACS::ENGINE::DataPort*,YACS::HMI::SubjectDataPort*>                                _mapOfSubjectDataPort;
66       std::map<std::pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*>   _mapOfSubjectLink;
67       std::map<std::pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*> _mapOfSubjectControlLink;
68       std::map<YACS::ENGINE::ComponentInstance*, YACS::HMI::SubjectComponent*>                     _mapOfSubjectComponent;
69       std::map<YACS::ENGINE::Container*, YACS::HMI::SubjectContainer*>                             _mapOfSubjectContainer;
70       std::map<std::string, YACS::HMI::SubjectDataType*>                                           _mapOfSubjectDataType;
71       std::map<int,YACS::HMI::SubjectNode*>                                                        _mapOfExecSubjectNode;
72       std::string _lastErrorMessage;
73
74     protected:
75       YACS::ENGINE::Catalog* _builtinCatalog;
76       YACS::ENGINE::Catalog* _sessionCatalog;
77       YACS::ENGINE::Catalog* _procCatalog;
78       YACS::ENGINE::Catalog* _currentCatalog;
79       YACS::ENGINE::Proc* _proc;
80       YACS::HMI::ProcInvoc* _invoc;
81       YACS::HMI::SubjectProc *_subjectProc;
82       long _numItem;
83       static GuiContext* _current;
84       std::string _xmlSchema;
85       std::pair<std::string, std::string> _YACSEngineContainer; // --- <ContainerName, HostName>
86
87     };
88   }
89 }
90 #endif