Version: 9.15.0
guiContext.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
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 _GUICONTEXT_HXX_
21 #define _GUICONTEXT_HXX_
22 
23 #include "HMIExport.hxx"
24 #include "Proc.hxx"
25 #include "Catalog.hxx"
26 #include "commandsProc.hxx"
27 #include "guiObservers.hxx"
28 
29 #include <map>
30 #include <string>
31 
32 namespace YACS
33 {
34  namespace HMI
35  {
36 
38  {
39  public:
40  GuiContext();
41  virtual ~GuiContext();
42  virtual void setProc(YACS::ENGINE::Proc* proc);
43  long getNewId(YACS::HMI::TypeOfElem type);
44 
45  inline YACS::ENGINE::Catalog* getBuiltinCatalog() {return _builtinCatalog; };
46  inline YACS::ENGINE::Catalog* getSessionCatalog() {return _sessionCatalog; };
47  inline YACS::ENGINE::Catalog* getProcCatalog() {return _procCatalog; };
48  inline YACS::ENGINE::Catalog* getCurrentCatalog() {return _currentCatalog; };
49 
50  inline YACS::ENGINE::Proc* getProc() {return _proc; };
51  inline YACS::HMI::ProcInvoc* getInvoc() {return _invoc; };
52  inline YACS::HMI::SubjectProc* getSubjectProc() {return _subjectProc; };
53  inline long getNewId() {return _numItem++; };
54  inline std::string getXMLSchema() {return _xmlSchema; };
55  inline std::pair<std::string, std::string> getYACSCont() {return _YACSEngineContainer; }
56  inline bool isNotSaved() {return _isNotSaved; };
57  inline bool isLoading() {return _isLoading; };
58 
59  inline void setSessionCatalog(YACS::ENGINE::Catalog* cata) {_sessionCatalog = cata; };
60  inline void setProcCatalog(YACS::ENGINE::Catalog* cata) {_procCatalog = cata; };
61  inline void setCurrentCatalog(YACS::ENGINE::Catalog* cata) {_currentCatalog = cata; };
62  inline void setXMLSchema(std::string xmlSchema) {_xmlSchema = xmlSchema; };
63  inline void setYACSContainer(std::pair<std::string, std::string> yc) {_YACSEngineContainer = yc; };
64  inline void setNotSaved(bool isNotSaved) {_isNotSaved = isNotSaved; };
65  inline void setLoading(bool isLoading) {_isLoading = isLoading; };
66 
67  inline static GuiContext* getCurrent() {return _current; };
68  inline static void setCurrent(GuiContext* context) { _current=context; };
69 
70  std::map<YACS::ENGINE::Node*,YACS::HMI::SubjectNode*> _mapOfSubjectNode;
71  std::map<YACS::ENGINE::DataPort*,YACS::HMI::SubjectDataPort*> _mapOfSubjectDataPort;
72  std::map<std::pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*> _mapOfSubjectLink;
73  std::map<std::pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*> _mapOfSubjectControlLink;
74  std::map<YACS::ENGINE::ComponentInstance*, YACS::HMI::SubjectComponent*> _mapOfSubjectComponent;
75  std::map<YACS::ENGINE::Container*, YACS::HMI::SubjectContainerBase*> _mapOfSubjectContainer;
76  std::map<std::string, YACS::HMI::SubjectDataType*> _mapOfSubjectDataType;
77  std::map<int,YACS::HMI::SubjectNode*> _mapOfExecSubjectNode;
78  std::map<std::string, YACS::ENGINE::ComponentInstance*> _mapOfLastComponentInstance;
79  std::string _lastErrorMessage;
80 
81  protected:
89  long _numItem;
91  bool _isLoading;
93  std::string _xmlSchema;
94  std::pair<std::string, std::string> _YACSEngineContainer; // --- <ContainerName, HostName>
95 
96  };
97  }
98 }
99 #endif
#define HMI_EXPORT
Definition: HMIExport.hxx:30
class for YACS catalogs.
Definition: Catalog.hxx:42
Base class for all schema objects.
Definition: Proc.hxx:44
void setSessionCatalog(YACS::ENGINE::Catalog *cata)
Definition: guiContext.hxx:59
void setCurrentCatalog(YACS::ENGINE::Catalog *cata)
Definition: guiContext.hxx:61
static void setCurrent(GuiContext *context)
Definition: guiContext.hxx:68
std::string _xmlSchema
Definition: guiContext.hxx:93
void setNotSaved(bool isNotSaved)
Definition: guiContext.hxx:64
std::string getXMLSchema()
Definition: guiContext.hxx:54
std::pair< std::string, std::string > getYACSCont()
Definition: guiContext.hxx:55
YACS::ENGINE::Catalog * _builtinCatalog
Definition: guiContext.hxx:82
YACS::HMI::SubjectProc * getSubjectProc()
Definition: guiContext.hxx:52
void setLoading(bool isLoading)
Definition: guiContext.hxx:65
void setXMLSchema(std::string xmlSchema)
Definition: guiContext.hxx:62
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
void setYACSContainer(std::pair< std::string, std::string > yc)
Definition: guiContext.hxx:63
YACS::ENGINE::Catalog * _currentCatalog
Definition: guiContext.hxx:85
YACS::ENGINE::Proc * _proc
Definition: guiContext.hxx:86
std::string _lastErrorMessage
Definition: guiContext.hxx:79
void setProcCatalog(YACS::ENGINE::Catalog *cata)
Definition: guiContext.hxx:60
std::pair< std::string, std::string > _YACSEngineContainer
Definition: guiContext.hxx:94
std::map< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * >, YACS::HMI::SubjectLink * > _mapOfSubjectLink
Definition: guiContext.hxx:72
YACS::ENGINE::Catalog * _procCatalog
Definition: guiContext.hxx:84
std::map< YACS::ENGINE::Container *, YACS::HMI::SubjectContainerBase * > _mapOfSubjectContainer
Definition: guiContext.hxx:75
static GuiContext * _current
Definition: guiContext.hxx:92
std::map< std::string, YACS::ENGINE::ComponentInstance * > _mapOfLastComponentInstance
Definition: guiContext.hxx:78
YACS::ENGINE::Catalog * getSessionCatalog()
Definition: guiContext.hxx:46
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
Definition: guiContext.hxx:71
YACS::HMI::SubjectProc * _subjectProc
Definition: guiContext.hxx:88
std::map< std::pair< YACS::ENGINE::Node *, YACS::ENGINE::Node * >, YACS::HMI::SubjectControlLink * > _mapOfSubjectControlLink
Definition: guiContext.hxx:73
YACS::HMI::ProcInvoc * _invoc
Definition: guiContext.hxx:87
std::map< int, YACS::HMI::SubjectNode * > _mapOfExecSubjectNode
Definition: guiContext.hxx:77
YACS::ENGINE::Catalog * getProcCatalog()
Definition: guiContext.hxx:47
YACS::HMI::ProcInvoc * getInvoc()
Definition: guiContext.hxx:51
YACS::ENGINE::Catalog * getCurrentCatalog()
Definition: guiContext.hxx:48
std::map< YACS::ENGINE::ComponentInstance *, YACS::HMI::SubjectComponent * > _mapOfSubjectComponent
Definition: guiContext.hxx:74
std::map< YACS::ENGINE::Node *, YACS::HMI::SubjectNode * > _mapOfSubjectNode
Definition: guiContext.hxx:68
YACS::ENGINE::Catalog * getBuiltinCatalog()
Definition: guiContext.hxx:45
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
YACS::ENGINE::Catalog * _sessionCatalog
Definition: guiContext.hxx:83
std::map< std::string, YACS::HMI::SubjectDataType * > _mapOfSubjectDataType
Definition: guiContext.hxx:76