Version: 9.16.0
guiContext.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 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#include "RuntimeSALOME.hxx"
21#include "guiContext.hxx"
22#include "Proc.hxx"
23#include "Container.hxx"
24#include "ComponentInstance.hxx"
25#include "commandsProc.hxx"
26#include "guiObservers.hxx"
27
28//#define _DEVDEBUG_
29#include "YacsTrace.hxx"
30
31using namespace std;
32
33using namespace YACS;
34using namespace YACS::ENGINE;
35using namespace YACS::HMI;
36
37GuiContext * GuiContext::_current = 0;
38
39GuiContext::GuiContext()
40 : Subject(0)
41{
44 _procCatalog = 0;
46
47 _invoc = new ProcInvoc();
48 _proc = 0;
49 _subjectProc = 0;
50 _numItem = 0;
51 _isNotSaved = false;
52 _isLoading = false;
53
54 _mapOfSubjectNode.clear();
56 _mapOfSubjectLink.clear();
64 _xmlSchema ="";
65 _YACSEngineContainer = pair<string, string>("YACSServer","localhost");
66}
67
69{
70 if (_invoc) delete _invoc;
71 _invoc = 0;
72 if (_subjectProc)
73 {
75 delete _subjectProc;
76 _subjectProc = 0;
77 }
78 _current = 0;
79}
80
82{
83 DEBTRACE("GuiContext::setProc ");
84 if (_subjectProc)
85 {
87 _subjectProc = 0;
88 }
89 _proc = proc;
90 _mapOfSubjectNode.clear();
92 _mapOfSubjectLink.clear();
99
100 _subjectProc = new SubjectProc(proc, this);
101 _mapOfSubjectNode[static_cast<Node*>(proc)] = _subjectProc;
105}
106
108{
109 return _numItem++;
110}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for all nodes.
Definition: Node.hxx:70
Base class for all schema objects.
Definition: Proc.hxx:44
Catalog * getBuiltinCatalog()
Get the catalog of base nodes (elementary and composed)
Definition: Runtime.cxx:314
std::string _xmlSchema
Definition: guiContext.hxx:93
YACS::ENGINE::Catalog * _builtinCatalog
Definition: guiContext.hxx:82
YACS::ENGINE::Catalog * _currentCatalog
Definition: guiContext.hxx:85
YACS::ENGINE::Proc * _proc
Definition: guiContext.hxx:86
std::string _lastErrorMessage
Definition: guiContext.hxx:79
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
virtual void setProc(YACS::ENGINE::Proc *proc)
Definition: guiContext.cxx:81
std::map< std::string, YACS::ENGINE::ComponentInstance * > _mapOfLastComponentInstance
Definition: guiContext.hxx:78
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
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:70
YACS::ENGINE::Catalog * _sessionCatalog
Definition: guiContext.hxx:83
std::map< std::string, YACS::HMI::SubjectDataType * > _mapOfSubjectDataType
Definition: guiContext.hxx:76
virtual void clean(Command *command=0)
virtual void update(GuiEvent event, int type, Subject *son)
static void erase(Subject *sub, Command *command=0, bool post=false)
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()