1 // Copyright (C) 2006-2024 CEA, EDF
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.
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
20 #include "RuntimeSALOME.hxx"
21 #include "guiContext.hxx"
23 #include "Container.hxx"
24 #include "ComponentInstance.hxx"
25 #include "commandsProc.hxx"
26 #include "guiObservers.hxx"
29 #include "YacsTrace.hxx"
34 using namespace YACS::ENGINE;
35 using namespace YACS::HMI;
37 GuiContext * GuiContext::_current = 0;
39 GuiContext::GuiContext()
42 _builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
47 _invoc = new ProcInvoc();
54 _mapOfSubjectNode.clear();
55 _mapOfSubjectDataPort.clear();
56 _mapOfSubjectLink.clear();
57 _mapOfSubjectControlLink.clear();
58 _mapOfSubjectComponent.clear();
59 _mapOfSubjectContainer.clear();
60 _mapOfSubjectDataType.clear();
61 _mapOfExecSubjectNode.clear();
62 _mapOfLastComponentInstance.clear();
63 _lastErrorMessage ="";
65 _YACSEngineContainer = pair<string, string>("YACSServer","localhost");
68 GuiContext::~GuiContext()
70 if (_invoc) delete _invoc;
74 _subjectProc->clean();
81 void GuiContext::setProc(YACS::ENGINE::Proc* proc)
83 DEBTRACE("GuiContext::setProc ");
86 Subject::erase(_subjectProc);
90 _mapOfSubjectNode.clear();
91 _mapOfSubjectDataPort.clear();
92 _mapOfSubjectLink.clear();
93 _mapOfSubjectControlLink.clear();
94 _mapOfSubjectComponent.clear();
95 _mapOfSubjectContainer.clear();
96 _mapOfSubjectDataType.clear();
97 _mapOfLastComponentInstance.clear();
98 _lastErrorMessage ="";
100 _subjectProc = new SubjectProc(proc, this);
101 _mapOfSubjectNode[static_cast<Node*>(proc)] = _subjectProc;
102 update(YACS::HMI::NEWROOT, 0, _subjectProc);
103 _subjectProc->loadProc();
104 update(YACS::HMI::ENDLOAD, 0, _subjectProc);
107 long GuiContext::getNewId(YACS::HMI::TypeOfElem type)