1 // Copyright (C) 2006-2008 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.
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
19 #ifndef _GUICONTEXT_HXX_
20 #define _GUICONTEXT_HXX_
23 #include "Catalog.hxx"
24 #include "commandsProc.hxx"
25 #include "guiObservers.hxx"
35 class GuiContext: public Subject
39 virtual ~GuiContext();
40 virtual void setProc(YACS::ENGINE::Proc* proc);
41 long getNewId(YACS::HMI::TypeOfElem type);
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; };
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; }
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; };
61 inline static GuiContext* getCurrent() {return _current; };
62 inline static void setCurrent(GuiContext* context) { _current=context; };
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;
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;
83 static GuiContext* _current;
84 std::string _xmlSchema;
85 std::pair<std::string, std::string> _YACSEngineContainer; // --- <ContainerName, HostName>