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