Salome HOME
First implementation of evalyfx.
[modules/yacs.git] / src / engine / Proc.hxx
1 // Copyright (C) 2006-2015  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, 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 _PROC_HXX_
21 #define _PROC_HXX_
22
23 #include "YACSlibEngineExport.hxx"
24 #include "Bloc.hxx"
25
26 #include <string>
27 #include <iostream>
28 #include <list>
29 #include <map>
30
31 namespace YACS
32 {
33   namespace ENGINE
34   {
35     class TypeCode;
36     class TypeCodeObjref;
37     class InlineNode;
38     class ServiceNode;
39     class Container;
40     class ComponentInstance;
41     class Logger;
42
43     class YACSLIBENGINE_EXPORT Proc : public Bloc
44     {
45     public:
46       Proc(const std::string& name);
47       virtual ~Proc();
48       virtual TypeCode *createType(const std::string& name, const std::string& kind);
49       virtual TypeCode *createInterfaceTc(const std::string& id, const std::string& name, 
50                                          std::list<TypeCodeObjref *> ltc);
51       virtual TypeCode *createSequenceTc (const std::string& id, const std::string& name, 
52                                          TypeCode *content);
53       virtual TypeCode *createStructTc (const std::string& id, const std::string& name);
54       virtual TypeCode *getTypeCode(const std::string& name);
55       virtual void setTypeCode(const std::string& name,TypeCode *t);
56       virtual Container *createContainer(const std::string& name, const std::string& kind="");
57       virtual ComponentInstance *createComponentInstance(const std::string& componame,
58                                                          const std::string& name="",
59                                                          const std::string& kind="");
60       virtual void addComponentInstance(ComponentInstance* inst, const std::string& name="",bool resetCtr=false);
61       virtual void removeComponentInstance(ComponentInstance* inst);
62       virtual void removeContainer(Container* cont);
63       virtual void accept(Visitor *visitor);
64       virtual Proc *getProc();
65       virtual const Proc *getProc() const;
66       virtual void updateContainersAndComponents();
67
68       YACS::StatesForNode getNodeState(int numId);
69       std::string getNodeProgress(int numId);
70       std::string getInPortValue(int nodeNumId, std::string portName);
71       std::string setInPortValue(std::string nodeName, std::string portName, std::string value);
72       std::string getOutPortValue(int nodeNumId, std::string portName);
73       std::string getNodeErrorDetails(int nodeNumId);
74       std::string getNodeErrorReport(int nodeNumId);
75       std::string getNodeContainerLog(int nodeNumId);
76       std::string getXMLState(int numId);
77       std::list<int> getNumIds();
78       std::list<std::string> getIds();
79       virtual Logger *getLogger(const std::string& name);
80
81       virtual void writeDot(std::ostream &os) const;
82       void setName(const std::string& name); // Used by GUI to display graph name
83       virtual std::string typeName() {return "YACS__ENGINE__Proc";}
84
85       friend std::ostream & operator<< ( std::ostream &os, const Proc& p);
86       std::map<std::string, Node*> nodeMap;
87       std::map<std::string, ServiceNode*> serviceMap;
88       std::map<std::string, InlineNode*> inlineMap;
89       std::map<std::string, TypeCode*> typeMap;
90       std::map<std::string, Container*> containerMap;
91       std::map<std::string, ComponentInstance*> componentInstanceMap;
92       std::vector<std::string> names;
93
94       typedef std::map<std::string, Logger*> LoggerMap;
95       LoggerMap _loggers;
96       virtual bool getEdition(){return _edition;}
97       virtual void setEdition(bool edition);
98       virtual void modified();
99       virtual void saveSchema(const std::string& xmlSchemaFile);
100       virtual void saveState(const std::string& xmlStateFile);
101     protected:
102       void removeContainers();
103     protected:
104       bool _edition;
105       int _compoinstctr;
106
107     };
108   }
109 }
110
111 #endif