From: yfr Date: Tue, 20 Jul 2004 09:27:37 +0000 (+0000) Subject: DCQ:prepare 2.0.0 X-Git-Tag: V2_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e92234e01975ce15be247ff9d03f7b3e9cd7fccb;p=modules%2Fsuperv.git DCQ:prepare 2.0.0 --- diff --git a/doc/html/INPUT/HTML/AddComponent.html b/doc/html/INPUT/HTML/AddComponent.html deleted file mode 100644 index b9ec0e7..0000000 --- a/doc/html/INPUT/HTML/AddComponent.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
interface AddComponent
IDL file
Python
Adder Addition ( )
return_value = Addition ( )
double Add ( in double x, in double y, out double z )
[ return_value, z ] = Add ( x, y )
double LastResult ( )
return_value = LastResult ( )

- - - - - - - - - - - - - - - - - - - - - - - -
interface Adder
IDL file
Python
double Add ( in double x, in double y, out double z )
[ return_value, z ] = Add ( x, y )
double AddAndCompare ( in double x, in double y, in Adder anOtherAdder, out double z )
[ return_value, z ] = AddAndCompare ( x, y, anOtherAdder )
void SetLastResult ( in double z )
SetLastResult ( z )
void LastResult ( out double z )
z = LastResult ( )

-
diff --git a/doc/html/INPUT/HTML/DivComponent.html b/doc/html/INPUT/HTML/DivComponent.html deleted file mode 100644 index 7e0477c..0000000 --- a/doc/html/INPUT/HTML/DivComponent.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
interface DivComponent
IDL file
Python
void Div ( in double x, in double y, out double z )
z = Div ( x, y )

-
diff --git a/doc/html/INPUT/HTML/FactorialComponent.html b/doc/html/INPUT/HTML/FactorialComponent.html deleted file mode 100644 index b95e4b9..0000000 --- a/doc/html/INPUT/HTML/FactorialComponent.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
interface FactorialComponent
IDL file
Python
long eval ( in long n )
return_value = eval ( n )

-
diff --git a/doc/html/INPUT/HTML/MulComponent.html b/doc/html/INPUT/HTML/MulComponent.html deleted file mode 100644 index df34913..0000000 --- a/doc/html/INPUT/HTML/MulComponent.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
interface MulComponent
IDL file
Python
void Mul ( in double x, in double y, out double z )
z = Mul ( x, y )

-
diff --git a/doc/html/INPUT/HTML/NPMatComponent.html b/doc/html/INPUT/HTML/NPMatComponent.html deleted file mode 100644 index ae3d601..0000000 --- a/doc/html/INPUT/HTML/NPMatComponent.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
interface PCSRMat
IDL file
Python
unsigned long NbRows ( )
return_value = NbRows ( )
unsigned long NbCols ( )
return_value = NbCols ( )
void LMat ( out unsigned long start, out unsigned long end )
[ start, end ] = LMat ( )
CSRMatStruct ncsrmat ( in unsigned long start, in unsigned long end )
return_value = ncsrmat ( start, end )

- - - - - - - - - - - - - - - - - - - - - - - -
interface NPMatComponent
IDL file
Python
void SetFileName ( in string filename )
SetFileName ( filename )
void ReadDataFromFile ( in string id_callback )
ReadDataFromFile ( id_callback )
void SaveDataToFile ( in string id_callback )
SaveDataToFile ( id_callback )
void SPGetData ( in string id_callback )
SPGetData ( id_callback )

-
diff --git a/doc/html/INPUT/HTML/NPSolveComponent.html b/doc/html/INPUT/HTML/NPSolveComponent.html deleted file mode 100644 index c7f797f..0000000 --- a/doc/html/INPUT/HTML/NPSolveComponent.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - -
interface NPSolveComponent
IDL file
Python
void Solve ( in PCSRMat A, in PVec b, out PVec x )
x = Solve ( A, b )
void SPSolve ( in PCSRMat A, in PVec b, in string id_callback )
SPSolve ( A, b, id_callback )

-
diff --git a/doc/html/INPUT/HTML/NPVecComponent.html b/doc/html/INPUT/HTML/NPVecComponent.html deleted file mode 100644 index 9f39247..0000000 --- a/doc/html/INPUT/HTML/NPVecComponent.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
interface PVec
IDL file
Python
unsigned long Size ( )
return_value = Size ( )
void LVec ( out unsigned long start, out unsigned long end )
[ start, end ] = LVec ( )
DoubleVec nvec ( in unsigned long start, in unsigned long end )
return_value = nvec ( start, end )

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface NPVecComponent
IDL file
Python
void SetFileName ( in string filename )
SetFileName ( filename )
void ReadDataFromFile ( in string id_callback )
ReadDataFromFile ( id_callback )
void SaveDataToFile ( in string id_callback )
SaveDataToFile ( id_callback )
void SPGetData ( in string id_callback )
SPGetData ( id_callback )
void SPPutData ( in PVec vec, in string id_callback )
SPPutData ( vec, id_callback )

-
diff --git a/doc/html/INPUT/HTML/SUPERV.html b/doc/html/INPUT/HTML/SUPERV.html deleted file mode 100644 index a191eaa..0000000 --- a/doc/html/INPUT/HTML/SUPERV.html +++ /dev/null @@ -1,682 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface SuperG
IDL file
Python
Graph Graph ( in string aGraph )
return_value = Graph ( aGraph )
Graph GraphE ( in string aGraph )
return_value = GraphE ( aGraph )
Value StringValue ( in string aString )
return_value = StringValue ( aString )
Value AnyValue ( in any anAny )
return_value = AnyValue ( anAny )
Graph getGraph ( in string ior )
return_value = getGraph ( ior )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface CNode
IDL file
Python
string Name ( )
return_value = Name ( )
Service Service ( )
return_value = Service ( )
KindOfNode Kind ( )
return_value = Kind ( )
SDate CreationDate ( )
return_value = CreationDate ( )
SDate LastUpdateDate ( )
return_value = LastUpdateDate ( )
string Version ( )
return_value = Version ( )
string Author ( )
return_value = Author ( )
string Comment ( )
return_value = Comment ( )
boolean SetName ( in string aNewName )
return_value = SetName ( aNewName )
boolean SetAuthor ( in string anAuthor )
return_value = SetAuthor ( anAuthor )
boolean SetComment ( in string aComment )
return_value = SetComment ( aComment )
Port Port ( in string aParameterName )
return_value = Port ( aParameterName )
Port Input ( in string InputParameterName, in Value aValue )
return_value = Input ( InputParameterName, aValue )
ListOfPorts Ports ( )
return_value = Ports ( )
ListOfLinks Links ( )
return_value = Links ( )
boolean IsGraph ( )
return_value = IsGraph ( )
boolean IsComputing ( )
return_value = IsComputing ( )
boolean IsFactory ( )
return_value = IsFactory ( )
boolean IsInLine ( )
return_value = IsInLine ( )
boolean IsGOTO ( )
return_value = IsGOTO ( )
boolean IsLoop ( )
return_value = IsLoop ( )
boolean IsEndLoop ( )
return_value = IsEndLoop ( )
boolean IsSwitch ( )
return_value = IsSwitch ( )
boolean IsEndSwitch ( )
return_value = IsEndSwitch ( )
long SubGraph ( )
return_value = SubGraph ( )
long Thread ( )
return_value = Thread ( )
boolean IsWaiting ( )
return_value = IsWaiting ( )
boolean IsReady ( )
return_value = IsReady ( )
boolean IsRunning ( )
return_value = IsRunning ( )
boolean IsDone ( )
return_value = IsDone ( )
boolean IsSuspended ( )
return_value = IsSuspended ( )
GraphState State ( )
return_value = State ( )
boolean ReadyW ( )
return_value = ReadyW ( )
boolean RunningW ( )
return_value = RunningW ( )
boolean DoneW ( )
return_value = DoneW ( )
boolean SuspendedW ( )
return_value = SuspendedW ( )
boolean Kill ( )
return_value = Kill ( )
boolean KillDone ( )
return_value = KillDone ( )
boolean Stop ( )
return_value = Stop ( )
boolean Suspend ( )
return_value = Suspend ( )
boolean SuspendDone ( )
return_value = SuspendDone ( )
boolean Resume ( )
return_value = Resume ( )
boolean ReRun ( )
return_value = ReRun ( )
boolean ReRunAt ( in string aNodeName )
return_value = ReRunAt ( aNodeName )
boolean ReStart ( )
return_value = ReStart ( )
boolean ReStartAt ( in string aNodeName )
return_value = ReStartAt ( aNodeName )
AutomatonState AutoState ( )
return_value = AutoState ( )
ControlState Control ( )
return_value = Control ( )
void ControlClear ( )
ControlClear ( )
boolean ContainerKill ( )
return_value = ContainerKill ( )
void Coords ( in long X, in long Y )
Coords ( X, Y )
long X ( )
return_value = X ( )
long Y ( )
return_value = Y ( )
long CpuUsed ( )
return_value = CpuUsed ( )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface FNode
IDL file
Python
string GetComponentName ( )
return_value = GetComponentName ( )
string GetInterfaceName ( )
return_value = GetInterfaceName ( )
string GetContainer ( )
return_value = GetContainer ( )
boolean SetComponentName ( in string aComponentName )
return_value = SetComponentName ( aComponentName )
boolean SetInterfaceName ( in string anInterfaceName )
return_value = SetInterfaceName ( anInterfaceName )
boolean SetContainer ( in string aContainer )
return_value = SetContainer ( aContainer )

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface INode
IDL file
Python
void SetPyFunction ( in string FuncName, in ListOfStrings aPyInitFunction )
SetPyFunction ( FuncName, aPyInitFunction )
ListOfStrings PyFunction ( )
return_value = PyFunction ( )
string PyFuncName ( )
return_value = PyFuncName ( )
Port InPort ( in string aParameterName, in string aParameterType )
return_value = InPort ( aParameterName, aParameterType )
Port OutPort ( in string aParameterName, in string aParameterType )
return_value = OutPort ( aParameterName, aParameterType )

- - - - - - - - - - - - - - - -
interface GNode
IDL file
Python
boolean SetCoupled ( in string anInLineNode )
return_value = SetCoupled ( anInLineNode )
INode Coupled ( )
return_value = Coupled ( )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface LNode
IDL file
Python
void SetPyInit ( in string MoreName, in ListOfStrings aPyMoreFunction )
SetPyInit ( MoreName, aPyMoreFunction )
ListOfStrings PyInit ( )
return_value = PyInit ( )
string PyInitName ( )
return_value = PyInitName ( )
void SetPyMore ( in string MoreName, in ListOfStrings aPyMoreFunction )
SetPyMore ( MoreName, aPyMoreFunction )
ListOfStrings PyMore ( )
return_value = PyMore ( )
string PyMoreName ( )
return_value = PyMoreName ( )
void SetPyNext ( in string NextName, in ListOfStrings aPyNextFunction )
SetPyNext ( NextName, aPyNextFunction )
ListOfStrings PyNext ( )
return_value = PyNext ( )
string PyNextName ( )
return_value = PyNextName ( )

- - - - - - - -
interface ELNode
IDL file
Python

- - - - - - - -
interface SNode
IDL file
Python

- - - - - - - -
interface ESNode
IDL file
Python

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface Graph
IDL file
Python
CNode CNode ( in Service aService )
return_value = CNode ( aService )
FNode FNode ( in string aComponentName, in string anInterfaceName, in Service aService )
return_value = FNode ( aComponentName, anInterfaceName, aService )
INode INode ( in string FuncName, in ListOfStrings aPythonFunction )
return_value = INode ( FuncName, aPythonFunction )
GNode GNode ( in string FuncName, in ListOfStrings aPythonFunction, in string anINode )
return_value = GNode ( FuncName, aPythonFunction, anINode )
LNode LNode ( in string InitName, in ListOfStrings InitFunction, in string MoreName, in ListOfStrings MoreFunction, in string NextName, in ListOfStrings NextFunction, out INode anEndOfLoop )
[ return_value, anEndOfLoop ] = LNode ( InitName, InitFunction, MoreName, MoreFunction, NextName, NextFunction )
SNode SNode ( in string FuncName, in ListOfStrings aPythonFunction, out INode anEndOfSwitch )
[ return_value, anEndOfSwitch ] = SNode ( FuncName, aPythonFunction )
Component ComponentRef ( in string aComputerContainer, in string aComponentName )
return_value = ComponentRef ( aComputerContainer, aComponentName )
Link Link ( in Port OutputPort, in Port InputPort )
return_value = Link ( OutputPort, InputPort )
boolean Import ( in string anXmlFile )
return_value = Import ( anXmlFile )
boolean Export ( in string anXmlFile )
return_value = Export ( anXmlFile )
boolean IsReadOnly ( )
return_value = IsReadOnly ( )
boolean Run ( )
return_value = Run ( )
boolean EventNoW ( out CNode aNode, out GraphEvent anEvent, out GraphState aState )
[ return_value, aNode, anEvent, aState ] = EventNoW ( )
boolean Event ( out CNode aNode, out GraphEvent anEvent, out GraphState aState )
[ return_value, aNode, anEvent, aState ] = Event ( )
boolean EventW ( out CNode aNode, out GraphEvent anEvent, out GraphState aState )
[ return_value, aNode, anEvent, aState ] = EventW ( )
long LevelMax ( )
return_value = LevelMax ( )
ListOfNodes LevelNodes ( in long aLevel )
return_value = LevelNodes ( aLevel )
long ThreadsMax ( )
return_value = ThreadsMax ( )
long GraphsNumber ( )
return_value = GraphsNumber ( )
long Threads ( )
return_value = Threads ( )
long SuspendedThreads ( )
return_value = SuspendedThreads ( )
boolean IsValid ( )
return_value = IsValid ( )
boolean IsExecutable ( )
return_value = IsExecutable ( )
boolean IsDataFlow ( )
return_value = IsDataFlow ( )
boolean IsEditing ( )
return_value = IsEditing ( )
boolean IsExecuting ( )
return_value = IsExecuting ( )
long LastLevelDone ( )
return_value = LastLevelDone ( )
boolean Start ( )
return_value = Start ( )
Graph Copy ( )
return_value = Copy ( )
boolean Merge ( in Graph aGraph )
return_value = Merge ( aGraph )
ListOfNodes Nodes ( )
return_value = Nodes ( )
ListOfLinks GLinks ( )
return_value = GLinks ( )
string getIOR ( )
return_value = getIOR ( )
ListOfGraphs Graphs ( )
return_value = Graphs ( )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface Link
IDL file
Python
Port OutPort ( )
return_value = OutPort ( )
Port InPort ( )
return_value = InPort ( )
long CoordsSize ( )
return_value = CoordsSize ( )
boolean AddCoord ( in long index, in long X, in long Y )
return_value = AddCoord ( index, X, Y )
boolean ChangeCoord ( in long index, in long X, in long Y )
return_value = ChangeCoord ( index, X, Y )
boolean RemoveCoord ( in long index )
return_value = RemoveCoord ( index )
boolean Coords ( in long index, out long X, out long Y )
[ return_value, X, Y ] = Coords ( index )

- - - - - - - - - - - - - - - - - - - - - - - -
interface Value
IDL file
Python
string ToString ( )
return_value = ToString ( )
any ToAny ( )
return_value = ToAny ( )
boolean IsIOR ( )
return_value = IsIOR ( )
string ComponentDataType ( )
return_value = ComponentDataType ( )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface Port
IDL file
Python
boolean Input ( in Value aValue )
return_value = Input ( aValue )
CNode Node ( )
return_value = Node ( )
string Name ( )
return_value = Name ( )
string Type ( )
return_value = Type ( )
Link Link ( )
return_value = Link ( )
ListOfLinks Links ( )
return_value = Links ( )
boolean IsInput ( )
return_value = IsInput ( )
boolean HasInput ( )
return_value = HasInput ( )
boolean IsLinked ( )
return_value = IsLinked ( )
KindOfPort Kind ( )
return_value = Kind ( )
boolean IsParam ( )
return_value = IsParam ( )
boolean IsGate ( )
return_value = IsGate ( )
boolean IsInLine ( )
return_value = IsInLine ( )
boolean IsLoop ( )
return_value = IsLoop ( )
boolean IsSwitch ( )
return_value = IsSwitch ( )
boolean IsEndSwitch ( )
return_value = IsEndSwitch ( )
GraphState State ( )
return_value = State ( )
boolean IsDone ( )
return_value = IsDone ( )

-
diff --git a/doc/html/INPUT/HTML/SubComponent.html b/doc/html/INPUT/HTML/SubComponent.html deleted file mode 100644 index ecbbcfc..0000000 --- a/doc/html/INPUT/HTML/SubComponent.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
interface SubComponent
IDL file
Python
void Sub ( in double x, in double y, out double z )
z = Sub ( x, y )

-
diff --git a/doc/html/INPUT/HTML/SyrComponent.html b/doc/html/INPUT/HTML/SyrComponent.html deleted file mode 100644 index c94b3c5..0000000 --- a/doc/html/INPUT/HTML/SyrComponent.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface SyrComponent
IDL file
Python
long C_ISEVEN ( in long anInteger )
return_value = C_ISEVEN ( anInteger )
long C_ISONE ( in long anOddInteger )
return_value = C_ISONE ( anOddInteger )
long C_M3 ( in long anOddInteger )
return_value = C_M3 ( anOddInteger )
long C_M3P1 ( in long anOddInteger )
return_value = C_M3P1 ( anOddInteger )
long C_DIV2 ( in long anEvenInteger )
return_value = C_DIV2 ( anEvenInteger )
long C_INCR ( in long aCount )
return_value = C_INCR ( aCount )
long C_MIN ( in long aMinVal, in long anInteger )
return_value = C_MIN ( aMinVal, anInteger )
long C_MAX ( in long aMaxVal, in long anInteger )
return_value = C_MAX ( aMaxVal, anInteger )
ListOfSyr C_LISTOFSYR ( )
return_value = C_LISTOFSYR ( )
ListOfSyr C_AVERAGE ( in ListOfSyr aListOfSyr, in long anInteger, in long aCount, out double anAverage )
[ return_value, anAverage ] = C_AVERAGE ( aListOfSyr, anInteger, aCount )
Syr Init ( in long anOddInteger )
return_value = Init ( anOddInteger )

- - - - - - - - - - - - - - - -
interface ListOfSyr
IDL file
Python
SeqOfSyr GetSeqOfSyr ( )
return_value = GetSeqOfSyr ( )
void SetSeqOfSyr ( in SeqOfSyr aSeqOfSyr )
SetSeqOfSyr ( aSeqOfSyr )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface Syr
IDL file
Python
long Initial ( )
return_value = Initial ( )
long Current ( )
return_value = Current ( )
long IsEven ( )
return_value = IsEven ( )
long IsOne ( )
return_value = IsOne ( )
long Count ( )
return_value = Count ( )
void M3p1 ( )
M3p1 ( )
void Div2 ( )
Div2 ( )
void Incr ( )
Incr ( )

-
diff --git a/doc/html/INPUT/HTML/SyrControlComponent.html b/doc/html/INPUT/HTML/SyrControlComponent.html deleted file mode 100644 index 8f39a3d..0000000 --- a/doc/html/INPUT/HTML/SyrControlComponent.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface SyrControlComponent
IDL file
Python
void L_OneEven ( in long ValOne, in long ValEven, out long Finished, out long Incr, out long Even, out long Odd )
[ Finished, Incr, Even, Odd ] = L_OneEven ( ValOne, ValEven )
void C_NotOneIsEven ( out long ValOne, out long ValEven )
[ ValOne, ValEven ] = C_NotOneIsEven ( )
void LOOPN ( in long InLoop, in long NN, in long KK, in long min, in long max, out long OutLoop, out long N, out long K )
[ OutLoop, N, K ] = LOOPN ( InLoop, NN, KK, min, max )
void WHILENOTONE ( in long N, out long OutLoop )
OutLoop = WHILENOTONE ( N )
void IFNOTEVEN ( in long N, out long Odd, out long Even )
[ Odd, Even ] = IFNOTEVEN ( N )
void LOOPi ( in long InLoop, in long ii, out long OutLoop, out long i )
[ OutLoop, i ] = LOOPi ( InLoop, ii )
void WHILEEVEN ( in long N, out long OutLoop )
OutLoop = WHILEEVEN ( N )

-
diff --git a/doc/html/INPUT/doxyfile b/doc/html/INPUT/doxyfile deleted file mode 100755 index 2a2869b..0000000 --- a/doc/html/INPUT/doxyfile +++ /dev/null @@ -1,200 +0,0 @@ -# Doxyfile 1.3-rc1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "SALOME - SUPERV - v.2.0.0" -PROJECT_NUMBER = id#1.0 -OUTPUT_DIRECTORY = ../ -OUTPUT_LANGUAGE = English -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO -ALWAYS_DETAILED_SEC = YES -INLINE_INHERITED_MEMB = YES -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = YES -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 5 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 25 -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = YES -SHOW_USED_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = log.txt -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../../../share/salome/idl/SUPERV.idl -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = sources/ -INPUT_FILTER = -FILTER_SOURCE_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = sources/myheader.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = YES -TOC_EXPAND = YES -DISABLE_INDEX = YES -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_SCHEMA = -XML_DTD = -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = NO -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = NO -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = NO -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DOT_IMAGE_FORMAT = jpg -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1200 -GENERATE_LEGEND = NO -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = search.cgi -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = /usr/local/bin/ -EXT_DOC_PATHS = diff --git a/doc/html/INPUT/sources/Application-About.png b/doc/html/INPUT/sources/Application-About.png deleted file mode 100755 index 7b58330..0000000 Binary files a/doc/html/INPUT/sources/Application-About.png and /dev/null differ diff --git a/doc/html/INPUT/sources/Application-About1.jpg b/doc/html/INPUT/sources/Application-About1.jpg deleted file mode 100755 index cf7ab8b..0000000 Binary files a/doc/html/INPUT/sources/Application-About1.jpg and /dev/null differ diff --git a/doc/html/INPUT/sources/application.gif b/doc/html/INPUT/sources/application.gif deleted file mode 100644 index 0b05d5c..0000000 Binary files a/doc/html/INPUT/sources/application.gif and /dev/null differ diff --git a/doc/html/INPUT/sources/application.jpg b/doc/html/INPUT/sources/application.jpg deleted file mode 100755 index a6979ab..0000000 Binary files a/doc/html/INPUT/sources/application.jpg and /dev/null differ diff --git a/doc/html/INPUT/sources/bg_salome.gif b/doc/html/INPUT/sources/bg_salome.gif deleted file mode 100755 index 677b704..0000000 Binary files a/doc/html/INPUT/sources/bg_salome.gif and /dev/null differ diff --git a/doc/html/INPUT/sources/logocorp.gif b/doc/html/INPUT/sources/logocorp.gif deleted file mode 100755 index 7697e08..0000000 Binary files a/doc/html/INPUT/sources/logocorp.gif and /dev/null differ diff --git a/doc/html/INPUT/sources/myheader.html b/doc/html/INPUT/sources/myheader.html deleted file mode 100755 index 83ca543..0000000 --- a/doc/html/INPUT/sources/myheader.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Main Page - - - -  -
- - - - - - -
-
-
- - - - diff --git a/doc/html/INPUT/sources/occ.gif b/doc/html/INPUT/sources/occ.gif deleted file mode 100755 index ce017c8..0000000 Binary files a/doc/html/INPUT/sources/occ.gif and /dev/null differ diff --git a/doc/html/INPUT/sources/static/doxygen.css b/doc/html/INPUT/sources/static/doxygen.css deleted file mode 100755 index 0a8e93d..0000000 --- a/doc/html/INPUT/sources/static/doxygen.css +++ /dev/null @@ -1,49 +0,0 @@ -H1 { text-align: center; } -CAPTION { font-weight: bold } -A.qindex {} -A.qindexRef {} -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code { text-decoration: none; font-weight: normal; color: #4444ee } -A.codeRef { font-weight: normal; color: #4444ee } -A:hover { text-decoration: none; background-color: lightblue } -DL.el { margin-left: -1cm } -DIV.fragment { width: 100%; border: none; background-color: #CCCCCC } -DIV.ah { background-color: #CCCCCC; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: lightblue; font-weight: bold; } -TD.mdname1 { background-color: lightblue; font-weight: bold; color: #602020; } -TD.mdname { background-color: lightblue; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } -DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } -BODY { background: url(sources/bg_salome.gif) } -TD.indexkey { - background-color: #CCCCCC; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -TD.indexvalue { - background-color: #CCCCCC; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -span.keyword { color: #008000 } -span.keywordtype { color: #604020 } -span.keywordflow { color: #e08000 } -span.comment { color: #800000 } -span.preprocessor { color: #806020 } -span.stringliteral { color: #002080 } -span.charliteral { color: #008080 } diff --git a/doc/html/INPUT/sources/static/examples_SUPERV.html b/doc/html/INPUT/sources/static/examples_SUPERV.html deleted file mode 100755 index 8642d34..0000000 --- a/doc/html/INPUT/sources/static/examples_SUPERV.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - - - Main Page - - - - -   -
- - - - - - - - -
- - -
-
- -

Examples

- -

Interfaces:

-
-SUPERV::Graph
-SUPERV::CNode
-SUPERV::FNode
-SUPERV::INode

-SUPERV::LNode
-SUPERV::Port
-SUPERV::Link
-
-
-
-

-

-
-
SUPERV::Graph
-

-
CNode CNode( in SALOME_ModuleCatalog::Service -aService )
-
-Create a Computing Node in a Graph
-
-GraphEssai = Graph( 'GraphEssai' )
-
-AddAndCompare_ServiceinParameter = []
-AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'Adder' , 'Adder' ) )
-AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'double' , 'x' ) )
-AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'double' , 'y' ) )
-AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'Adder' , 'anOtherAdder' ) )
-
-AddAndCompare_ServiceoutParameter = []
-AddAndCompare_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'double' , 'FuncValue' ) )
-AddAndCompare_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( -'double' , 'z' ) )
-AddAndCompare_Service = SALOME_ModuleCatalog.Service( 'AddAndCompare' , AddAndCompare_ServiceinParameter -, AddAndCompare_ServiceoutParameter , 0 )
-
-AddAndCompare = GraphEssai.CNode( AddAndCompare_Service )
-
-
-
-
-
FNode FNode( in string aComponentName,  -in string anInterfaceName,  in SALOME_ModuleCatalog::Service -aService )
-
-Create a Factory Node in a Graph
-
-GraphEssai = Graph( 'GraphEssai' )
-Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
-
-
-
-INode INode( in string FuncName, in ListOfStrings aPythonFunction -)
-
-Create an InLine Node in a Graph
-
-GraphEssai = Graph( 'GraphEssai' )
-PyAdd = []
-PyAdd.append( 'from time import *       ' )
-PyAdd.append( 'def Add(a,b) :           -' )
-PyAdd.append( '    print "Add will wait 5 seconds"         -' )
-PyAdd.append( '    d = dir()        -' )
-PyAdd.append( '    print "Add",d        -' )
-PyAdd.append( '    d = dir(sleep)        -' )
-PyAdd.append( '    print "Add",d        -' )
-PyAdd.append( '    sleep(5)         -' )
-PyAdd.append( '    print "Add waited"         -' )
-PyAdd.append( '    n = 0     ' )
-PyAdd.append( '    while n < 10000 :     -' )
-PyAdd.append( '        i = 0     -' )
-PyAdd.append( '        s = 0     -' )
-PyAdd.append( '        while i <= b -:     ' )
-PyAdd.append( '            -s = s + i     ' )
-PyAdd.append( '            -i = i + 1     ' )
-PyAdd.append( '        n = n + 1     -' )
-PyAdd.append( '    return s          -' )
-PyAdd.append( '' )
-Add = GraphEssai.INode( 'Add' , PyAdd )
-
-
-
-GNode GNode( in string FuncName , in ListOfStrings aPythonFunction, -in string anINode )
-
-Create a GOTO node and link to the corresponding InLine node
-
-GraphEssai = Graph( 'GraphEssai' )
-Pylabel_test = []
-Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
-Pylabel_test.append( '    print "label_begin",ValEven,ValOne,NB,KB' -)
-Pylabel_test.append( '    return ValEven,ValOne,NB,KB' )
-label_test = GraphEssai.INode( 'label_test' , Pylabel_test )
-Pycontrol = []
-Pycontrol.append( 'def control_m3p1( N , K ):' )
-Pycontrol.append( '    return 0,1,N,K' )
-control = GraphEssai.GNode( 'control_m3p1' , Pycontrol , 'label_test' )
-
-
-
-LNode LNode( in string InitName , in ListOfStrings InitFunction -, in string MoreName , in ListOfStrings MoreFunction , in string -NextName , in ListOfStrings NextFunction , out INode anEndOfLoop -)
-
-Create a "for" or "while" node and the corresponding end of loop -node
-
-GraphEssai = Graph( 'GraphEssai' )
-
-PyforN = []
-PyforN.append( 'def InitN( NN , K , SyrComponent , min , max ) :' )
-PyforN.append( '    N = max' )
-PyforN.append( '    if min > 0 :' )
-PyforN.append( '        if max >= min -:' )
-PyforN.append( '            -N = min' )
-PyforN.append( '    return N,K,SyrComponent,min,max' )
-
-PyMoreforN = []
-PyMoreforN.append( 'def MoreN( NN , KK , SyrComponent , min , max ) :' )
-PyMoreforN.append( '    N = 0' )
-PyMoreforN.append( '    OutLoop = 0' )
-PyMoreforN.append( '    if max > NN :' )
-PyMoreforN.append( '        N = NN' )
-PyMoreforN.append( '        OutLoop = -1' )
-PyMoreforN.append( '    return OutLoop,N,0,SyrComponent,min,max' -)
-
-PyNextforN = []
-PyNextforN.append( 'def NextN( NN , KK , SyrComponent , min , max ) :' )
-PyNextforN.append( '    N = NN + 1' )
-PyNextforN.append( '    K = KK' )
-PyNextforN.append( '    return N,K,SyrComponent,min,max' )
-
-forN,endforN = GraphEssai.LNode( 'InitN' , PyforN , 'MoreN' , PyMoreforN -, 'NextN' , PyNextforN )
-
-
-SNode SNode( in string FuncName, in ListOfStrings aPythonFunction, -out INode anEndOfSwitch )
-
-Create a "if / elseif / else" or "switch" node and the corresponding -end node
-
-GraphEssai = Graph( 'GraphEssai' )
-
-PyifNotEven = []
-PyifNotEven.append( 'import SyrComponent_idl' )
-PyifNotEven.append( 'def ifNotEven( SyrComponent , N , K ) :' )
-PyifNotEven.append( '    Even = SyrComponent.C_ISEVEN( N )' -)
-PyifNotEven.append( '    Odd = 1 - Even' )
-PyifNotEven.append( '    return Odd,Even,SyrComponent,N,K' -)
-
-ifNotEven,endifNotEven = GraphEssai.SNode( 'ifNotEven' , PyifNotEven )
-
-
-Link Link( in Port OutputPort ,  in Port InputPort -)
-
-Creates a link  connecting two ports of the nodes in a Graph
-
-GraphEssai = Graph( 'GraphEssai' )
-Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
-Mul = GraphEssai.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )
-Link = GraphEssai.Link(  Add.Port( 'FuncValue' ), Mul.Port( 'x' ) )
-
-
-boolean Run()
-
-Starts asynchronous execution of the graph
-
-...
-GraphEssai.Run()
-
-
-boolean Event( out CNode aNode , out GraphEvent anEvent -, out GraphState aState )
-
-Runs Graph and prints information about Graph performance
-
-...
-GraphEssai.Run()
-aStatus,aNode,anEvent,aState = GraphEssai.Event()
-while aStatus :
-    print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
-    aStatus,aNode,anEvent,aState = GraphEssai.Event()
-
-
-
-
-
SUPERV::CNode
-
-
-string Name()
-string Author()
-string Comment()
-boolean SetName(in string aNewName )
-boolean SetAuthor(in string anAuthor )
-boolean SetComment(in string aComment )
-
-
Get / Set methods for Name, Author and Comment strings of the node.
-
-
#Create CNode
-
AddAndCompare.SetName( 'AddAndCompare' )
-AddAndCompare.SetAuthor( 'NoBody' )
-AddAndCompare.SetComment( 'Python function' )
-print "Name:", AddAndCompare.Name(), "  Author:", AddAndCompare.Author(), -"   Comment:", AddAndCompare.Comment()
-
-
-
-Port Port( in string aParameterName )
-
-Returns Port instance from created node
-
-#Create FNode
-Addz = Add.Port('z')
-
-
-Port Input( in string InputParameterName ,  in Value -aValue )
-
-Sets value into Port by its name and returs correspondent port -instance
-
-#Create FNode
-Addx = Add.Input("x",3.)
-
-
-
-void Coords( in long X , in long Y )
-
long X()

-long Y()
-
-Methods to sets position of the node and getting current coordinates
-
-#Create -FNode
-Add.Coords( 1 , 152 )
-print "X=", Add.X(), "   Y=", Add.Y()
-
-
-long CpuUsed()
-
-Returns the Cpu used by a node in seconds
-
-#Run Graph and wait for its finish
-print "CPU used: ", Add.CpuUsed(), " sec"
-
-
-
-
-
-
SUPERV::FNode
-
-
-string GetContainer()
-boolean SetContainer(in string aContainer )
-

-Get / Set method for container name
-
-#Create -FNode
-Add.SetContainer( 'localhost/FactoryServer' )
-print "Container: ", Add.GetContainer()
-
-
-
-
SUPERV::INode
-
-
-
-void SetPyFunction( in string FuncName ,  in ListOfStrings -aPyInitFunction )
-
-Replaces Python function of inline node by new one
-
-#Create INode
-PyIsOdd = []
-PyIsOdd.append( 'def IsOdd(a) :   ' )
-PyIsOdd.append( '    print a,"IsOdd"  ' )
-PyIsOdd.append( '    return a ' )
-Add.SetPyFunction("IsOdd", PyIsOdd)
-
-
-string PyFuncName()
-
-
Returns Name of the Python function
-
-#Create -INode
-print "Name:",  Add.PyFuncName()
-
-
-
- ListOfStrings PyFunction()
-
-
Returns Python function as a list of strings
-
-#Create -INode
-PyFunc = Add.PyFunction()
-
-
-SUPERV::Port InPort( in string aParameterName , in string -aParameterType )
-SUPERV::Port OutPort( in string aParameterName , in string aParameterType -)
-

-Creation of In and Out ports of Inline Node
-
-#Create -INode
-Add.InPort('a', 'long')
-
Add.InPort('b', 'long')
- -
Add.OutPort('s', 'long')
-
-
-
-
-
-
SUPERV::LNode
-
-
-
-void SetPyInit( in string InitName ,  in ListOfStrings -aPyInitFunction )
-void SetPyMore( in string MoreName ,  in ListOfStrings -aPyMoreFunction )
-void SetPyNext( in string NextName ,  in ListOfStrings aPyNextFunction -)
-

-Sets (replaces) Python fonction of according clause (Init, More, -Next) in Loop Node
-
-#Create Loop Node
-Pyfori = []
-Pyfori.append( 'def Initfori( ii , K ) :' )
-Pyfori.append( '    return 1,0,K' )
-PyMorefori = []
-PyMorefori.append( 'def Morefori( ii , K ) :' )
-PyMorefori.append( '    OutLoop = 0' )
-PyMorefori.append( '    if 2 > ii :' )
-PyMorefori.append( '        OutLoop = -1' )
-PyMorefori.append( '    return OutLoop,ii,K' )
-PyNextfori = []
-PyNextfori.append( 'def Nextfori( ii , K ) :' )
-PyNextfori.append( '    ii = ii + 1' )
-PyNextfori.append( '    return ii,K' )
-forN.SetPyInit('Initfori', Pyfori)
-
forN.SetPyMore('Morefori', PyMorefori)
- -
forN.SetPyNext('Nextfori', PyNextfori)
-
-
-
-string PyInitName()
-
-string PyMoreName()
-string PyNextName()
-
-
-
Returns Python function name of according clause
-
-#Create -Loop Node
-print "Init Name:", forN.PyInitName()
-print "More Name:", forN.PyMoreName()
-print "Next Name:", forN.PyNextName()
-
-
-ListOfStrings PyInit()
-ListOfStrings PyMore()
-ListOfStrings PyNext()
-

-Returns Python function as a list of strings -from according clause
-
-#Create -Loop Node
-InitFunc = forN.PyInit()
-
MoreFunc = forN.PyMoret()
- -
NextFunc = forN.PyNext()
-
-
-
-
- -
SUPERV::Port
-
-
-boolean Input( in Value aValue )
-
-Sets value to the input port instance
-
-#CreatePorts
-aPort = Add.Port('a')
-aPort.Input(10)
-
-
-CNode Node()
-
-Returns Node - owner of the port
-
-Add = aPort.Node()
-
-
-string Name()
-
-Returns Name of the Port
-
-print "Port Name:", aPort.Name()
-
-
-
- -
-
-
- - - diff --git a/doc/html/INPUT/sources/static/nodestypes.jpg b/doc/html/INPUT/sources/static/nodestypes.jpg deleted file mode 100755 index 22f0ce4..0000000 Binary files a/doc/html/INPUT/sources/static/nodestypes.jpg and /dev/null differ diff --git a/doc/html/INPUT/sources/static/overview_Supervision.html b/doc/html/INPUT/sources/static/overview_Supervision.html deleted file mode 100755 index ef630f8..0000000 --- a/doc/html/INPUT/sources/static/overview_Supervision.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - Main Page - - - -  -
- - - - - -
-
-
-
-

General overview

-

Table of contents

- - -
-

1. Introduction

-

The Supervision module of the SALOME platform allows to define and execute - a chain of distributed numeric components, as well as to control the progress - of this chain. The various calculations to be chained and the exchanged data - are specified in a computing scheme, which can be of two types :

- -

Of simple conception, the data flow schemes can be built in a graphic way and - validated automatically by the supervision engine.

-

The script type computing schemes, which offer the possibility of building - complex chains, should be conceived by warned users (developers) who master - the syntax and the use of the scripting language.

-

Once specified and validated, certain computing schemes defined by scripts - can be made customizable (input and output data, parameter sets) and integrated - into the platform to form components. These components can be used to build - schemes of higher level.

-

Besides the definition of computing schemes, the Supervision module must also - take care of their execution and follow-up (complete execution or step by step) - :

- -

The user can visualize the progress of the scheme and the exchanged data, be - informed about the evolution of the execution of a component (errors, warning, - tracks, ...), to intervene by stopping, pausing or by resuming the execution - of the scheme or a particular component.

- Back to the contents -

2. Defintions

-

2.1 Computing scheme of type DataFlow

-

The computing schemes of type dataflow, feasible by the Supervision module, - are directed acyclic graphs, described by a set of nodes and of directed links. - A node represents a service of an instance of a computation component.

-

A node is provided with input port(s) and/or output port(s). The input port(s) - (resp. output port(s)) represent the input argument(s) (resp. output argument(s)) - of the service. Certain services can possibly require the use of parameters - which will be grouped together in configuration files (defined in the Data/Properties - module, and recorded in the study).

-

The computing schemes of type data flow do not contain either loops, conditional - branches or any operation of control. They can thus be built easily in a graphic - way, by connecting output ports to input ports of nodes. Although the graphic - construction is the simplest way, these computing schemes can also be defined - in the language of script.

-

A node represents a service (function, method) of an instance of a component. - If the component possesses a unique service (“Run” method), one will omit the - term “service of”. Various services of the same component can be used in various - nodes of the graph, or the same service can be used several times.

-

2.2 Types of nodes

-

In the SUPERVISION module there are the following types of nodes:

- - - -

The dependance between different types of nodes is shown on the following picture: -

-
-

2.2.1 Computation node

-

This node represents a computation algorithm in the graph structure. Nodes - of such type can present a service registered in the Component Catalog (Factory - Node) or an external service defined in Python script by user (InLine node). - Python function of InLine node can be edited in Supervision Graph edit mode. -

-

2.2.2 Loop node

-

Loop node is a kind of Control nodes. In fact two nodes represent Loop: -start loop and end loop nodes. Nodes of such type are always InLine nodes. -User have to supply this type of node by service, which will check conditions of end of loop.

- -

With that kind of nodes may be defined all kinds of loops:

- -“for( initial condition(s) ; end condition(s) ; end loop code )” or

- -“while( end condition )”

- -etcÂ…

-

Here you can see a simple example of Python functions set in a Loop node:

-

-def Init(Index,Min,Max,Incr) :  
-
-    if Min <= Max :  
-
-        Index = Min  
-
-    else :  
-
-        Index = Max  
-
-    return Index,Min,Max,Incr  
-
- 
-
-def More(Index,Min,Max,Incr) :  
-
-    if Index < Max :  
-
-        DoLoop = 1  
-
-    else :  
-
-        DoLoop = 0  
-
-    return DoLoop,Index,Min,Max,Incr  
-
- 
-
-def Next(Index,Min,Max,Incr) :  
-
-    Index = Index + Incr  
-
-    return Index,Min,Max,Incr
-
- -

2.2.3 Switch node

-

Switch node is a kind of Control node. In fact two nodes present Switch: start Switch and end Switch. - Nodes of such type are always InLine nodes. You have to supply this type of node by service, which will perform switching. That's why nodes of such type can have at least two or more switch ports (Boolean), but only one switch port can have "True" value at a definite moment of graph execution.

- -

With that kind of node you can define all kinds of tests or switches :

- -

“if( condition ) ; else if( condition ) … ; else” or

- -“switch( variable ) ; case value …; default”.

- -EtcÂ…

-

The associated Python function will have all input ports of the Switch node - as input arguments. And that function must return a value for all output ports. - A simple example of this Python function:

-

-  
-def Switch(x):    
-
-	i1=0    
-
-	i2=0    
-
-	i3=0    
-
-	if x>13:    
-
-		i1=1    
-
-	elif x==13:    
-
-		i2=1    
-
-	else:    
-
-		i3=1    
-
-	return i1,i2,i3 
- 
-

In this example i1, i2, i3 parameters of the function correspond to Switch - ports of the node. So, depending on the result of execution of the initial condition - (in our case it's a comparison of the input parameter with an integer 13), one - of the switch ports will get the value 1. And this port will transmit further - dataflow to the corresponding node.

-

2.2.4 GOTO node

-

GOTO node represents a simple transmitter of data from one port into another. - This InLine node can be with service or without it. In the first case the data - received by a GOTO node will be processed by this function and only after that - it will be transferred to another node. GOTO nodes may have as many Input and - Output ports as it's necessary.

- Back to the contents -

3. SUPERVISION module features and services

-

The functionality of the SUPERVISION module is provided by a set of classes which are combined into -the SUPERV package. -

The API reference of the SUPERVISION component can be found here.

-

3.1 CNode class

-

This is a base class of the SUPERVISION module. It contains a set of methods allowing:

- - -

The API reference for this class can be found here.

- -

3.2 FNode class

- -

This class is necessary for management of Factory nodes in the data flow. Besides the inherited methods it contains some methods allowing -to define the component from the container, which will be called for execution of the calculation.

-

The API reference for this class can be found here.

- -

3.3 INode class

-

This class is necessary for management of Inline nodes in the data flow. Besides the inherited methods it contains some methods allowing to set -the Python function, which will be executed for performing calculations, as well as input and output parameters for the node.

-

The API reference for this class can be found here.

- -

3.4 GNode class

-

This class is necessary for management of GOTO nodes in the data flow. Besides the inherited methods it contains some methods allowing to define -the couple node, which will be linked to this one.

-

The API reference for this class can be found here.

- -

3.5 LNode class

-

This class is necessary for management of Loop nodes (or Start Loop nodes) in the data flow. Besides the inherited methods it contains some methods allowing to define -the Python function, which will control the loop.

-

The API reference for this class can be found here.

- -

3.6 ELNode class

-

This class is necessary for management of End Loop nodes (or start Loop nodes) in the data flow.

-

The API reference for this class can be found here.

- -

3.7 SNode class

-

This class is necessary for management of Switch nodes (or Start Switch nodes) in the data flow.

-

The API reference for this class can be found here.

- -

3.8 ESNode class

-

This class is necessary for management of End Switch nodes in the data flow.

-

The API reference for this class can be found here.

- -

3.9 Graph class

-

This class is used for management of a data flow. It contains a set of methods, which allows:

- -

The API reference for this class can be found here.

-

3.10 Link class

-

This class contains a set of methods used for representation and management of the links connecting nodes in a data flow.

-

The API reference for this class can be found here.

- -

3.11 Value class

-

This class contains a set of methods used for management of the values which can be set in the ports of nodes.

-

The API reference for this class can be found here.

- -

3.12 Port class

-

This class contains a set of methods used for management of the ports of the nodes in a data flow:

- - -

The API reference for this class can be found here.

- -

3.13 SuperG class

-

The main class of the SUPERVISION ccomponent which is used for construction and initialization of a data flow.

-

The API reference for this class can be found here.

- - -Back to the contents - - diff --git a/doc/html/INPUT/sources/static/page2.html b/doc/html/INPUT/sources/static/page2.html deleted file mode 100755 index 064a2c9..0000000 --- a/doc/html/INPUT/sources/static/page2.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Main Page - - - -  -
- - - - - - -
-
-
- - - - - - - - diff --git a/doc/html/INPUT/sources/static/tree.js b/doc/html/INPUT/sources/static/tree.js deleted file mode 100755 index 25dc87a..0000000 --- a/doc/html/INPUT/sources/static/tree.js +++ /dev/null @@ -1,71 +0,0 @@ -foldersTree = gFld("SALOME v.2.0.0 ", "", "") - insDoc(foldersTree, gLnk("Main Page", "", "main.html")) - -aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) - aux2 = insFld(aux1, gFld("Modules", "")) - aux3 = insFld(aux2, gFld("SALOME SUPERVISION module", "")) - insDoc(aux3, gLnk("Overview", "", "overview_Supervision.html")) - aux4 = insFld(aux3, gFld("Packages", "")) - insDoc(aux4, gLnk("SUPERV", "", "namespaceSUPERV.html")) - insDoc(aux3, gLnk("Examples", "", "examples_SUPERV.html")) - - -/*! Data structures -*/ - insDoc(aux1, gLnk("Data Structures", "", "annotated.html")) - -/*! insDoc(aux1, gLnk("SUPERV::CNode", "", "interfaceSUPERV_1_1CNode.html")) - insDoc(aux1, gLnk("SUPERV::ELNode", "", "interfaceSUPERV_1_1ELNode.html")) - insDoc(aux1, gLnk("SUPERV::ESNode", "", "interfaceSUPERV_1_1ESNode.html")) - insDoc(aux1, gLnk("SUPERV::FNode", "", "interfaceSUPERV_1_1FNode.html")) - insDoc(aux1, gLnk("SUPERV::GNode", "", "interfaceSUPERV_1_1GNode.html")) - insDoc(aux1, gLnk("SUPERV::Graph", "", "interfaceSUPERV_1_1Graph.html")) - insDoc(aux1, gLnk("SUPERV::INode", "", "interfaceSUPERV_1_1INode.html")) - insDoc(aux1, gLnk("SUPERV::Link", "", "interfaceSUPERV_1_1Link.html")) - insDoc(aux1, gLnk("SUPERV::ListOfNodes", "", "structSUPERV_1_1ListOfNodes.html")) - insDoc(aux1, gLnk("SUPERV::LNode", "", "interfaceSUPERV_1_1LNode.html")) - insDoc(aux1, gLnk("SUPERV::Port", "", "interfaceSUPERV_1_1Port.html")) - insDoc(aux1, gLnk("SUPERV::SDate", "", "structSUPERV_1_1SDate.html")) - insDoc(aux1, gLnk("SUPERV::SNode", "", "interfaceSUPERV_1_1SNode.html")) - insDoc(aux1, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html")) -*/ - insDoc(aux1, gLnk("Class Hierarchy", "", "hierarchy.html")) - -/*! - aux3 = insFld(aux2, gFld("SUPERV::CNode", "", "interfaceSUPERV_1_1CNode.html")) - insDoc(aux3, gLnk("SUPERV::FNode", "", "interfaceSUPERV_1_1FNode.html")) - aux4 = insFld(aux3, gFld("SUPERV::INode", "", "interfaceSUPERV_1_1INode.html")) - aux5 = insFld(aux4, gFld("SUPERV::GNode", "", "interfaceSUPERV_1_1GNode.html")) - insDoc(aux5, gLnk("SUPERV::ELNode", "", "interfaceSUPERV_1_1ELNode.html")) - insDoc(aux5, gLnk("SUPERV::ESNode", "", "interfaceSUPERV_1_1ESNode.html")) - insDoc(aux5, gLnk("SUPERV::LNode", "", "interfaceSUPERV_1_1LNode.html")) - insDoc(aux5, gLnk("SUPERV::SNode", "", "interfaceSUPERV_1_1SNode.html")) - insDoc(aux4, gLnk("SUPERV::Graph", "", "interfaceSUPERV_1_1Graph.html")) - insDoc(aux2, gLnk("SUPERV::Link", "", "interfaceSUPERV_1_1Link.html")) - insDoc(aux2, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html")) - aux3 = insFld(aux2, gFld("SUPERV::Value", "", "interfaceSUPERV_1_1Value.html")) - insDoc(aux3, gLnk("SUPERV::Port", "", "interfaceSUPERV_1_1Port.html")) - insDoc(aux2, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html")) - insDoc(aux1, gLnk("SUPERV::ListOfNodes", "", "structSUPERV_1_1ListOfNodes.html")) - insDoc(aux1, gLnk("SUPERV::SDate", "", "structSUPERV_1_1SDate.html")) -*/ - insDoc(aux1, gLnk("Class methods list", "", "functions.html")) -/*! -aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html")) - insDoc(aux1, gLnk("SUPERV", "", "namespaceSUPERV.html")) -*/ - insDoc(aux1, gLnk("Namespace Members", "", "namespacemembers.html")) - - insDoc(aux1, gLnk("File List", "", "files.html")) - -/*! - - insDoc(aux1, gLnk("SUPERV.idl", "", "SUPERV_8idl.html")) -*/ - - -aux1 = insFld(foldersTree, gFld("IDL/Python mapping", "")) - insDoc(aux1, gLnk("Mapping of SUPERVISION IDL definitions to Python language", "", "page2.html")) - -/*! insDoc(foldersTree, gLnk("Graphical Class Hierarchy", "", "inherits.html")) -*/ diff --git a/doc/html/INPUT/sources/static/treeview.js b/doc/html/INPUT/sources/static/treeview.js deleted file mode 100644 index 55eb43d..0000000 --- a/doc/html/INPUT/sources/static/treeview.js +++ /dev/null @@ -1,505 +0,0 @@ -//**************************************************************** -// You are free to copy the "Folder-Tree" script as long as you -// keep this copyright notice: -// Script found in: http://www.geocities.com/Paris/LeftBank/2178/ -// Author: Marcelino Alves Martins (martins@hks.com) December '97. -//**************************************************************** - -//Log of changes: -// 17 Feb 98 - Fix initialization flashing problem with Netscape -// -// 27 Jan 98 - Root folder starts open; support for USETEXTLINKS; -// make the ftien4 a js file -// -// DvH: Dec 2000 - Made some minor changes to support external -// references - -// Definition of class Folder -// ***************************************************************** - -function Folder(folderDescription, tagName, hreference) //constructor -{ - //constant data - this.desc = folderDescription - this.tagName = tagName - this.hreference = hreference - this.id = -1 - this.navObj = 0 - this.iconImg = 0 - this.nodeImg = 0 - this.isLastNode = 0 - - //dynamic data - this.isOpen = true - this.iconSrc = "ftv2folderopen.png" - this.children = new Array - this.nChildren = 0 - - //methods - this.initialize = initializeFolder - this.setState = setStateFolder - this.addChild = addChild - this.createIndex = createEntryIndex - this.hide = hideFolder - this.display = display - this.renderOb = drawFolder - this.totalHeight = totalHeight - this.subEntries = folderSubEntries - this.outputLink = outputFolderLink -} - -function setStateFolder(isOpen) -{ - var subEntries - var totalHeight - var fIt = 0 - var i=0 - - if (isOpen == this.isOpen) - return - - if (browserVersion == 2) - { - totalHeight = 0 - for (i=0; i < this.nChildren; i++) - totalHeight = totalHeight + this.children[i].navObj.clip.height - subEntries = this.subEntries() - if (this.isOpen) - totalHeight = 0 - totalHeight - for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++) - indexOfEntries[fIt].navObj.moveBy(0, totalHeight) - } - this.isOpen = isOpen - propagateChangesInState(this) -} - -function propagateChangesInState(folder) -{ - var i=0 - - if (folder.isOpen) - { - if (folder.nodeImg) - if (folder.isLastNode) - folder.nodeImg.src = "ftv2mlastnode.png" - else - folder.nodeImg.src = "ftv2mnode.png" - folder.iconImg.src = "ftv2folderopen.png" - for (i=0; i 0) - auxEv = "" - else - auxEv = "" - - if (level>0) - if (lastNode) //the last 'brother' in the children array - { - this.renderOb(leftSide + auxEv + "") -// leftSide = leftSide + "" - this.isLastNode = 1 - } - else - { - this.renderOb(leftSide + auxEv + "") - leftSide = leftSide + "" - this.isLastNode = 0 - } - else - this.renderOb("") - - if (nc > 0) - { - level = level + 1 - for (i=0 ; i < this.nChildren; i++) - { - if (i == this.nChildren-1) - this.children[i].initialize(level, 1, leftSide) - else - this.children[i].initialize(level, 0, leftSide) - } - } -} - -function drawFolder(leftSide) -{ - if (browserVersion == 2) { - if (!doc.yPos) - doc.yPos=8 - doc.write("") - } - if (browserVersion == 3) - { - doc.write("
") - } - - doc.write("\n") - doc.write("\n\n") - doc.write("\n
") - doc.write(leftSide) - this.outputLink() - doc.write("") - doc.write("") - if (USETEXTLINKS) - { - this.outputLink() - doc.write(this.desc + "") - } - else - doc.write(this.desc) - -/*! - if (this.tagName!="") - { - doc.write(" [external]") - } -*/ - doc.write("
\n") - - if (browserVersion == 2) { - doc.write("") - } - if (browserVersion == 3) { - doc.write("
") - } - - if (browserVersion == 1) { - this.navObj = doc.all["folder"+this.id] - this.iconImg = doc.all["folderIcon"+this.id] - this.nodeImg = doc.all["nodeIcon"+this.id] - } else if (browserVersion == 2) { - this.navObj = doc.layers["folder"+this.id] - this.iconImg = this.navObj.document.images["folderIcon"+this.id] - this.nodeImg = this.navObj.document.images["nodeIcon"+this.id] - doc.yPos=doc.yPos+this.navObj.clip.height - } else if (browserVersion == 3) { - this.navObj = doc.getElementById("folder"+this.id) - this.iconImg = doc.images.namedItem("folderIcon"+this.id) - this.nodeImg = doc.images.namedItem("nodeIcon"+this.id) - } -} - -function outputFolderLink() -{ - if (this.hreference) - { - doc.write(" 0) - doc.write("onClick='javascript:clickOnFolder("+this.id+")'") - doc.write(">") - } - else - doc.write("") -} - -function addChild(childNode) -{ - this.children[this.nChildren] = childNode - this.nChildren++ - return childNode -} - -function folderSubEntries() -{ - var i = 0 - var se = this.nChildren - - for (i=0; i < this.nChildren; i++){ - if (this.children[i].children) //is a folder - se = se + this.children[i].subEntries() - } - - return se -} - - -// Definition of class Item (a document or link inside a Folder) -// ************************************************************* - -function Item(itemDescription, tagName, itemLink) // Constructor -{ - // constant data - this.desc = itemDescription - this.tagName = tagName - this.link = itemLink - this.id = -1 //initialized in initalize() - this.navObj = 0 //initialized in render() - this.iconImg = 0 //initialized in render() - this.iconSrc = "ftv2doc.png" - - // methods - this.initialize = initializeItem - this.createIndex = createEntryIndex - this.hide = hideItem - this.display = display - this.renderOb = drawItem - this.totalHeight = totalHeight -} - -function hideItem() -{ - if (browserVersion == 1 || browserVersion == 3) { - if (this.navObj.style.display == "none") - return - this.navObj.style.display = "none" - } else { - if (this.navObj.visibility == "hidden") - return - this.navObj.visibility = "hidden" - } -} - -function initializeItem(level, lastNode, leftSide) -{ - this.createIndex() - - if (level>0) - if (lastNode) //the last 'brother' in the children array - { - this.renderOb(leftSide + "") - leftSide = leftSide + "" - } - else - { - this.renderOb(leftSide + "") - leftSide = leftSide + "" - } - else - this.renderOb("") -} - -function drawItem(leftSide) -{ - if (browserVersion == 2) - doc.write("") - if (browserVersion == 3) - doc.write("
") - - doc.write("\n\n") - doc.write("\n
") - doc.write(leftSide) - if (this.link!="") - { - doc.write("") - } - doc.write("") - if (this.link!="") - { - doc.write("") - } - doc.write("") - if (USETEXTLINKS && this.link!="") - doc.write("" + this.desc + "") - else - doc.write(this.desc) -/*! - if (this.tagName!="") - { - doc.write(" [external]"); - } -*/ - doc.write("\n
\n") - - if (browserVersion == 2) - doc.write("") - if (browserVersion == 3) - doc.write("
") - - if (browserVersion == 1) { - this.navObj = doc.all["item"+this.id] - this.iconImg = doc.all["itemIcon"+this.id] - } else if (browserVersion == 2) { - this.navObj = doc.layers["item"+this.id] - this.iconImg = this.navObj.document.images["itemIcon"+this.id] - doc.yPos=doc.yPos+this.navObj.clip.height - } else if (browserVersion == 3) { - this.navObj = doc.getElementById("item"+this.id) - this.iconImg = doc.images.namedItem("itemIcon"+this.id) - } -} - - -// Methods common to both objects (pseudo-inheritance) -// ******************************************************** - -function display() -{ - if (browserVersion == 1 || browserVersion == 3) - this.navObj.style.display = "block" - else - this.navObj.visibility = "show" -} - -function createEntryIndex() -{ - this.id = nEntries - indexOfEntries[nEntries] = this - nEntries++ -} - -// total height of subEntries open -function totalHeight() //used with browserVersion == 2 -{ - var h = this.navObj.clip.height - var i = 0 - - if (this.isOpen) //is a folder and _is_ open - for (i=0 ; i < this.nChildren; i++) - h = h + this.children[i].totalHeight() - - return h -} - - -// Events -// ********************************************************* - -function clickOnFolder(folderId) -{ - var clicked = indexOfEntries[folderId] - - if (!clicked.isOpen) - clickOnNode(folderId) - - return - - if (clicked.isSelected) - return -} - -function clickOnNode(folderId) -{ - var clickedFolder = 0 - var state = 0 - - clickedFolder = indexOfEntries[folderId] - state = clickedFolder.isOpen - - clickedFolder.setState(!state) //open<->close -} - -function initializeDocument() -{ - doc = document; - if (doc.all) - browserVersion = 1 //IE4 - else - if (doc.layers) - browserVersion = 2 //NS4 - else if(navigator.userAgent.toLowerCase().indexOf('gecko') != -1) - browserVersion = 3 //mozilla - else - browserVersion = 0 //other - - foldersTree.initialize(0, 1, "") - foldersTree.display() - - if (browserVersion > 0) - { - if(browserVersion != 3) - doc.write(" ") - - // close the whole tree - clickOnNode(0) - // open the root folder - clickOnNode(0) - } -} - -// Auxiliary Functions for Folder-Treee backward compatibility -// ********************************************************* - -function gFld(description, tagName, hreference) -{ - folder = new Folder(description, tagName, hreference) - return folder -} - -function gLnk(description, tagName, linkData) -{ - fullLink = "" - - if (linkData!="") - { - fullLink = "'"+linkData+"' target=\"basefrm\"" - } - - linkItem = new Item(description, tagName, fullLink) - return linkItem -} - -function insFld(parentFolder, childFolder) -{ - return parentFolder.addChild(childFolder) -} - -function insDoc(parentFolder, document) -{ - parentFolder.addChild(document) -} - -// Global variables -// **************** - -USETEXTLINKS = 1 -indexOfEntries = new Array -nEntries = 0 -doc = document -browserVersion = 0 -selectedFolder=0 diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in deleted file mode 100644 index 9c52485..0000000 --- a/doc/html/Makefile.in +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : Makefile.in -# Author : Vasily Rusyaev (Open Cascade NN) -# Module : doc -# $Header: - -top_srcdir=@top_srcdir@ -root_srcdir=@ROOT_SRCDIR@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@ -doxygen=@DOXYGEN@ - -@COMMENCE@ - -doc: - cp -fr $(srcdir)/INPUT ./; \ - cd INPUT; \ - sed 's|../../../share/salome|$(root_srcdir)|' doxyfile > doxyfile1; \ - mv -f doxyfile1 doxyfile; \ - $(doxygen) ./doxyfile; \ - cd ..; \ - cp -fr $(srcdir)/INPUT/sources/static/*.* ./html/ - cp -fr $(srcdir)/INPUT/sources/ html/ - cp -fr $(srcdir)/INPUT/HTML/ html/ - -clean: - rm -rf html - -distclean: clean - rm -rf INPUT - -install: - $(INSTALL) -d $(docdir); \ - cp -rf html $(docdir) - -uninstall: - rm -rf $(docdir)/html diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx deleted file mode 100644 index 491e79b..0000000 --- a/src/AddComponent/AddComponent_Impl.cxx +++ /dev/null @@ -1,227 +0,0 @@ -// SuperVisionTest AddComponent : example of component that adds two numbers -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : AddComponent_Impl.cxx -// Author : Jean Rahuel, CEA -// Module : SuperVisionTest - -using namespace std; -#include -#include -#include -#include -#include - -//#include "utilities.h" - -#include "AddComponent_Impl.hxx" -#include "Adder_Impl.hxx" - -AddComponent_Impl::AddComponent_Impl( CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { - MESSAGE("AddComponent_Impl::AddComponent_Impl this " << hex << this << dec - << "activate object instanceName(" - << instanceName << ") interfaceName(" << interfaceName << ")" ) - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - LastAddition = 0 ; -} - -AddComponent_Impl::AddComponent_Impl() { - LastAddition = 0 ; -} - -AddComponent_Impl::~AddComponent_Impl() { -} - -SuperVisionTest::Adder_ptr AddComponent_Impl::Addition() { - beginService( "AddComponent_Impl::Addition" ); - sendMessage(NOTIF_STEP, "AddComponent_Impl creates Adder_Impl"); - Adder_Impl * myAdder ; - myAdder = new Adder_Impl( _orb , _poa, _contId, - instanceName() , interfaceName() , - graphName() , nodeName() ) ; - SuperVisionTest::Adder_var iobject ; - PortableServer::ObjectId * id = myAdder->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - iobject = SuperVisionTest::Adder::_narrow(obj) ; - endService( "AddComponent_Impl::Addition" ); - return SuperVisionTest::Adder::_duplicate(iobject) ; -} - -double AddComponent_Impl::Add( double x , double y , double & z ) { - beginService( " AddComponent_Impl::Add" ); - z = x + y ; - int S; - - sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing"); - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z - << " ) returns " << (x - y) << " after " << S << " seconds" ) - LastAddition = z ; - endService( " AddComponent_Impl::Add" ); - return (x - y) ; -} - -long AddComponent_Impl::Sigma( long n ) { - long sigma = 0 ; - int i , j ; - beginService( " AddComponent_Impl::Sigma" ); - for ( j = 0 ; j < 1000000 ; j++ ) { - sigma = 0 ; - for ( i = 1 ; i <= n ; i++ ) { - sigma = sigma + i ; - } - } - endService( " AddComponent_Impl::Sigma" ); - return sigma ; -} - -double AddComponent_Impl::LastResult() { - beginService( " AddComponent_Impl::LastResult" ); - sendMessage(NOTIF_STEP, "AddComponent_Impl::LastResult is Computing"); - int S; - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " AddComponent_Impl::LastResult" ); - return LastAddition ; -} - -extern "C" -{ - PortableServer::ObjectId * AddComponentEngine_factory - (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) - { - MESSAGE("AddComponentEngine_factory AddComponentEngine (" - << instanceName << "," << interfaceName << "," << getpid() << ")"); - AddComponent_Impl * myAddComponent - = new AddComponent_Impl(orb, poa, contId, instanceName, interfaceName); - return myAddComponent->getId() ; - } -} - -Adder_Impl::Adder_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char * instanceName , - const char * interfaceName , - const char * graphName , - const char * nodeName ) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { - Names( graphName , nodeName ) ; - MESSAGE("Adder_Impl::Adder_Impl activate object instanceName(" - << instanceName << ") interfaceName(" << interfaceName << ") --> " - << hex << (void *) this << dec ) - beginService( "Adder_Impl::Adder_Impl" ); - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - LastAddition = 0 ; - sendMessage(NOTIF_STEP, "Adder_Impl is Created"); - endService( "Adder_Impl::Adder_Impl" ); -} - -Adder_Impl::Adder_Impl() { - LastAddition = 0 ; -} - -Adder_Impl::~Adder_Impl() { - beginService( "Adder_Impl::~Adder_Impl" ); - endService( "Adder_Impl::~Adder_Impl" ); -} - -double Adder_Impl::Add( double x , double y , double & z ) { - beginService( " Adder_Impl::Add" ); - z = x + y ; - int S; - - sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z - << " ) returns " << -(x - y) << " after " << S << " seconds" ) - LastAddition = z ; - endService( " Adder_Impl::Add" ); - return -(x - y) ; -} - -double Adder_Impl::AddAndCompare( const double x , const double y , - const SuperVisionTest::Adder_ptr anOtherAdder , - double & z ) { - beginService( " Adder_Impl::AddAndCompare" ); - z = x + y ; - int S; - - sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z - << " ) returns " << -(x - y) << " after " << S << " seconds" ) - LastAddition = z ; - double ValFunc ; - sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare will call anOtherAdder->LastValue()"); - double RetVal ; - anOtherAdder->LastResult( RetVal ) ; - if ( RetVal > 0 ) { - ValFunc = (x - y) ; - } - else { - ValFunc = -(x - y) ; - } - sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare has called anOtherAdder->LastValue()"); - sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Finished"); - endService( " Adder_Impl::AddAndCompare" ); - return ValFunc ; -} - -void Adder_Impl::SetLastResult( double z ) { - beginService( " Adder_Impl::SetLastResult" ); - sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing"); - int S; - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - LastAddition = z ; - endService( " Adder_Impl::SetLastResult" ); - return ; -} - -void Adder_Impl::LastResult( double & z ) { - beginService( " Adder_Impl::LastResult" ); - sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing"); - int S; - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - z = LastAddition ; - endService( " Adder_Impl::LastResult" ); - return ; -} - - diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.hxx b/src/GraphEditor/DataFlowEditor_DataFlow.hxx index c405e0b..5a96b2a 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.hxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.hxx @@ -72,7 +72,8 @@ namespace GraphEditor { char * NodeInfo( const char * aNodeName ) ; bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ; - bool LoadXml( const char * myFileName ) ; +// bool LoadXml( const char * myFileName ) ; + bool LoadXml( const char * myFileName , GraphBase::ListOfSGraphs & aListOfDataFlows ) ; bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ; bool SaveXml(const char * myFileName ) ; @@ -81,12 +82,12 @@ namespace GraphEditor { // void DateModification() ; - GraphBase::SGraph * GetDataFlow() ; + GraphBase::ListOfSGraphs * GetDataFlows() ; GraphBase::SNode * GetInfo() const ; - GraphBase::ListOfNodes * GetNodes() const ; - GraphBase::ListOfLinks * GetLinks() const ; - GraphBase::ListOfGraphs * GetGraphs() const ; - GraphBase::ListOfLinks * GetDatas() const ; + GraphBase::ListOfSNodes * GetNodes() const ; + GraphBase::ListOfSLinks * GetLinks() const ; + GraphBase::ListOfSGraphs * GetGraphs() const ; + GraphBase::ListOfSLinks * GetDatas() const ; const SALOME_ModuleCatalog::Service * GetService() ; GraphEditor::InNode * AddService ( @@ -132,18 +133,17 @@ namespace GraphEditor { bool HasInput(const char * ToServiceParameterName ) ; - bool AddLinkValue( const char * FromNodeName , - const char * FromServiceParameterName , - const char * ToNodeName , - const char * ToServiceParameterName , - const CORBA::Any aValue ) { - return AddLink( FromNodeName, FromServiceParameterName , ToNodeName , - ToServiceParameterName , aValue ) ; } ; +// bool AddLinkValue( const char * FromNodeName , +// const char * FromServiceParameterName , +// const char * ToNodeName , +// const char * ToServiceParameterName , +// const CORBA::Any aValue ) { +// return AddLinkValue( FromNodeName, FromServiceParameterName , ToNodeName , +// ToServiceParameterName , aValue ) ; } ; bool AddLink( const char * FromNodeName , const char * FromServiceParameterName , const char * ToNodeName , - const char * ToServiceParameterName , - const CORBA::Any aValue = CORBA::Any() ) ; + const char * ToServiceParameterName ) ; bool RemoveLink( const char * FromNodeName , const char * FromServiceParameterName , @@ -201,10 +201,6 @@ namespace GraphEditor { bool AddInputData( const char * ToNodeName , const char * ToParameterName , const CORBA::Any aValue = CORBA::Any() ) ; - bool AddInputSharedData( const char * ToNodeName1 , - const char * ToParameterName1 , - const char * ToNodeName2 , - const char * ToParameterName2 ) ; const CORBA::Any * GetInData( const char * ToNodeName , const char * ToParameterName ) ; @@ -214,7 +210,9 @@ namespace GraphEditor { bool IsValid() ; bool IsExecutable() ; + void Executing() ; bool IsExecuting() ; + void Editing() ; bool IsEditing() ; void EditedAfterExecution(bool EditedAfterExecution ) ; bool EditedAfterExecution() ; diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.lxx b/src/GraphEditor/DataFlowEditor_DataFlow.lxx index 699c7a1..1f82bf0 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.lxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.lxx @@ -57,18 +57,19 @@ inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) { return CORBA::string_dup( s.str().c_str() ); } -inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) { +inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) { if ( _ReadOnly ) return false ; _EditedAfterExecution = true ; return GraphEditor::OutNode::LoadDataFlow( aDataFlow ) ; } ; -inline bool GraphEditor::DataFlow::LoadXml( const char* myFileName ) { +inline bool GraphEditor::DataFlow::LoadXml( const char* myFileName , + GraphBase::ListOfSGraphs & aListOfDataFlows ) { if ( _ReadOnly ) return false ; _EditedAfterExecution = true ; - return GraphEditor::OutNode::LoadXml( myFileName ) ; + return GraphEditor::OutNode::LoadXml( myFileName , aListOfDataFlows ) ; } ; inline bool GraphEditor::DataFlow::LoadInfo( const GraphBase::SNode &aDataFlowInfo ) { @@ -87,8 +88,9 @@ inline bool GraphEditor::DataFlow::SavePy(const char* myFileName ) { } ; // get all DataFlow informations (for a .XML file) : -inline GraphBase::SGraph * GraphEditor::DataFlow::GetDataFlow() { - return GraphEditor::OutNode::GetDataFlow() ; +inline GraphBase::ListOfSGraphs * GraphEditor::DataFlow::GetDataFlows() { + GraphBase::ListOfSGraphs * aListOfDataFlows = new GraphBase::ListOfSGraphs; + return GraphEditor::OutNode::GetDataFlows( aListOfDataFlows ) ; } ; // void DateModification() ; @@ -97,19 +99,19 @@ inline GraphBase::SGraph * GraphEditor::DataFlow::GetDataFlow() { // return GraphEditor::OutNode::GetInfo() ; //} ; -inline GraphBase::ListOfNodes * GraphEditor::DataFlow::GetNodes() const { +inline GraphBase::ListOfSNodes * GraphEditor::DataFlow::GetNodes() const { return Graph()->GetNodes() ; } ; -inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetLinks() const { +inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetLinks() const { return Graph()->GetLinks() ; } ; -inline GraphBase::ListOfGraphs * GraphEditor::DataFlow::GetGraphs() const { +inline GraphBase::ListOfSGraphs * GraphEditor::DataFlow::GetGraphs() const { return Graph()->GetGraphs() ; } ; -inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetDatas() const { +inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetDatas() const { return Graph()->GetDatas() ; } ; @@ -161,7 +163,14 @@ inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode( NodeComment , NodeX , NodeY ) ; // MESSAGE( "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" ) ; // cout << "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ; - cdebug_out << "GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ; + cdebug_out << "GraphEditor::DataFlow::AddNode( " ; + if ( aNode ) { + cdebug << aNode->Name() << " )" ; + } + else { + cdebug << "NULL ) Node not created" ; + } + cdebug << endl ; return aNode ; } ; @@ -240,21 +249,21 @@ inline bool GraphEditor::DataFlow::HasInput(const char * ToServiceParameterName inline bool GraphEditor::DataFlow::AddLink( const char* FromNodeName , const char* FromServiceParameterName , const char* ToNodeName , - const char* ToServiceParameterName , - const CORBA::Any aValue ) { + const char* ToServiceParameterName ) { +// , const CORBA::Any aValue ) { if ( !_ReadOnly ) { GraphEditor::InNode * aFromNode = GetNode( FromNodeName ) ; if ( aFromNode ) { - GraphBase::OutPort * anOutPort = aFromNode->GetChangeOutPort( FromServiceParameterName ) ; - if ( anOutPort ) { - CORBA::Any const * theValue = anOutPort->Value() ; // Keep the type ! +// GraphBase::OutPort * anOutPort = aFromNode->GetChangeOutPort( FromServiceParameterName ) ; +// if ( anOutPort ) { +// CORBA::Any const * theValue = anOutPort->Value() ; // Keep the type ! _EditedAfterExecution = true ; return GraphEditor::OutNode::AddLink( FromNodeName , FromServiceParameterName , ToNodeName , - ToServiceParameterName , - *theValue ) ; - } + ToServiceParameterName ) ; +// , *theValue ) ; +// } } } return false ; @@ -392,43 +401,12 @@ inline bool GraphEditor::DataFlow::RemoveLink( inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName , const char* ToParameterName , const CORBA::Any aValue ) { -#if 0 - GraphBase::Node *toNode ; - GraphBase::InPort *toPort ; - char *aNode ; - char *aPort ; - NodePort( ToNodeName , ToParameterName , &aNode , &aPort ) ; - toNode = GetChangeGraphNode( aNode ) ; - if ( toNode ) { - toPort = toNode->GetChangeInPort( aPort ) ; - if ( toPort && ( toPort->IsConnected() || - toPort->IsDataConnected() ) ) { - RemoveLink( toNode->Name() , toPort->PortName() ) ; - } - } - else { - toPort = NULL ; - } - delete aNode ; - delete aPort ; -#endif if ( !IsValid() ) { return false ; } return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; } ; -inline bool GraphEditor::DataFlow::AddInputSharedData(const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) { - if ( !IsValid() ) { - return false ; - } - return GraphEditor::OutNode::AddInputData( ToNodeName1 , ToParameterName1 , - ToNodeName2 , ToParameterName2 ) ; -} ; - inline const CORBA::Any *GraphEditor::DataFlow::GetInData( const char * ToNodeName , const char * ToParameterName ) { @@ -450,7 +428,14 @@ inline bool GraphEditor::DataFlow::IsExecutable() { return GraphEditor::OutNode::IsExecutable() ; } +inline void GraphEditor::DataFlow::Executing() { + cdebug << "Executing _Executing = true " << endl ; + _Executing = true ; +} + inline bool GraphEditor::DataFlow::IsExecuting() { +#if 0 + //cout << " +++++> Old!" << endl; if ( _DataFlowExecutor ) { if ( _DataFlowExecutor->IsDone() ) { _Executing = false ; @@ -462,9 +447,26 @@ inline bool GraphEditor::DataFlow::IsExecuting() { else { _Executing = false ; } +#endif +// cdebug << "GraphEditor::DataFlow::IsExecuting _Executing " << _Executing << " DataFlowExecutor " << _DataFlowExecutor ; + if ( _DataFlowExecutor ) { + cdebug << " IsDone " << _DataFlowExecutor->IsDone() << " State " << _DataFlowExecutor->State() ; + } + cdebug << endl ; +// cout << "+++++++++++++> _Executing = " << _Executing << " _DataFlowExecutor = " << _DataFlowExecutor << endl; + if ( _Executing && _DataFlowExecutor ) { + if ( _DataFlowExecutor->IsDone() ) { + _Executing = false ; + } + } return _Executing ; } +inline void GraphEditor::DataFlow::Editing() { + cdebug << "Editing _Executing = false " << endl ; + _Executing = false ; +} + inline bool GraphEditor::DataFlow::IsEditing() { return !IsExecuting() ; } @@ -518,7 +520,7 @@ inline long GraphEditor::DataFlow::SubStreamGraphsNumber() { inline void GraphEditor::DataFlow::Executor( GraphExecutor::DataFlow * DataFlowExecutor ) { - _Executing = true ; +// _Executing = true ; _DataFlowExecutor = DataFlowExecutor ; } diff --git a/src/GraphEditor/DataFlowEditor_InNode.cxx b/src/GraphEditor/DataFlowEditor_InNode.cxx index 4dee936..ff472c4 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.cxx +++ b/src/GraphEditor/DataFlowEditor_InNode.cxx @@ -34,6 +34,13 @@ using namespace std; GraphEditor::InNode::InNode() { } +#if 0 +GraphEditor::InNode::InNode(GraphBase::GOTONode * aGOTONode ) { + _ComputingNode = aGOTONode ; + _GOTONode = aGOTONode ; +} +#endif + //ostream * fdebug = NULL ; GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService , @@ -51,8 +58,8 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, const char * NodeComputer , const char * NodeComment , const bool GeneratedName , - const int X , - const int Y , + const int NodeX , + const int NodeY , int * Graph_prof_debug, ofstream * Graph_fdebug) { SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; @@ -80,7 +87,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; break ; } @@ -94,7 +101,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComputer , NodeComment , - GeneratedName , X , Y , + GeneratedName , NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; // cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ; _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ; @@ -108,11 +115,28 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ; break ; } + case SUPERV::MacroNode : { + cdebug << "GraphEditor::InNode::InNode SUPERV::MacroNode : " << NodeName << endl ; + _GraphMacroNode = new GraphBase::Graph( ORB , ptrNamingService , +// aFuncName[0].c_str() , *aPythonFunction[0] , + NodeName , + akind , +// NodeFirstCreation , NodeLastModification , +// NodeEditorRelease , NodeAuthor , +// NodeComment , GeneratedName , +// NodeX , NodeY , + Graph_prof_debug , Graph_fdebug ) ; + _ComputingNode = (GraphBase::ComputingNode *) _GraphMacroNode ; + _InLineNode = (GraphBase::InLineNode *) _ComputingNode ; + _GOTONode = (GraphBase::GOTONode *) _InLineNode ; + _GraphMacroNode->Coordinates( NodeX , NodeY ) ; + break ; + } case SUPERV::GOTONode : { cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName << endl ; _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService , @@ -121,7 +145,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ; _InLineNode = (GraphBase::InLineNode *) _ComputingNode ; @@ -137,7 +161,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ; _GOTONode = (GraphBase::GOTONode *) _ComputingNode ; @@ -153,7 +177,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ; _GOTONode = (GraphBase::GOTONode *) _ComputingNode ; @@ -168,7 +192,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ; _GOTONode = (GraphBase::GOTONode *) _ComputingNode ; @@ -184,7 +208,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComment , GeneratedName , - X , Y , + NodeX , NodeY , Graph_prof_debug , Graph_fdebug ) ; _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ; _GOTONode = (GraphBase::GOTONode *) _ComputingNode ; diff --git a/src/GraphEditor/DataFlowEditor_InNode.hxx b/src/GraphEditor/DataFlowEditor_InNode.hxx index 9352544..c8d282f 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.hxx +++ b/src/GraphEditor/DataFlowEditor_InNode.hxx @@ -27,6 +27,7 @@ #ifndef _DATAFLOWEDITOR_INNODE_HXX #define _DATAFLOWEDITOR_INNODE_HXX +#include "DataFlowBase_Graph.hxx" #include "DataFlowBase_FactoryNode.hxx" #include "DataFlowBase_GOTONode.hxx" #include "DataFlowBase_LoopNode.hxx" @@ -48,10 +49,12 @@ namespace GraphEditor { GraphBase::EndOfLoopNode * _EndOfLoopNode ; GraphBase::SwitchNode * _SwitchNode ; GraphBase::EndOfSwitchNode * _EndOfSwitchNode ; + GraphBase::Graph * _GraphMacroNode ; public: InNode() ; +// InNode(GraphBase::GOTONode * aGOTONode ) ; InNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , GraphBase::ListOfFuncName aFuncName , @@ -90,6 +93,8 @@ namespace GraphEditor { return _ComputingNode->IsOneOfInLineNodes() ; } ; const bool IsOneOfGOTONodes() const { return _ComputingNode->IsOneOfGOTONodes() ; } ; + const bool IsMacroNode() const { + return _ComputingNode->IsMacroNode() ; } ; const bool IsDataFlowNode() const { return _ComputingNode->IsDataFlowNode() ; } ; const bool IsDataStreamNode() const { @@ -156,11 +161,17 @@ namespace GraphEditor { return _SwitchNode ; } ; GraphBase::EndOfSwitchNode * EndOfSwitchNode() { return _EndOfSwitchNode ; } ; + GraphBase::Graph * GraphMacroNode() { + return _GraphMacroNode ; } ; SUPERV::CNode_var ObjRef() const { return _ComputingNode->ObjRef() ; } ; void SetObjRef(SUPERV::CNode_var aNode) { _ComputingNode->SetObjRef( aNode ) ; } ; + Graph_Impl * ObjImpl() const { return _GraphMacroNode->ObjImpl() ; } ; + void SetObjImpl( Graph_Impl * aGraph ) { + _GraphMacroNode->SetObjImpl( aGraph ) ; } ; + const SALOME_ModuleCatalog::Service * GetService() const { return _ComputingNode->GetService() ; } ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index 202b157..71d4984 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -27,16 +27,21 @@ using namespace std; #include #include +#include "DataFlowEditor_DataFlow.hxx" #include "DataFlowEditor_OutNode.hxx" #include "DataFlowBase_EndOfLoopNode.hxx" #include "DataFlowBase_EndOfSwitchNode.hxx" +#include "DataFlowExecutor_DataFlow.hxx" +extern GraphExecutor::FiniteStateMachine * theAutomaton ; + // Implementation de la classe GraphEditor::Graph GraphEditor::OutNode::OutNode() { // Graph() { cdebug_in << "GraphEditor::OutNode::OutNode()" << endl; + _Graph = NULL ; _Imported = false ; _Valid = false ; _Executable = false ; @@ -50,6 +55,7 @@ GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB , const char * DebugFileName , const SUPERV::KindOfNode aKindOfNode ) { // Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) { + _Graph = NULL ; Set_prof_debug( ORB , DebugFileName ) ; cdebug_in << "GraphEditor::OutNode::OutNode(" ; if ( DataFlowName ) { @@ -60,15 +66,18 @@ GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB , if ( aKindOfNode == SUPERV::DataFlowGraph ) { _StreamGraph = NULL ; // _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ; - _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , aKindOfNode , _prof_debug , _fdebug ) ; } else if ( aKindOfNode == SUPERV::DataStreamGraph ) { // _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;; - _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , aKindOfNode , _prof_debug , _fdebug ) ; _Graph = _StreamGraph ; } +// if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::DataStreamGraph ) { +// theAutomaton->MapGraph( _Graph , _Graph->Name() ) ; +// } _Orb = CORBA::ORB::_duplicate( ORB ) ; _Imported = false ; _Valid = false ; @@ -97,6 +106,7 @@ GraphEditor::OutNode::OutNode( // DataFlowFirstCreation , DataFlowLastModification , // DataFlowEditorRelease , DataFlowAuthor , // DataFlowComputer , DataFlowComment , DebugFileName ) { + _Graph = NULL ; Set_prof_debug( ORB , DebugFileName ) ; if ( DataFlowkind == SUPERV::DataFlowGraph ) { @@ -119,6 +129,9 @@ GraphEditor::OutNode::OutNode( // DataFlowComputer , DataFlowComment , DebugFileName ) ; _Graph = _StreamGraph ; } +// if ( DataFlowkind == SUPERV::DataFlowGraph || DataFlowkind == SUPERV::DataStreamGraph ) { +// theAutomaton->MapGraph( _Graph , _Graph->Name() ) ; +// } _Orb = CORBA::ORB::_duplicate( ORB ) ; _Imported = false ; _Valid = false ; @@ -127,11 +140,25 @@ GraphEditor::OutNode::OutNode( } ; GraphEditor::OutNode::~OutNode() { +// theAutomaton->EraseGraph( Graph->Name() ) ; // delete _DataFlowNode ; // delete _DataFlowDatas ; // delete _GT ; } +bool GraphEditor::OutNode::Name( const char * aName ) { + bool RetVal = false ; + if ( !theAutomaton->GraphName( aName ) ) { + char * aGraphName = Graph()->Name() ; + RetVal = Graph()->Name( aName ) ; + if ( RetVal ) { + theAutomaton->EraseGraph( aGraphName ) ; + theAutomaton->MapGraph( Graph() , aName ) ; + } + } + return RetVal ; +} + void GraphEditor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB , const char * DebugFileName ) { _Graph_prof_debug = 0 ; @@ -143,15 +170,15 @@ void GraphEditor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB , } } -bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) { +bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) { bool RetVal = false ; - cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str() + cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << (*aDataFlow).Info.theName.c_str() << " GraphNodesSize " << Graph()->GraphNodesSize() << endl; if ( !_Imported ) { - RetVal = LoadInfo( aDataFlow->Info ) ; + RetVal = LoadInfo( (*aDataFlow).Info ) ; _Imported = true ; } - else if ( Graph()->IsDataStreamNode() || aDataFlow->Info.theKind == SUPERV::DataFlowGraph ) { + else if ( Graph()->IsDataStreamNode() || (*aDataFlow).Info.theKind == SUPERV::DataFlowGraph ) { RetVal = true ; } cdebug << "GraphEditor::OutNode::LoadDataFlow() _Imported " << _Imported << " RetVal " << RetVal << endl; @@ -159,49 +186,74 @@ bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) { map< string , int > aMapOfNodes ; if ( RetVal ) { cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadNodes GraphNodesSize " << Graph()->GraphNodesSize() << endl; - RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ; + RetVal = LoadNodes( aMapOfNodes , (*aDataFlow).Nodes ) ; } if ( RetVal ) { cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadLinks GraphNodesSize " << Graph()->GraphNodesSize() << endl; - RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ; + RetVal = LoadLinks( aMapOfNodes , (*aDataFlow).Links ) ; } if ( RetVal ) { Valid() ; cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadDatas GraphNodesSize " << Graph()->GraphNodesSize() << endl; - RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ; + RetVal = LoadDatas( aMapOfNodes , (*aDataFlow).Datas ) ; } cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() << endl; return RetVal ; } +bool GraphEditor::OutNode::LoadXml( const char* myFileName , GraphBase::ListOfSGraphs & aListOfDataFlows ) { + bool RetVal = false ; +// GraphBase::ListOfSGraphs aListOfDataFlows ; + if ( myFileName == NULL ) { + cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl; + _Imported = true ; + char * aDataFlowName = Graph()->Name() ; + Name( theAutomaton->GraphInstanceName( Graph()->Name() ).c_str() ) ; + theAutomaton->MapGraph( Graph() , Graph()->Name() ) ; + cdebug << "GraphEditor::OutNode::LoadXml() " << aDataFlowName << " --> " << Graph()->Name() << endl; + RetVal = true ; + } + else { + cdebug_in << "GraphEditor::OutNode::LoadXml() " << myFileName << endl; + RetVal = Graph()->LoadXml( _Orb , myFileName , aListOfDataFlows ) ; +// RetVal = LoadDataFlows( &aListOfDataFlows ) ; + cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << " " << aListOfDataFlows.size() + << " Graphs" << endl; + } + return RetVal ; +} + +#if 0 bool GraphEditor::OutNode::LoadXml( const char* myFileName ) { bool RetVal = false ; - GraphBase::SGraph aDataFlow ; + GraphBase::ListOfSGraphs aListOfDataFlows ; if ( myFileName == NULL ) { cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl; _Imported = true ; RetVal = true ; } - else if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) { + else if ( Graph()->LoadXml( _Orb , myFileName , aListOfDataFlows ) ) { cdebug_in << "GraphEditor::OutNode::LoadXml() " << myFileName << endl; - RetVal = LoadDataFlow( &aDataFlow ) ; + RetVal = LoadDataFlows( &aListOfDataFlows ) ; cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl; } return RetVal ; -} +} +#endif bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { bool RetVal = false ; cdebug_in << "GraphEditor::OutNode::LoadInfo " << aDataFlowInfo.theName.c_str() << endl ; -// MESSAGE( "GraphEditor::OutNode::LoadDataFlow" ); +// MESSAGE( "GraphEditor::OutNode::LoadInfo" ); // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ; // InterfaceName( aDataFlowInfo.theInterfaceName.c_str() ) ; if ( Graph()->IsDataStreamNode() || aDataFlowInfo.theKind == SUPERV::DataFlowGraph ) { - Graph()->Name( aDataFlowInfo.theName.c_str() ) ; -// Graph()->Kind( aDataFlowInfo.theKind ) ; - cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind - << " Kind() " << Graph()->Kind() << endl ; + char * aDataFlowName = Graph()->Name() ; + Graph()->Name( theAutomaton->GraphInstanceName( aDataFlowInfo.theName.c_str() ).c_str() ) ; + theAutomaton->MapGraph( Graph() , Graph()->Name() ) ; + cdebug << "GraphEditor::OutNode::LoadInfo " << aDataFlowName << " --> " << Graph()->Name() + << " aDataFlowInfo.Kind " << aDataFlowInfo.theKind << " Kind() " << Graph()->Kind() << endl ; if ( Graph()->IsDataStreamNode() ) { Graph()->Kind( SUPERV::DataStreamGraph ) ; StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ; @@ -230,18 +282,22 @@ bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { } bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , - const GraphBase::ListOfNodes &aListOfNodes ) { + const GraphBase::ListOfSNodes &aListOfNodes ) { GraphEditor::InNode * anInNode ; cdebug_in << "GraphEditor::OutNode::LoadNodes " << endl ; int i ; for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) { GraphBase::SNode aNode = aListOfNodes[ i ] ; const char * aNodeName = aNode.theName.c_str() ; - cout << "GraphEditor::OutNode::LoadNodes " << aNodeName << " " - << aNode.theListOfInDataStreams.size() << " InDataStreams " - << aNode.theListOfOutDataStreams.size() << " OutDataStreams " - << " _prof_debug " << _prof_debug << endl ; +// cout << "GraphEditor::OutNode::LoadNodes " << aNodeName << " " +// << aNode.theService.ServiceinParameter.length() << " InParameters " +// << aNode.theService.ServiceoutParameter.length() << " OutParameters " +// << aNode.theListOfInDataStreams.size() << " InDataStreams " +// << aNode.theListOfOutDataStreams.size() << " OutDataStreams " +// << " _prof_debug " << _prof_debug << endl ; cdebug << "GraphEditor::OutNode::LoadNodes " << aNodeName << " " + << aNode.theService.ServiceinParameter.length() << " InParameters " + << aNode.theService.ServiceoutParameter.length() << " OutParameters " << aNode.theListOfInDataStreams.size() << " InDataStreams " << aNode.theListOfOutDataStreams.size() << " OutDataStreams " << endl ; @@ -282,7 +338,7 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , aNode.theCoords.theX , aNode.theCoords.theY ) ; string * aNodetheName = new string( aNode.theName ) ; aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ; - if ( anInNode->IsOneOfInLineNodes() ) { + if ( anInNode->IsOneOfInLineNodes() || anInNode->IsMacroNode() ) { anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode( _Orb , aNode.theService , anInNode->NamePtr() , anInNode->Kind() , @@ -298,7 +354,7 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() , *aNode.theListOfPythonFunctions[ 2 ] ) ; } - else if ( aINode->IsInLineNode() || aINode->IsGOTONode() || + else if ( aINode->IsMacroNode() || aINode->IsInLineNode() || aINode->IsGOTONode() || aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) { aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() , *aNode.theListOfPythonFunctions[ 0 ] ) ; @@ -346,7 +402,14 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) { GraphBase::GOTONode * aCoupledNode ; aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ; - aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; + GraphBase::GOTONode * aCoupledCoupledNode ; + aCoupledCoupledNode = (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ; + if ( aCoupledCoupledNode != NULL ) { + aCoupledNode->CoupledNode( aCoupledCoupledNode ) ; + } + else { + aCoupledNode->CoupledNodeName( aNode.theCoupledNode.c_str() ) ; + } } } cdebug_out << "GraphEditor::OutNode::LoadNodes" << endl ; @@ -354,7 +417,7 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , } bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , - const GraphBase::ListOfLinks &aListOfLinks ) { + const GraphBase::ListOfSLinks &aListOfLinks ) { bool RetVal = true ; cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ; // MESSAGE( "GraphEditor::OutNode::LoadLinks" ); @@ -369,13 +432,13 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , << aLink.ToServiceParameterName.c_str() << " )" << endl ; if ( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) && Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) { - GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ; - const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ; +// GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ; +// const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ; RetVal = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - aLink.FromServiceParameterName.c_str() , - Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() , - *anOutPort->Value() ) ; + aLink.FromServiceParameterName.c_str() , + Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() ) ; +// , *anOutPort->Value() ) ; } else { RetVal = false ; @@ -404,19 +467,16 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , } bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes , - const GraphBase::ListOfLinks &aListOfDatas ) { + const GraphBase::ListOfSLinks &aListOfDatas ) { bool RetVal = true ; cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ; // MESSAGE( "GraphEditor::OutNode::LoadDatas" ); int i ; for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) { GraphBase::SLink aLink = aListOfDatas[ i ] ; - if ( !strcmp( aLink.FromNodeName.c_str() , Graph()->Name() ) ) { - cdebug << "GraphEditor::OutNode::LoadDatas Warning " - << aLink.FromNodeName.c_str() - << " and " << aLink.ToNodeName.c_str() << " differents from " << Graph()->Name() - << endl ; - } + cdebug << "OutNode::LoadDatas " << i << aLink.FromNodeName.c_str() << "(" << aLink.FromServiceParameterName + << ") --> " << aLink.ToNodeName.c_str() << "(" << aLink.ToServiceParameterName << ") CORBA::tk_xxx " + << aLink.aLinkValue.type()->kind() << endl ; string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ; string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ; // cout << "LoadDatas " << aLink.FromNodeName.c_str() << " " @@ -440,14 +500,20 @@ bool GraphEditor::OutNode::SaveXml(const char* filename) { cdebug_in << "GraphEditor::OutNode::SaveXml(" << filename << ")" << endl; ofstream f(filename); IsValid() ; -// test = SaveXML( f ); - QDomDocument Graph ; - test = SaveXML( Graph ); - if ( test ) { - QString xml = Graph.toString() ; + QDomDocument DomGraph ; + QDomElement Domsupergraph ; + cdebug << "OutNode::SaveXML("<< filename << ") ---> OutNode::SaveXML( ostream & f , QDomDocument & , true " + << " , QDomElement & ) " << Graph()->Name() << endl ; + test = SaveXML( f , DomGraph , true , Domsupergraph ); + QString xml = DomGraph.toString() ; + f << xml << endl ; + + cdebug << "OutNode::SaveXML("<< filename << ") done" << endl ; +// if ( test ) { +// QString xml = Graph.toString() ; // cout << "GraphEditor::OutNode::SaveXML " << xml << endl ; - f << xml << endl ; - } +// f << xml << endl ; +// } cdebug_out << "GraphEditor::OutNode::SaveXml" << endl; return test; } @@ -458,26 +524,37 @@ bool GraphEditor::OutNode::SavePy( const char* filename ) { cdebug_in << "GraphEditor::OutNode::SavePy(" << filename << ")" << endl; ofstream f( filename ) ; IsValid() ; - test = SavePY( f ); + test = SavePY( f , true ); + f << endl << Graph()->Name() << " = Def" << Graph()->Name() << "()" << endl ; cdebug_out << "GraphEditor::OutNode::SavePy" << endl; return test; } -GraphBase::SGraph * GraphEditor::OutNode::GetDataFlow() { - GraphBase::SGraph * aDataFlow = new GraphBase::SGraph; +GraphBase::ListOfSGraphs * GraphEditor::OutNode::GetDataFlows( GraphBase::ListOfSGraphs * aListOfDataFlows ) { +// GraphBase::ListOfSGraphs * aListOfDataFlows = new GraphBase::ListOfSGraphs; + int index = aListOfDataFlows->size() ; + aListOfDataFlows->resize( index + 1 ) ; if ( Graph()->IsDataFlowNode() ) { - aDataFlow->Info = *Graph()->GetInfo() ; - aDataFlow->Nodes = *Graph()->GetNodes() ; - aDataFlow->Links = *Graph()->GetLinks( true ) ; - aDataFlow->Datas = *Graph()->GetDatas() ; + (*aListOfDataFlows)[ index ].Info = *Graph()->GetInfo() ; + (*aListOfDataFlows)[ index ].Nodes = *Graph()->GetNodes() ; + (*aListOfDataFlows)[ index ].Links = *Graph()->GetLinks( true ) ; + (*aListOfDataFlows)[ index ].Datas = *Graph()->GetDatas() ; } else { - aDataFlow->Info = *StreamGraph()->GetInfo() ; - aDataFlow->Nodes = *StreamGraph()->GetNodes() ; - aDataFlow->Links = *StreamGraph()->GetLinks( true ) ; - aDataFlow->Datas = *StreamGraph()->GetDatas() ; + (*aListOfDataFlows)[ index ].Info = *StreamGraph()->GetInfo() ; + (*aListOfDataFlows)[ index ].Nodes = *StreamGraph()->GetNodes() ; + (*aListOfDataFlows)[ index ].Links = *StreamGraph()->GetLinks( true ) ; + (*aListOfDataFlows)[ index ].Datas = *StreamGraph()->GetDatas() ; + } + int i ; + for ( i = 0 ; i < (int ) (*aListOfDataFlows)[ index ].Nodes.size() ; i++ ) { + if ( Graph()->GetGraphNode( (*aListOfDataFlows)[ index ].Nodes[i].theName.c_str() )->IsMacroNode() ) { + string aCoupledNode = (*aListOfDataFlows)[ index ].Nodes[i].theCoupledNode ; + GraphBase::Graph * aGraph = theAutomaton->MapGraph( aCoupledNode.c_str() ) ; + aGraph->GraphEditor()->GraphEditor::OutNode::GetDataFlows( aListOfDataFlows ) ; + } } - return aDataFlow ; + return aListOfDataFlows ; } void GraphEditor::OutNode::DateModification() { @@ -543,7 +620,7 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( cdebug << " " << NodeKindOfNode << endl ; char * RetVal = NULLSTRING ; GraphEditor::InNode *Nd = NULL ; - char * aNodeName = NULL ; + char * aNodeName = NULLSTRING ; bool GeneratedName = false ; if ( NodeKindOfNode == SUPERV::InLineNode || NodeKindOfNode == SUPERV::LoopNode || @@ -576,7 +653,7 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( } theNodeName = NULLSTRING ; } - if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) { + if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 || Graph()->GetGraphNode( theNodeName ) ) { aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ; strcpy( aNodeName , NodeService.ServiceName ) ; if ( Graph()->GetGraphNode( NodeService.ServiceName ) ) { @@ -603,6 +680,9 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( aNodeName = new char[ strlen( theNodeName )+1 ] ; strcpy( aNodeName , theNodeName ) ; } + else { + aNodeName = NULLSTRING ; + } } if ( aNodeName != NULLSTRING ) { Nd = new GraphEditor::InNode( _Orb , Graph()->NamingService() , @@ -811,17 +891,13 @@ bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName , return false ; } -bool GraphEditor::OutNode::AddInputData( const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) { - cdebug_in << "GraphEditor::OutNode::AddInputData" << endl; - bool RetVal = Graph()->AddInputData( ToNodeName1 , - ToParameterName1 , - ToNodeName2 , - ToParameterName2 ) ; - cdebug_out << "GraphEditor::OutNode::AddInputData" << endl; +bool GraphEditor::OutNode::UnValid() { + bool RetVal = _Valid ; _Valid = false ; + if ( Graph()->GraphMacroLevel() != 0 ) { + cdebug << "GraphEditor::OutNode::UnValid() GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; + RetVal = Valid() ; + } return RetVal ; } @@ -832,11 +908,29 @@ bool GraphEditor::OutNode::Valid() { cdebug_in << "GraphEditor::OutNode::Valid" << endl; _Executable = false ; - Graph()->CreateService() ; + if ( !Graph()->CreateService() ) { + cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl; + return false ; + } + if ( Graph()->GraphMacroLevel() != 0 ) { + cdebug << "CoupledNode " << Graph()->CoupledNode() << endl ; + cdebug << "GraphEditor " << Graph()->CoupledNode()->GraphEditor() << endl ; + cdebug << "Graph " << Graph()->CoupledNode()->GraphEditor()->Graph() << endl ; + cdebug << "Name " << Graph()->CoupledNode()->GraphEditor()->Graph()->Name() << endl ; + cdebug << "Valid --> UpdateMacroPorts of " << Graph()->CoupledNodeName() << " of " + << Graph()->CoupledNode()->GraphEditor()->Graph()->Name() << endl ; + cdebug << Graph()->CoupledNode() << endl ; + Graph()->CoupledNode()->UpdateMacroPorts( Graph() ) ; + cdebug << Graph()->CoupledNode()->Name() << " Valid --> UnValid of graph " + << Graph()->CoupledNode()->GraphEditor()->Graph()->Name() + << " GraphMacroLevel " << Graph()->CoupledNode()->GraphEditor()->Graph()->GraphMacroLevel() << endl ; + Graph()->CoupledNode()->GraphEditor()->UnValid() ; + } + int SubStreamGraphsNumber = 0 ; if ( !Graph()->Sort( SubStreamGraphsNumber ) ) { - cdebug << "This DataFlow is not valid." << endl ; + cdebug_out << "This DataFlow is not valid." << endl ; return false ; } if ( Graph()->IsDataStreamNode() ) { @@ -851,7 +945,7 @@ bool GraphEditor::OutNode::Valid() { _Valid = true ; - cdebug_out << "GraphEditor::OutNode::Valid" << endl; + cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl; return _Valid ; } @@ -1078,7 +1172,7 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , // << aLink.FromServiceParameterName.c_str() // << "' )" << endl ; // } - f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() + f << " " << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() ; if ( ((GraphBase::Graph *) Graph())->GetChangeGraphNode( aLink.FromNodeName.c_str() )->GetChangeOutPort( aLink.FromServiceParameterName.c_str() )->IsDataStream() ) { f << " = " << aGraphName << ".StreamLink( " ; @@ -1096,7 +1190,7 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << " )" << endl ; } else { - f << "I"<< aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() + f << " " << "I"<< aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() // << " = " << aLink.ToNodeName.c_str() << ".Input( '" // << aLink.ToServiceParameterName.c_str() << "' , " ; << ".Input( " ; @@ -1137,7 +1231,7 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , } int i ; for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) { - f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() + f << " " << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , " << aLink.aListOfCoords[ i ].theX << " , " << aLink.aListOfCoords[ i ].theY << " )" << endl ; @@ -1146,30 +1240,36 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , } //bool GraphEditor::OutNode::SaveXML(ostream & f ) { -bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) { +bool GraphEditor::OutNode::SaveXML( ostream & f , QDomDocument & GraphQDom , + bool aSuperGraph , QDomElement & supergraph ) { + cdebug_in << "OutNode::SaveXML( ostream & f , QDomDocument & , " << aSuperGraph << " , QDomElement & ) " + << Graph()->Name() << endl ; int i ; -// f << "" << endl << endl ; -// f << "" << endl << endl ; -// f << "" << endl ; - QString Dataflow("Dataflow") ; - GraphQDom = QDomDocument(Dataflow) ; -// f << "" << endl ; - QDomElement dataflow = GraphQDom.createElement( "dataflow" ) ; - GraphQDom.appendChild( dataflow ) ; -// f << " " << endl ; - QDomElement info = GraphQDom.createElement( "info-list" ) ; - dataflow.appendChild( info ) ; -// f << " " << endl ; + QDomElement dataflow ; + if ( aSuperGraph ) { + QString SuperGraph("SuperGraph") ; + GraphQDom = QDomDocument(SuperGraph) ; -// GraphBase::DataNode::SaveXML( f , " " , 0 , 0 ) ; - Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ; + supergraph = GraphQDom.createElement( "supergraph" ) ; + GraphQDom.appendChild( supergraph ) ; + + dataflow = GraphQDom.createElement( "dataflow" ) ; + supergraph.appendChild( dataflow ) ; + } + else { +// QString Dataflow("Dataflow") ; +// GraphQDom = QDomDocument(Dataflow) ; + + dataflow = GraphQDom.createElement( "dataflow" ) ; + supergraph.appendChild( dataflow ) ; + } -// f << " " << endl ; + QDomElement info = GraphQDom.createElement( "info-list" ) ; + dataflow.appendChild( info ) ; -// f << " " << endl << endl ; + Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ; -// f << " " << endl ; QDomElement nodelist = GraphQDom.createElement( "node-list" ) ; dataflow.appendChild( nodelist ) ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { @@ -1188,13 +1288,20 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) { Graph()->GraphNodes( i )->XCoordinate() , Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( Graph()->GraphNodes( i )->IsInLineNode() ) { + else if ( Graph()->GraphNodes( i )->IsInLineNode() ) { // ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f , // " " , ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , Graph()->GraphNodes( i )->XCoordinate() , Graph()->GraphNodes( i )->YCoordinate() ) ; } + else if ( Graph()->GraphNodes( i )->IsMacroNode() ) { +// ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f , +// " " , + ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; + } else if ( Graph()->GraphNodes( i )->IsGOTONode() ) { // ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( f , // " " , @@ -1238,7 +1345,7 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) { // f << " " << endl ; QDomElement linklist = GraphQDom.createElement( "link-list" ) ; dataflow.appendChild( linklist ) ; - const GraphBase::ListOfLinks * Links = Graph()->GetLinks( true ) ; + const GraphBase::ListOfSLinks * Links = Graph()->GetLinks( true ) ; for ( i = 0 ; i < (int ) Links->size() ; i++ ) { // f << " " << endl ; QDomElement link = GraphQDom.createElement( "link" ) ; @@ -1252,63 +1359,57 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) { // f << " " << endl ; QDomElement datalist = GraphQDom.createElement( "data-list" ) ; dataflow.appendChild( datalist ) ; - const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ; - for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { + if ( Graph()->GraphMacroLevel() == 0 ) { + const GraphBase::ListOfSLinks * Datas = Graph()->GetDatas() ; + for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { // f << " " << endl ; - QDomElement data = GraphQDom.createElement( "data" ) ; - datalist.appendChild( data ) ; + QDomElement data = GraphQDom.createElement( "data" ) ; + datalist.appendChild( data ) ; // LinkSaveXML( f , " " , (*Datas)[ i ] , true ) ; - LinkSaveXML( GraphQDom , data , (*Datas)[ i ] , true ) ; + LinkSaveXML( GraphQDom , data , (*Datas)[ i ] , true ) ; // f << " " << endl ; + } } -//#if 0 -// const GraphEditor::OutNode * aDataNode = (GraphEditor::OutNode *) this ; -// if ( aDataNode ) { -// int i ; -// for ( i = 0 ; i < aDataNode->GetNodeOutPortsSize() ; i++ ) { -// const GraphBase::InPort *aLink = aDataNode->GetNodeOutPort(i)->GetLink() ; -// if ( aLink ) { -// f << " " << endl ; -// aLink->SaveXML( f , " " ) ; -// f << " " << endl ; -// } -// } -// for ( i = 0 ; i < aDataNode->GetNodeInPortsSize() ; i++ ) { -// const GraphBase::InPort *aLink = aDataNode->GetNodeInPort(i)->GetLink() ; -// if ( aLink ) { -// f << " " << endl ; -// aLink->SaveXML( f , " " ) ; -// f << " " << endl ; -// } -// } -// } -//#endif -#if 0 - f << " " << endl << endl ; - f << "" << endl ; -#endif + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsMacroNode() ) { + GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) Graph()->GraphNodes( i ) ; + GraphBase::Graph * aMacroGraph = (GraphBase::Graph * ) aMacroNode->CoupledNode() ; + cdebug << "OutNode::SaveXML ---> OutNode::SaveXML( ostream & f , QDomDocument & , false " + << " , QDomElement & ) MacroGraph " << aMacroGraph->Name() << endl ; + if ( !aMacroGraph->GraphEditor()->SaveXML( f , GraphQDom , false , supergraph ) ) { + return false ; + cdebug << "OutNode::SaveXML MacroGraph "<< aMacroGraph->Name() << " done" << endl ; + } + } + } + + cdebug_out << "OutNode::SaveXML( ostream & f , QDomDocument & , " << aSuperGraph << " , QDomElement & ) " + << Graph()->Name() << endl ; return true ; } -bool GraphEditor::OutNode::SavePY( ostream & f ) { +bool GraphEditor::OutNode::SavePY( ostream & f , bool importSuperV ) { int i ; int j ; - f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ; + if ( importSuperV ) { + f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ; - f << "from SuperV import *" << endl ; + f << "from SuperV import *" << endl << endl ; + } - f << "# Graph creation " << endl ; + f << "# Graph creation of " << Graph()->Name() << endl ; + f << "def Def" << Graph()->Name() << "() :" << endl ; Graph()->SavePY( f , Graph()->Name() , 0 , 0 ) ; - f << endl << "# Creation of Factory Nodes" << endl ; + f << " " << endl << " " << "# Creation of Factory Nodes" << endl ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsFactoryNode() ) { - f << endl ; + f << " " << endl ; ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } @@ -1316,15 +1417,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsComputingNode() ) { if ( first ) { - f << endl << "# Creation of Computing Nodes" << endl ; + f << " " << endl << " " << "# Creation of Computing Nodes" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } ((GraphBase::ComputingNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } @@ -1332,15 +1433,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsInLineNode() ) { if ( first ) { - f << endl << "# Creation of InLine Nodes" << endl ; + f << " " << endl << " " << "# Creation of InLine Nodes" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } @@ -1348,15 +1449,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsLoopNode() ) { if ( first ) { - f << endl << "# Creation of Loop Nodes" << endl ; + f << " " << endl << " " << "# Creation of Loop Nodes" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } @@ -1364,15 +1465,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsSwitchNode() ) { if ( first ) { - f << endl << "# Creation of Switch Nodes" << endl ; + f << " " << endl << " " << "# Creation of Switch Nodes" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } @@ -1380,19 +1481,35 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { if ( Graph()->GraphNodes( i )->IsGOTONode() ) { if ( first ) { - f << endl << "# Creation of GOTO Nodes" << endl ; + f << " " << endl << " " << "# Creation of GOTO Nodes" << endl ; + first = false ; + } + else { + f << " " << endl ; + } + ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; + } + } + + first = true ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsMacroNode() ) { + if ( first ) { + f << " " << endl << " " << "# Creation of Macro Nodes" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , - Graph()->GraphNodes( i )->XCoordinate() , - Graph()->GraphNodes( i )->YCoordinate() ) ; + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } - const GraphBase::ListOfLinks * Links = Graph()->GetLinks() ; + const GraphBase::ListOfSLinks * Links = Graph()->GetLinks() ; // bool intervar ; // map< string , int > aMapOfOutPorts ; first = true ; @@ -1400,13 +1517,13 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { for ( j = 0 ; j < (int ) Links->size() ; j++ ) { if ( !strcmp( Graph()->GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) { if ( first ) { - f << endl - << "# Creation of Links" + f << " " << endl + << " " << "# Creation of Links" << endl ; first = false ; } else { - f << endl ; + f << " " << endl ; } // char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) + // strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ; @@ -1433,16 +1550,18 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { } } - const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ; - first = true ; - for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { - if ( first ) { - f << endl << "# Input datas" << endl ; - first = false ; + if ( Graph()->GraphMacroLevel() == 0 ) { + const GraphBase::ListOfSLinks * Datas = Graph()->GetDatas() ; + first = true ; + for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { + if ( first ) { + f << " " << endl << " " << "# Input datas" << endl ; + first = false ; + } + bool fromparam = true ; + bool toparam = true ; + LinkSavePY( f , Graph()->Name() , (*Datas)[ i ] , fromparam , toparam , true ) ; } - bool fromparam = true ; - bool toparam = true ; - LinkSavePY( f , Graph()->Name() , (*Datas)[ i ] , fromparam , toparam , true ) ; } first = true ; @@ -1454,29 +1573,30 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { char * aPortName ; int j ; for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) { - if ( aParam[ j ] == '\\' ) { +// if ( aParam[ j ] == '\\' ) { + if ( aParam[ j ] == '_' && aParam[ j+1 ] == '_' ) { aNodeName = new char[ j+1 ] ; strncpy( aNodeName , aParam , j ) ; aNodeName[ j ] = '\0' ; - aPortName = new char[ strlen( aParam ) - j ] ; - strncpy( aPortName , &aParam[ j+1 ] , strlen( aParam ) - j ) ; + aPortName = new char[ strlen( aParam ) - j-1 ] ; + strncpy( aPortName , &aParam[ j+2 ] , strlen( aParam ) - j-1 ) ; break ; } } const GraphBase::InPort * anInPort = Graph()->GetChangeGraphNode( aNodeName )->GetInPort( aPortName ) ; if ( !anInPort->IsDataConnected() ) { if ( first ) { - f << endl << "# Input Ports of the graph" << endl ; + f << " " << endl << " " << "# Input Ports of the graph" << endl ; first = false ; } - f << "#I" << aNodeName << aPortName << " = " << aNodeName << ".GetInPort( '" + f << " " << "#I" << aNodeName << aPortName << " = " << aNodeName << ".GetInPort( '" << aPortName << "' )" << endl ; } delete [] aNodeName ; delete [] aPortName ; } - f << endl << "# Output Ports of the graph" << endl ; + f << " " << endl << " # Output Ports of the graph" << endl ; const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = Graph()->ServiceOutParameter() ; for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) { string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ; @@ -1485,20 +1605,41 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { char * aPortName ; int j ; for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) { - if ( aParam[ j ] == '\\' ) { +// if ( aParam[ j ] == '\\' ) { + if ( aParam[ j ] == '_' && aParam[ j+1 ] == '_' ) { aNodeName = new char[ j+1 ] ; strncpy( aNodeName , aParam , j ) ; aNodeName[ j ] = '\0' ; - aPortName = new char[ strlen( aParam ) - j ] ; - strncpy( aPortName , &aParam[ j+1 ] , strlen( aParam ) - j ) ; + aPortName = new char[ strlen( aParam ) - j-1 ] ; + strncpy( aPortName , &aParam[ j+2 ] , strlen( aParam ) - j-1 ) ; break ; } } - f << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '" + f << " " << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '" << aPortName << "' )" << endl ; delete [] aNodeName ; delete [] aPortName ; } + + f << " " << "return " << Graph()->Name() << endl << endl ; + +// RECURSIVE CREATION OF GRAPHS OF MACRONODES + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsMacroNode() ) { + GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) Graph()->GraphNodes( i ) ; + GraphBase::Graph * aMacroGraph = (GraphBase::Graph * ) aMacroNode->CoupledNode() ; + cdebug << "OutNode::SavePY ---> OutNode::SavePY( ostream & f ) MacroGraph " << aMacroGraph->Name() << endl ; + GraphEditor::DataFlow * aDataFlow = aMacroGraph->GraphEditor() ; + cdebug << "SavePY of the Graph " << aDataFlow->Graph() << " of the MacroNode " + << aMacroGraph->Name() << endl ; + if ( !aDataFlow->SavePY( f , false ) ) { + return false ; + } + } + } + +// f << Graph()->Name() << " = " << Graph()->Name() << "()" << endl ; + return true ; } diff --git a/src/GraphEditor/DataFlowEditor_OutNode.hxx b/src/GraphEditor/DataFlowEditor_OutNode.hxx index 351707d..4c14b83 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.hxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.hxx @@ -55,18 +55,19 @@ namespace GraphEditor { bool Executable() ; bool LoadNodes( map< string , int > & aMapOfNodes , - const GraphBase::ListOfNodes &aNodes ) ; + const GraphBase::ListOfSNodes &aNodes ) ; bool LoadLinks( map< string , int > & aMapOfNodes , - const GraphBase::ListOfLinks &aLinks ) ; + const GraphBase::ListOfSLinks &aLinks ) ; bool LoadDatas( map< string , int > & aMapOfNodes , - const GraphBase::ListOfLinks &aDatas ) ; + const GraphBase::ListOfSLinks &aDatas ) ; // bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs , bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link , GraphBase::SLink aLink , bool wdata ) const ; // bool SaveXML(ostream &f ) ;QDomDocument & Graph - bool SaveXML(QDomDocument & Graph ) ; + bool SaveXML( ostream & f , QDomDocument & Graph , + bool aSuperGraph , QDomElement & supergraph ) ; bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char *aGraphName , @@ -74,7 +75,7 @@ namespace GraphEditor { bool fromparam , bool toparam , bool wdata ) const; - bool SavePY(ostream &f ) ; + bool SavePY(ostream &f , bool importSuperV ) ; void DateModification() ; @@ -102,6 +103,10 @@ namespace GraphEditor { const char * DebugFileName ) ; virtual ~OutNode(); + GraphExecutor::FiniteStateMachine * Automaton() { return theAutomaton ; } ; + + bool Name( const char * aName ) ; + void Set_prof_debug( CORBA::ORB_ptr ORB , const char * DebugFileName ) ; GraphBase::StreamGraph * StreamGraph() { return _StreamGraph ; } ; @@ -113,7 +118,8 @@ namespace GraphEditor { return _Graph ; } ; bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ; - bool LoadXml( const char* myFileName ) ; + bool LoadXml( const char* myFileName , GraphBase::ListOfSGraphs & aListOfDataFlows ) ; +// bool LoadXml( const char* myFileName ) ; bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ; bool SaveXml(const char* myFileName ) ; @@ -121,7 +127,7 @@ namespace GraphEditor { bool SavePy(const char* myFileName ) ; // get all DataFlow informations (for a .XML file) : - GraphBase::SGraph * GetDataFlow() ; + GraphBase::ListOfSGraphs * GetDataFlows( GraphBase::ListOfSGraphs * aListOfDataFlows ) ; // void DateModification() ; @@ -185,13 +191,13 @@ namespace GraphEditor { bool AddLink( const char* FromNodeName , const char* FromServiceParameterName , const char* ToNodeName , - const char* ToServiceParameterName , - const CORBA::Any aValue ) { + const char* ToServiceParameterName ) { +// , const CORBA::Any aValue ) { DateModification() ; _Valid = false ; return _Graph->AddLink( FromNodeName , FromServiceParameterName , - ToNodeName , ToServiceParameterName , - aValue ) ; } ; + ToNodeName , ToServiceParameterName ) ; } ; +// , aValue ) ; } ; bool RemoveLink( const char* FromNodeName , const char* FromServiceParameterName , @@ -256,10 +262,6 @@ namespace GraphEditor { const char* ToServiceParameterName , const int index , long &X , long &Y ) ; - bool AddInputData( const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) ; bool IsValid() { if ( !_Valid ) @@ -267,10 +269,7 @@ namespace GraphEditor { return _Valid ; } ; bool IsNotValid() const { return !_Valid ; } ; - bool UnValid() { - bool RetVal = _Valid ; - _Valid = false ; - return RetVal ; } ; + bool UnValid() ; bool IsExecutable() { if ( !_Valid ) diff --git a/src/GraphEditor/Makefile.in b/src/GraphEditor/Makefile.in index 6bd73f7..056901b 100644 --- a/src/GraphEditor/Makefile.in +++ b/src/GraphEditor/Makefile.in @@ -60,7 +60,7 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ +CXXFLAGS+= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS+= -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lSalomeSuperVisionExecutor -lOpUtil -lSALOMELocalTrace \ -lc $(QT_MT_LIBS) $(OGL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx index 36d198c..10d4cdb 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx @@ -55,21 +55,20 @@ GraphExecutor::DataFlow::DataFlow( CORBA::ORB_ptr ORB, cdebug_out << "GraphExecutor::DataFlow::DataFlow" << endl; } -GraphExecutor::DataFlow::DataFlow( - CORBA::ORB_ptr ORB, - SALOME_NamingService* ptrNamingService , - const SALOME_ModuleCatalog::Service& DataFlowService , - const char *DataFlowComponentName , - const char *DataFlowInterfaceName , - const char *DataFlowName , - const SUPERV::KindOfNode DataFlowkind , - const SUPERV::SDate DataFlowFirstCreation , - const SUPERV::SDate DataFlowLastModification , - const char * DataFlowExecutorRelease , - const char * DataFlowAuthor , - const char * DataFlowComputer , - const char * DataFlowComment , - const char * DebugFileName ) : +GraphExecutor::DataFlow::DataFlow( CORBA::ORB_ptr ORB, + SALOME_NamingService* ptrNamingService , + const SALOME_ModuleCatalog::Service& DataFlowService , + const char *DataFlowComponentName , + const char *DataFlowInterfaceName , + const char *DataFlowName , + const SUPERV::KindOfNode DataFlowkind , + const SUPERV::SDate DataFlowFirstCreation , + const SUPERV::SDate DataFlowLastModification , + const char * DataFlowExecutorRelease , + const char * DataFlowAuthor , + const char * DataFlowComputer , + const char * DataFlowComment , + const char * DebugFileName ) : OutNode( ORB, ptrNamingService , DataFlowService , DataFlowComponentName , DataFlowInterfaceName , DataFlowName , DataFlowkind , DataFlowFirstCreation , DataFlowLastModification , @@ -115,6 +114,91 @@ bool GraphExecutor::DataFlow::ContainerKill( const char *aNodeName ) { return RetVal ; } +bool GraphExecutor::DataFlow::InputOfAny( const char * ToServiceParameterName , + const CORBA::Any & aValue ) { + cdebug_in "GraphExecutor::DataFlow::InputOfAny" << endl ; + bool RetVal = false ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::::InputOfAny " << Graph()->Name() << "(" + << ToServiceParameterName << ")" << endl ; + if ( Graph()->GraphMacroLevel() ) { + GraphBase::OutPort * anOutPort ; + anOutPort = Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny " << Graph()->Name() + << " " << ToServiceParameterName << " " << anOutPort->State() << " Done " << anOutPort->Done() + << endl ; + RetVal = AddInputData( Graph()->Name() , ToServiceParameterName , aValue ) ; + anOutPort->State( SUPERV::ReadyState ) ; + anOutPort->Done( true ) ; + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny : " << anInNode->Name() + << "->SendSomeDataReady( " << Graph()->Name() << " ) " << endl ; + anInNode->SendSomeDataReady( Graph()->Name() ) ; + if ( anInNode->IsReady() ) { + cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny : " << anInNode->Name() + << "->SendEvent( GraphExecutor::ExecuteEvent ) " + << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State " + << anInNode->State() << endl ; + if ( anInNode->IsLockedDataWait() ) { + cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny : " << anInNode->Name() + << " IsLockedDataWait() ==> UnLockDataWait" << endl ; + anInNode->UnLockDataWait() ; + } + anInNode->CreateNewThread( true ) ; + anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ; + State( GraphExecutor::ExecutingState ) ; + } + } + cdebug_out << "GraphExecutor::DataFlow::InputOfAny " << RetVal << endl ; + return RetVal ; +} + +bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , + const char * ToServiceParameterName , + const CORBA::Any & aValue ) { + cdebug_in << "GraphExecutor::DataFlow::OutputOfAny" << endl ; + bool RetVal = false ; + GraphBase::Graph * aMacroGraph = (GraphBase::Graph * ) Graph()->GetChangeGraphNode( aNodeName ) ; +// GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aMacroGraph->GetInNode() ; + RetVal = Graph()->AddOutputData( aNodeName , ToServiceParameterName , aValue ) ; + GraphBase::OutPort * anOutPort = aMacroGraph->GetChangeOutPort( ToServiceParameterName ) ; + int i ; + for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) { + if ( strcmp( anOutPort->ChangeInPorts( i )->NodeName() , Graph()->Name() ) ) { + cdebug << "GraphExecutor::DataFlow::OutputOfAny toNodeName " << anOutPort->ChangeInPorts( i )->NodeName() + << "(" << anOutPort->ChangeInPorts( i )->PortName() << ")" << endl ; + GraphExecutor::InNode * aLinkedNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( i )->NodeName() )->GetInNode() ; + int sts ; + if ( aLinkedNode->IsLockedDataWait() ) { + cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name() + << " IsLockedDataWait --> UnLockDataWait" << endl ; + } + sts = aLinkedNode->SendSomeDataReady( (char * ) aNodeName ) ; + cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name() + << "->SendSomeDataReady( " << aNodeName << " ) sts " << sts << endl ; + if ( sts ) { + if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) { + aLinkedNode->CreateNewThreadIf( true ) ; + aLinkedNode->UnLockDataWait() ; + int res = aLinkedNode->DataUndef_AllDataReadyAction() ; + } + } + } + else if ( Graph()->GraphMacroLevel() != 0 ) { + cdebug << "GraphExecutor::DataFlow::OutputOfAny to MacroGraph " << anOutPort->ChangeInPorts( i )->NodeName() + << "(" << anOutPort->ChangeInPorts( i )->PortName() << ") " << Graph()->CoupledNodeName () << endl ; + Graph()->CoupledNode()->GraphExecutor()->OutputOfAny( Graph()->CoupledNodeName() , + anOutPort->ChangeInPorts( i )->PortName() , + *anOutPort->Value() ) ; + } + else { + cdebug << "GraphExecutor::DataFlow::OutputOfAny to Graph " << anOutPort->ChangeInPorts( i )->NodeName() + << "(" << anOutPort->ChangeInPorts( i )->PortName() << ") ignored" << endl ; + } + } + cdebug_out << "GraphExecutor::DataFlow::OutputOfAny " << RetVal << endl ; + return RetVal ; +} + bool GraphExecutor::DataFlow::Kill() { cdebug_in << "GraphExecutor::DataFlow::Kill()" << endl; bool RetVal = GraphExecutor::OutNode::Kill() ; diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx index b5774e7..3c348af 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx @@ -59,18 +59,23 @@ namespace GraphExecutor { const char * DebugFileName = NULLSTRING ) ; virtual ~DataFlow(); - bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ; - bool LoadXml( const char* myFileName ) ; + bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ; +// bool LoadXml( const char* myFileName ) ; const SALOME_ModuleCatalog::Service * NodeService( const char * NodeName ) ; - bool ChangeInputData( const char* ToNodeName , - const char* ToParameterName , + bool AddInputData( const char * ToNodeName , + const char * ToParameterName , + const CORBA::Any aValue = CORBA::Any() ) ; + bool ChangeInputData( const char * ToNodeName , + const char * ToParameterName , const CORBA::Any aValue = CORBA::Any() ) ; - bool AddInputSharedData( const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) ; + bool InputOfAny( const char * ToServiceParameterName , + const CORBA::Any & aValue ) ; + + bool OutputOfAny( const char * aNodeName , + const char * ToServiceParameterName , + const CORBA::Any & aValue ) ; bool IsValid() ; bool IsExecutable() ; @@ -81,6 +86,7 @@ namespace GraphExecutor { long LastLevelDone() ; + void State(GraphExecutor::AutomatonState aState ) ; SUPERV::GraphState State() ; SUPERV::GraphState State(const char * aNodeName ) ; SUPERV::GraphState State( const char * aNodeName , @@ -89,8 +95,8 @@ namespace GraphExecutor { long Thread() ; long Thread(const char * aNodeName ) ; - SUPERV::AutomatonState AutomatonState() ; - SUPERV::AutomatonState AutomatonState(const char * aNodeName ) ; + GraphExecutor::AutomatonState AutomatonState() ; + GraphExecutor::AutomatonState AutomatonState(const char * aNodeName ) ; SUPERV::ControlState ControlState() ; SUPERV::ControlState ControlState(const char * aNodeName ) ; diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx index 2cf8cf4..8e9390f 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx @@ -29,41 +29,34 @@ #include "DataFlowExecutor_OutNode.hxx" -inline bool GraphExecutor::DataFlow::LoadDataFlow( - const GraphBase::SGraph &aDataFlow ) { +inline bool GraphExecutor::DataFlow::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) { return GraphExecutor::OutNode::LoadDataFlow( aDataFlow ) ; } -inline bool GraphExecutor::DataFlow::LoadXml( const char* myFileName ) { - return GraphExecutor::OutNode::LoadXml( myFileName ) ; -} +//inline bool GraphExecutor::DataFlow::LoadXml( const char* myFileName ) { +// return GraphExecutor::OutNode::LoadXml( myFileName ) ; +//} -inline const SALOME_ModuleCatalog::Service * GraphExecutor::DataFlow::NodeService( - const char * aNodeName ) { +inline const SALOME_ModuleCatalog::Service * GraphExecutor::DataFlow::NodeService( const char * aNodeName ) { if ( Graph()->GetGraphNode( aNodeName ) ) return Graph()->GetGraphNode( aNodeName )->GetService() ; return NULL ; } -inline bool GraphExecutor::DataFlow::ChangeInputData( const char* ToNodeName , - const char* ToParameterName , - const CORBA::Any aValue ) { +inline bool GraphExecutor::DataFlow::AddInputData( const char* ToNodeName , + const char* ToParameterName , + const CORBA::Any aValue ) { if ( !IsValid() ) return false ; - return Graph()->ChangeInputData( ToNodeName , ToParameterName , aValue ) ; + return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; } ; -inline bool GraphExecutor::DataFlow::AddInputSharedData(const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) { +inline bool GraphExecutor::DataFlow::ChangeInputData( const char* ToNodeName , + const char* ToParameterName , + const CORBA::Any aValue ) { if ( !IsValid() ) return false ; - return GraphExecutor::OutNode::AddInputData( ToNodeName1 , - ToParameterName1 , - ToNodeName2 , - ToParameterName2 ) ; -// aKindOfPortValue ) ; + return Graph()->ChangeInputData( ToNodeName , ToParameterName , aValue ) ; } ; inline bool GraphExecutor::DataFlow::IsValid() { @@ -106,6 +99,10 @@ inline long GraphExecutor::DataFlow::EventQSize() { return GraphExecutor::OutNode::EventQSize() ; } +inline void GraphExecutor::DataFlow::State(GraphExecutor::AutomatonState aState ) { + GraphExecutor::OutNode::State( aState ) ; +} + inline SUPERV::GraphState GraphExecutor::DataFlow::State() { return GraphExecutor::OutNode::State() ; } @@ -129,11 +126,11 @@ inline long GraphExecutor::DataFlow::Thread( const char * aNodeName ) { return GraphExecutor::OutNode::Thread( aNodeName ) ; } -inline SUPERV::AutomatonState GraphExecutor::DataFlow::AutomatonState() { +inline GraphExecutor::AutomatonState GraphExecutor::DataFlow::AutomatonState() { return GraphExecutor::OutNode::AutomatonState() ; } -inline SUPERV::AutomatonState GraphExecutor::DataFlow::AutomatonState( +inline GraphExecutor::AutomatonState GraphExecutor::DataFlow::AutomatonState( const char * aNodeName ) { return GraphExecutor::OutNode::AutomatonState( aNodeName ) ; } diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx index 448ad16..9916c77 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx @@ -45,41 +45,43 @@ void * start_function( void *p ) ; #define ToKillDoneState SUPERV::ToKillDoneState #define ToStopState SUPERV::ToStopState +#if 0 // States : -#define UnKnownState SUPERV::UnKnownState -#define DataUndefState SUPERV::DataUndefState -#define DataWaitingState SUPERV::DataWaitingState -#define DataReadyState SUPERV::DataReadyState -#define SuspendedReadyState SUPERV::SuspendedReadyState -#define SuspendedReadyToResumeState SUPERV::SuspendedReadyToResumeState -#define ResumedReadyState SUPERV::ResumedReadyState -#define KilledReadyState SUPERV::KilledReadyState -#define StoppedReadyState SUPERV::StoppedReadyState -#define ExecutingState SUPERV::ExecutingState -#define SuspendedExecutingState SUPERV::SuspendedExecutingState -#define ResumedExecutingState SUPERV::ResumedExecutingState -#define KilledExecutingState SUPERV::KilledExecutingState -#define StoppedExecutingState SUPERV::StoppedExecutingState -#define SuccessedExecutingState SUPERV::SuccessedExecutingState -#define ErroredExecutingState SUPERV::ErroredExecutingState -#define SuspendedSuccessedState SUPERV::SuspendedSuccessedState -#define SuspendedErroredState SUPERV::SuspendedErroredState -#define SuspendedSuccessedToReStartState SUPERV::SuspendedSuccessedToReStartState -#define SuspendedErroredToReStartState SUPERV::SuspendedErroredToReStartState -#define ResumedSuccessedState SUPERV::ResumedSuccessedState -#define ResumedErroredState SUPERV::ResumedErroredState -#define KilledSuccessedState SUPERV::KilledSuccessedState -#define KilledErroredState SUPERV::KilledErroredState -#define StoppedSuccessedState SUPERV::StoppedSuccessedState -#define StoppedErroredState SUPERV::StoppedErroredState -#define SuccessedState SUPERV::SuccessedState -#define ErroredState SUPERV::ErroredState -#define SuspendedState SUPERV::SuspendedState -#define KilledState SUPERV::KilledState -#define StoppedState SUPERV::StoppedState -#define ReRunnedState SUPERV::ReRunnedState -#define ReStartedState SUPERV::ReStartedState -#define NumberOfAutomatonStates SUPERV::NumberOfAutomatonStates +#define UnKnownState GraphExecutor::UnKnownState +#define DataUndefState GraphExecutor::DataUndefState +#define DataWaitingState GraphExecutor::DataWaitingState +#define DataReadyState GraphExecutor::DataReadyState +#define SuspendedReadyState GraphExecutor::SuspendedReadyState +#define SuspendedReadyToResumeState GraphExecutor::SuspendedReadyToResumeState +#define ResumedReadyState GraphExecutor::ResumedReadyState +#define KilledReadyState GraphExecutor::KilledReadyState +#define StoppedReadyState GraphExecutor::StoppedReadyState +#define ExecutingState GraphExecutor::ExecutingState +#define SuspendedExecutingState GraphExecutor::SuspendedExecutingState +#define ResumedExecutingState GraphExecutor::ResumedExecutingState +#define KilledExecutingState GraphExecutor::KilledExecutingState +#define StoppedExecutingState GraphExecutor::StoppedExecutingState +#define SuccessedExecutingState GraphExecutor::SuccessedExecutingState +#define ErroredExecutingState GraphExecutor::ErroredExecutingState +#define SuspendedSuccessedState GraphExecutor::SuspendedSuccessedState +#define SuspendedErroredState GraphExecutor::SuspendedErroredState +#define SuspendedSuccessedToReStartState GraphExecutor::SuspendedSuccessedToReStartState +#define SuspendedErroredToReStartState GraphExecutor::SuspendedErroredToReStartState +#define ResumedSuccessedState GraphExecutor::ResumedSuccessedState +#define ResumedErroredState GraphExecutor::ResumedErroredState +#define KilledSuccessedState GraphExecutor::KilledSuccessedState +#define KilledErroredState GraphExecutor::KilledErroredState +#define StoppedSuccessedState GraphExecutor::StoppedSuccessedState +#define StoppedErroredState GraphExecutor::StoppedErroredState +#define SuccessedState GraphExecutor::SuccessedState +#define ErroredState GraphExecutor::ErroredState +#define SuspendedState GraphExecutor::SuspendedState +#define KilledState GraphExecutor::KilledState +#define StoppedState GraphExecutor::StoppedState +#define ReRunnedState GraphExecutor::ReRunnedState +#define ReStartedState GraphExecutor::ReStartedState +#define NumberOfAutomatonStates GraphExecutor::NumberOfAutomatonStates +#endif // Events : #define UndefinedEvent GraphExecutor::UndefinedEvent @@ -268,7 +270,7 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() { for ( i = 0 ; i < NumberOfAutomatonStates ; i++ ) { for ( j = 0 ; j < NumberOfEvents ; j++ ) { // id est = SameState and VoidAction - _TransitionTable[ i ][ j ] = (SUPERV::AutomatonState ) i ; + _TransitionTable[ i ][ j ] = (GraphExecutor::AutomatonState ) i ; _ActionTable[ i ][ j ] = GraphExecutor::ErrorAction ; } } @@ -283,6 +285,8 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() { // SomeDataReadyEvent : _TransitionTable[ DataWaitingState ][ SomeDataReadyEvent ] = DataUndefState ; _ActionTable[ DataUndefState ][ SomeDataReadyEvent ] = DataWaiting_SomeDataReadyAction; + _TransitionTable[ DataReadyState ][ SomeDataReadyEvent ] = DataUndefState ; + _ActionTable[ DataUndefState ][ SomeDataReadyEvent ] = DataWaiting_SomeDataReadyAction; // NotAllDataReadyEvent : _TransitionTable[ DataUndefState ][ NotAllDataReadyEvent ] = DataWaitingState ; _ActionTable[ DataWaitingState ][ NotAllDataReadyEvent ] = DataUndef_NotAllDataReadyAction; @@ -455,7 +459,7 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() { _ExecNumber = 0 ; _GraphExecutingNumber = 0 ; _PyInitModule = false ; - + _DbgFileNumber = 0 ; // cdebug_out << "FiniteStateMachine::FiniteStateMachine _TransitionTable " // << endl; } @@ -585,6 +589,50 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P return RetVal ; } +GraphBase::Graph * GraphExecutor::FiniteStateMachine::MapGraph( const char * aGraphName ) { + GraphBase::Graph * aGraph = _MapOfGraphs[ aGraphName ] ; + //cout << "MapGraph " << aGraphName << " --> " << aGraph << endl ; + return aGraph ; +} + +bool GraphExecutor::FiniteStateMachine::MapGraph( GraphBase::Graph * aGraph , const char * aGraphName ) { + if ( MapGraph( aGraphName ) ) { + return false ; + } + _MapOfGraphs[ aGraphName ] = aGraph ; + return true ; +} + +void GraphExecutor::FiniteStateMachine::EraseGraph( const char * aGraphName ) { + _MapOfGraphs.erase( aGraphName ) ; +} + +bool GraphExecutor::FiniteStateMachine::GraphName( const char * aGraphName ) { + return _MapOfGraphNames[ aGraphName ] ; +} + +string GraphExecutor::FiniteStateMachine::GraphInstanceName( const char * aGraphName ) { + int GraphInstanceNumber = _MapOfGraphNames[ aGraphName ] ; + if ( GraphInstanceNumber ) { + _MapOfGraphNames[ aGraphName ] = GraphInstanceNumber + 1 ; + } + else { + GraphInstanceNumber = 0 ; + _MapOfGraphNames[ aGraphName ] = GraphInstanceNumber + 1 ; + } + string theGraphInstanceName = string( aGraphName ) ; + if ( GraphInstanceNumber ) { + theGraphInstanceName += "_" ; + ostringstream astr ; +// astr << GraphInstanceNumber << ends ; + astr << GraphInstanceNumber ; + theGraphInstanceName += astr.str() ; + } + //cout << "GraphExecutor::FiniteStateMachine::GraphInstanceName( " << aGraphName << " ) --> " + // << theGraphInstanceName << endl ; + return theGraphInstanceName ; +} + void GraphExecutor::FiniteStateMachine::JoinThread() { if ( pthread_mutex_lock( &_MutexJoinWait ) ) { perror("Join pthread_mutex_lock ") ; @@ -632,3 +680,112 @@ void GraphExecutor::FiniteStateMachine::JoinThread( pthread_t aThread ) { } } +ostream & operator<< (ostream &f ,const GraphExecutor::AutomatonState & aState ) { + switch (aState) { + case GraphExecutor::UnKnownState : + f << "UnKnownState"; + break; + case GraphExecutor::DataUndefState : + f << "DataUndefState"; + break; + case GraphExecutor::DataWaitingState : + f << "DataWaitingState"; + break; + case GraphExecutor::DataReadyState : + f << "DataReadyState"; + break; + case GraphExecutor::SuspendedReadyState : + f << "SuspendedReadyState"; + break; + case GraphExecutor::SuspendedReadyToResumeState : + f << "SuspendedReadyToResumeState"; + break; + case GraphExecutor::ResumedReadyState : + f << "ResumedReadyState"; + break; + case GraphExecutor::KilledReadyState : + f << "KilledReadyState"; + break; + case GraphExecutor::StoppedReadyState : + f << "StoppedReadyState"; + break; + case GraphExecutor::ExecutingState : + f << "ExecutingState"; + break; + case GraphExecutor::SuspendedExecutingState : + f << "SuspendedExecutingState"; + break; + case GraphExecutor::ResumedExecutingState : + f << "ResumedExecutingState"; + break; + case GraphExecutor::KilledExecutingState : + f << "KilledExecutingState"; + break; + case GraphExecutor::StoppedExecutingState : + f << "StoppedExecutingState"; + break; + case GraphExecutor::SuccessedExecutingState : + f << "SuccessedExecutingState"; + break; + case GraphExecutor::ErroredExecutingState : + f << "ErroredExecutingState"; + break; + case GraphExecutor::SuspendedSuccessedState : + f << "SuspendedSuccessedState"; + break; + case GraphExecutor::SuspendedErroredState : + f << "SuspendedErroredState"; + break; + case GraphExecutor::ResumedSuccessedState : + f << "ResumedSuccessedState"; + break; + case GraphExecutor::ResumedErroredState : + f << "ResumedErroredState"; + break; + case GraphExecutor::KilledSuccessedState : + f << "KilledSuccessedState"; + break; + case GraphExecutor::KilledErroredState : + f << "KilledErroredState"; + break; + case GraphExecutor::StoppedSuccessedState : + f << "StoppedSuccessedState"; + break; + case GraphExecutor::StoppedErroredState : + f << "StoppedErroredState"; + break; + case GraphExecutor::SuccessedState : + f << "SuccessedState"; + break; + case GraphExecutor::ErroredState : + f << "ErroredState"; + break; + case GraphExecutor::SuspendedState : + f << "SuspendedState"; + break; + case GraphExecutor::KilledState : + f << "KilledState"; + break; + case GraphExecutor::StoppedState : + f << "StoppedState"; + break; + case GraphExecutor::SuspendedSuccessedToReStartState : + f << "SuspendedSuccessedToReStartState"; + break; + case GraphExecutor::SuspendedErroredToReStartState : + f << "SuspendedErroredToReStartState"; + break; + case GraphExecutor::ReRunnedState : + f << "ReRunnedState"; + break; + case GraphExecutor::ReStartedState : + f << "ReStartedState"; + break; + default : + f << "GraphExecutor::AutomatonState_?"; + break; + } + + return f; +} + diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx index 2ce5d9d..4389c4a 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx @@ -45,8 +45,48 @@ //#include CORBA_SERVER_HEADER(SUPERV) #include +namespace GraphBase { + class Graph ; +} + namespace GraphExecutor { +//The AutomatonState is an internal state of the automaton of the Executor + enum AutomatonState { UnKnownState , + DataUndefState , + DataWaitingState , + DataReadyState , + SuspendedReadyState, + SuspendedReadyToResumeState , + ResumedReadyState , + KilledReadyState , + StoppedReadyState , + ExecutingState , + SuspendedExecutingState , + ResumedExecutingState , + KilledExecutingState , + StoppedExecutingState , + SuccessedExecutingState , + ErroredExecutingState , + SuspendedSuccessedState , + SuspendedErroredState, + ResumedSuccessedState , + ResumedErroredState , + KilledSuccessedState , + KilledErroredState , + StoppedSuccessedState , + StoppedErroredState , + SuccessedState , + ErroredState , + SuspendedState , + KilledState , + StoppedState , + SuspendedSuccessedToReStartState , + SuspendedErroredToReStartState , + ReRunnedState , + ReStartedState , + NumberOfAutomatonStates } ; + enum NodeEvent { UndefinedEvent , NewThreadEvent , SuspendEvent , ToResumeEvent , ResumeEvent , KillEvent , StopEvent , @@ -106,13 +146,13 @@ namespace GraphExecutor { private : char * _ControlStateName[ SUPERV::NumberOfControlStates ] ; - char * _StateName[ SUPERV::NumberOfAutomatonStates ] ; + char * _StateName[ GraphExecutor::NumberOfAutomatonStates ] ; char * _GraphStateName[ SUPERV::NumberOfGraphStates ] ; char * _EventName[ GraphExecutor::NumberOfEvents ] ; char * _ActionName[ NumberOfActions ] ; - SUPERV::AutomatonState _TransitionTable[ SUPERV::NumberOfAutomatonStates ] - [ GraphExecutor::NumberOfEvents ] ; - GraphExecutor::StateEventAction _ActionTable[ SUPERV::NumberOfAutomatonStates ] + GraphExecutor::AutomatonState _TransitionTable[ GraphExecutor::NumberOfAutomatonStates ] + [ GraphExecutor::NumberOfEvents ] ; + GraphExecutor::StateEventAction _ActionTable[ GraphExecutor::NumberOfAutomatonStates ] [ GraphExecutor::NumberOfEvents ] ; pthread_mutex_t _MutexPythonWait ; @@ -121,6 +161,10 @@ namespace GraphExecutor { int _ExecNumber ; int _GraphExecutingNumber ; + int _DbgFileNumber ; + map< string , GraphBase::Graph * > _MapOfGraphs ; + map< string , int > _MapOfGraphNames ; + bool _JoinThread ; pthread_t _JoinThreadNo ; pthread_mutex_t _MutexJoinWait ; @@ -140,12 +184,23 @@ namespace GraphExecutor { bool PyFunction( const char * aPyFuncName , PyObject * aPyFunction ) ; PyObject * PyFunction( const char * aPyFuncName ) ; + string DbgFileNumber() { + _DbgFileNumber += 1 ; + ostringstream astr ; + astr << _DbgFileNumber ; + return astr.str() ; } ; + GraphBase::Graph * MapGraph( const char * aGraphName ) ; + bool MapGraph( GraphBase::Graph * aGraph , const char * aGraphName ) ; + void EraseGraph( const char * aGraphName ) ; + bool GraphName( const char * aGraphName ) ; + string GraphInstanceName( const char * aGraphName ) ; + void JoinThread() ; void JoinThread( pthread_t aThread ) ; const char * ControlStateName( const SUPERV::ControlState & aState ) const { return _ControlStateName[ aState ] ; } ; - const char * StateName( const SUPERV::AutomatonState & aState ) const { + const char * StateName( const GraphExecutor::AutomatonState & aState ) const { return _StateName[ aState ] ; } ; const char * StateName( const SUPERV::GraphState & aState ) const { return _GraphStateName[ aState ] ; } ; @@ -154,15 +209,17 @@ namespace GraphExecutor { const char * ActionName( const GraphExecutor::StateEventAction & anAction ) const { return _ActionName[ anAction ] ; } ; - const SUPERV::AutomatonState NextState( const SUPERV::AutomatonState & aState , - const GraphExecutor::NodeEvent & anEvent ) const { + const GraphExecutor::AutomatonState NextState( const GraphExecutor::AutomatonState & aState , + const GraphExecutor::NodeEvent & anEvent ) const { return _TransitionTable[ aState ][ anEvent ] ; } ; - const GraphExecutor::StateEventAction NextAction( const SUPERV::AutomatonState & aState , + const GraphExecutor::StateEventAction NextAction( const GraphExecutor::AutomatonState & aState , const GraphExecutor::NodeEvent & anEvent ) const { return _ActionTable[ aState ][ anEvent ] ; } ; }; }; +ostream & operator<< (ostream &f ,const GraphExecutor::AutomatonState & aState ) ; + #endif diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index 76ff07f..213e0ff 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -51,7 +51,7 @@ using namespace std; static void InitInNode( int &_RewindStack , SUPERV::ControlState &_ControlState , - SUPERV::AutomatonState &_currentState , + GraphExecutor::AutomatonState &_currentState , GraphExecutor::InNode ** _aReStartNode , bool & _PyFuncRunned , PyObject ** _MyPyRunMethod , @@ -77,7 +77,7 @@ static void InitInNode( int &_RewindStack , CORBA::ORB_ptr ORB ) { _RewindStack = 0 ; _ControlState = SUPERV::VoidState ; - _currentState = SUPERV::UnKnownState ; + _currentState = GraphExecutor::UnKnownState ; *_aReStartNode = NULL ; _PyFuncRunned = false ; *_MyPyRunMethod = NULL ; @@ -267,6 +267,22 @@ GraphExecutor::InNode::InNode( CORBA::ORB_ptr ORB, _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ; break ; } + case SUPERV::MacroNode : { + cdebug << "GraphExecutor::InNode::InNode SUPERV::MacroNode : " << NodeName << endl ; + _GraphMacroNode = new GraphBase::Graph( ORB , ptrNamingService , +// aFuncName[0].c_str() , *aPythonFunction[0] , + NodeName , akind , +// NodeFirstCreation , NodeLastModification , +// NodeEditorRelease , NodeAuthor , +// NodeComment , GeneratedName , +// NodeX , NodeY , + Graph_prof_debug , Graph_fdebug ) ; + _ComputingNode = (GraphBase::ComputingNode *) _GraphMacroNode ; + _InLineNode = (GraphBase::InLineNode *) _ComputingNode ; + _GOTONode = (GraphBase::GOTONode *) _InLineNode ; + _GraphMacroNode->Coordinates( NodeX , NodeY ) ; + break ; + } case SUPERV::GOTONode : { cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName ; _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService , @@ -410,14 +426,14 @@ bool GraphExecutor::InNode::Ping() { if ( IsFactoryNode() ) { RetVal = !CORBA::is_nil( _FactoryNode->Component() ) ; if ( RetVal ) { - if ( State() != SUPERV::SuspendedExecutingState ) { + if ( State() != GraphExecutor::SuspendedExecutingState ) { try { _FactoryNode->Component()->ping() ; } catch( ... ) { cdebug << "InNode::Ping() catched" << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; RetVal = false ; } } @@ -464,8 +480,8 @@ bool GraphExecutor::InNode::Suspend() { } catch( ... ) { cdebug << "InNode::Suspend() catched" << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; RetVal = false ; } if ( RetVal ) { @@ -546,8 +562,8 @@ bool GraphExecutor::InNode::Kill() { } catch( ... ) { cdebug << "InNode::Suspend() catched" << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; RetVal = false ; } cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ; @@ -651,8 +667,8 @@ bool GraphExecutor::InNode::Stop() { } catch( ... ) { cdebug << "InNode::Stop() catched" << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; RetVal = false ; } if ( RetVal ) { @@ -722,28 +738,28 @@ bool GraphExecutor::InNode::Resume() { << Automaton()->StateName( State() ) << endl; bool RetVal = false ; if ( IsSuspended() ) { - if ( State() == SUPERV::SuspendedReadyState ) { + if ( State() == GraphExecutor::SuspendedReadyState ) { ResumeAction( GraphExecutor::ToResumeEvent ) ; RetVal = true ; } - else if ( State() == SUPERV::SuspendedExecutingState ) { + else if ( State() == GraphExecutor::SuspendedExecutingState ) { if ( IsFactoryNode() || IsComputingNode() ) { try { RetVal = Component()->Resume_impl() ; } catch( ... ) { cdebug << "InNode::Resume() catched" << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; RetVal = false ; } } } - else if ( State() == SUPERV::SuspendedSuccessedState ) { + else if ( State() == GraphExecutor::SuspendedSuccessedState ) { ResumeAction( GraphExecutor::ResumeEvent ) ; RetVal = true ; } - else if ( State() == SUPERV::SuspendedErroredState ) { + else if ( State() == GraphExecutor::SuspendedErroredState ) { ResumeAction( GraphExecutor::ResumeEvent ) ; RetVal = true ; } @@ -765,13 +781,13 @@ bool GraphExecutor::InNode::Resume() { #if 0 if ( ControlState() == SUPERV::ToSuspendRunState || ( ControlState() == SUPERV::ToSuspendState && - State() == SUPERV::SuspendedReadyState) ) { + State() == GraphExecutor::SuspendedReadyState) ) { if ( IsSuspended() ) { - if ( State() == SUPERV::SuspendedReadyState ) { + if ( State() == GraphExecutor::SuspendedReadyState ) { ResumeAction() ; RetVal = true ; } - else if ( State() == SUPERV::SuspendedExecutingState ) { + else if ( State() == GraphExecutor::SuspendedExecutingState ) { ResumeAction() ; RetVal = Component()->Resume_impl() ; } @@ -797,13 +813,13 @@ bool GraphExecutor::InNode::Resume() { } else if ( ControlState() == SUPERV::ToSuspendDoneState || ( ControlState() == SUPERV::ToSuspendState && - State() == SUPERV::SuspendedSuccessedState) ) { + State() == GraphExecutor::SuspendedSuccessedState) ) { if ( IsSuspended() ) { - if ( State() == SUPERV::SuspendedSuccessedState ) { + if ( State() == GraphExecutor::SuspendedSuccessedState ) { ResumeAction() ; RetVal = true ; } - else if ( State() == SUPERV::SuspendedErroredState ) { + else if ( State() == GraphExecutor::SuspendedErroredState ) { ResumeAction() ; RetVal = true ; } @@ -849,7 +865,7 @@ bool GraphExecutor::InNode::ReStart( const char * AtNodeName , } else if ( IsSuspended() ) { if ( strcmp( AtNodeName , Name() ) ) { - aRestartNode->State( SUPERV::SuspendedSuccessedState ) ; + aRestartNode->State( GraphExecutor::SuspendedSuccessedState ) ; } if ( AndSuspend ) { ReStartAction( aRestartNode , GraphExecutor::ReStartAndSuspendEvent ) ; @@ -866,14 +882,14 @@ bool GraphExecutor::InNode::ReStart( const char * AtNodeName , bool GraphExecutor::InNode::IsWaiting() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsWaiting " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::DataUndefState || - aState == SUPERV::DataWaitingState || - aState == SUPERV::SuspendedReadyState ) -// aState == SUPERV::SuspendedExecutingState || -// aState == SUPERV::SuspendedSuccessedState || -// aState == SUPERV::SuspendedErroredState || -// aState == SUPERV::SuspendedState + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::DataUndefState || + aState == GraphExecutor::DataWaitingState || + aState == GraphExecutor::SuspendedReadyState ) +// aState == GraphExecutor::SuspendedExecutingState || +// aState == GraphExecutor::SuspendedSuccessedState || +// aState == GraphExecutor::SuspendedErroredState || +// aState == GraphExecutor::SuspendedState aret = true ; // cdebug_out << "GraphExecutor::InNode::IsWaiting" << endl ; return aret ; @@ -882,11 +898,11 @@ bool GraphExecutor::InNode::IsWaiting() { bool GraphExecutor::InNode::IsReady() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsReady " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::DataUndefState || - aState == SUPERV::DataWaitingState || - aState == SUPERV::DataReadyState || - aState == SUPERV::ResumedReadyState ) + GraphExecutor::AutomatonState aState = State() ; +// if ( aState == GraphExecutor::DataUndefState || +// aState == GraphExecutor::DataWaitingState || + if ( aState == GraphExecutor::DataReadyState || + aState == GraphExecutor::ResumedReadyState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsReady" << endl ; return aret ; @@ -895,9 +911,9 @@ bool GraphExecutor::InNode::IsReady() { bool GraphExecutor::InNode::IsRunning() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsRunning " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::ExecutingState || - aState == SUPERV::ResumedExecutingState ) + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::ExecutingState || + aState == GraphExecutor::ResumedExecutingState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsRunning" << endl ; return aret ; @@ -906,21 +922,21 @@ bool GraphExecutor::InNode::IsRunning() { bool GraphExecutor::InNode::IsDone() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsDone " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::KilledReadyState || - aState == SUPERV::StoppedReadyState || - aState == SUPERV::KilledExecutingState || - aState == SUPERV::StoppedExecutingState || - aState == SUPERV::SuspendedSuccessedState || - aState == SUPERV::SuspendedErroredState || -// aState == SUPERV::SuccessedExecutingState || -// aState == SUPERV::ErroredExecutingState || - aState == SUPERV::SuccessedState || - aState == SUPERV::ErroredState || - aState == SUPERV::ResumedSuccessedState || - aState == SUPERV::ResumedErroredState || - aState == SUPERV::KilledSuccessedState || - aState == SUPERV::StoppedSuccessedState ) + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::KilledReadyState || + aState == GraphExecutor::StoppedReadyState || + aState == GraphExecutor::KilledExecutingState || + aState == GraphExecutor::StoppedExecutingState || + aState == GraphExecutor::SuspendedSuccessedState || + aState == GraphExecutor::SuspendedErroredState || +// aState == GraphExecutor::SuccessedExecutingState || +// aState == GraphExecutor::ErroredExecutingState || + aState == GraphExecutor::SuccessedState || + aState == GraphExecutor::ErroredState || + aState == GraphExecutor::ResumedSuccessedState || + aState == GraphExecutor::ResumedErroredState || + aState == GraphExecutor::KilledSuccessedState || + aState == GraphExecutor::StoppedSuccessedState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsDone" << endl ; return aret ; @@ -929,11 +945,11 @@ bool GraphExecutor::InNode::IsDone() { bool GraphExecutor::InNode::IsSuspended() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsSuspended " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::SuspendedReadyState || - aState == SUPERV::SuspendedExecutingState || - aState == SUPERV::SuspendedSuccessedState || - aState == SUPERV::SuspendedErroredState ) + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::SuspendedReadyState || + aState == GraphExecutor::SuspendedExecutingState || + aState == GraphExecutor::SuspendedSuccessedState || + aState == GraphExecutor::SuspendedErroredState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsSuspended" << endl ; return aret ; @@ -941,12 +957,12 @@ bool GraphExecutor::InNode::IsSuspended() { bool GraphExecutor::InNode::IsKilled() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsKilled " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::KilledReadyState || - aState == SUPERV::KilledExecutingState || - aState == SUPERV::KilledSuccessedState || - aState == SUPERV::KilledErroredState || - aState == SUPERV::KilledState ) + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::KilledReadyState || + aState == GraphExecutor::KilledExecutingState || + aState == GraphExecutor::KilledSuccessedState || + aState == GraphExecutor::KilledErroredState || + aState == GraphExecutor::KilledState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsKilled" << endl ; return aret ; @@ -954,12 +970,12 @@ bool GraphExecutor::InNode::IsKilled() { bool GraphExecutor::InNode::IsStopped() { bool aret = false ; // cdebug_in << "GraphExecutor::InNode::IsStopped " << Name() << endl; - SUPERV::AutomatonState aState = State() ; - if ( aState == SUPERV::StoppedReadyState || - aState == SUPERV::StoppedExecutingState || - aState == SUPERV::StoppedSuccessedState || - aState == SUPERV::StoppedErroredState || - aState == SUPERV::StoppedState ) + GraphExecutor::AutomatonState aState = State() ; + if ( aState == GraphExecutor::StoppedReadyState || + aState == GraphExecutor::StoppedExecutingState || + aState == GraphExecutor::StoppedSuccessedState || + aState == GraphExecutor::StoppedErroredState || + aState == GraphExecutor::StoppedState ) aret = true ; // cdebug_out << "GraphExecutor::InNode::IsStopped" << endl ; return aret ; @@ -1045,7 +1061,7 @@ bool GraphExecutor::InNode::StateWait( SUPERV::GraphState aState ) { break ; } default : { - cdebug << " GraphExecutor::OutNode::StateWait Error Undefined State : " + cdebug << " SUPERV::OutNode::StateWait Error Undefined State : " << aState << endl ; } } @@ -1158,12 +1174,17 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) << " with state " << theAutomaton->StateName( anOutPort->State() ) << endl ; GetChangeNodeInPort(i)->State( anOutPort->State() ) ; } - else { + else if ( anOutPort->IsDataConnected() ) { cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort " << anOutPort->PortName() << " from Node " << anOutPort->NodeName() << " with state ReadyState" << endl ; GetChangeNodeInPort(i)->State( SUPERV::ReadyState ) ; } + else { + cdebug << "InPort" << i << " state NOT changed : " << anInPort->PortName() << " from OutPort " + << anOutPort->PortName() << " " << anOutPort->PortStatus() << " from Node " << anOutPort->NodeName() + << " with state " << anOutPort->State() << endl ; + } } if ( anOutPort ) { cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort " @@ -1184,8 +1205,8 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) } } - _currentState = Pc > 0 ? SUPERV::DataWaitingState - : SUPERV::DataReadyState ; + _currentState = Pc > 0 ? GraphExecutor::DataWaitingState + : GraphExecutor::DataReadyState ; if ( Pc == GetNodeInPortsSize() ) { _OutNode->PushEvent( this , GraphExecutor::NoDataReadyEvent , _currentState ) ; @@ -1304,8 +1325,8 @@ const long GraphExecutor::InNode::CpuUsed( bool tot ) { } catch ( ... ) { cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " << endl ; - State( SUPERV::ErroredState ) ; - _OutNode->State( SUPERV::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; + _OutNode->State( GraphExecutor::ErroredState ) ; cpu = 0 ; } } diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.hxx b/src/GraphExecutor/DataFlowExecutor_InNode.hxx index 9eb952c..ca7ec68 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.hxx @@ -33,6 +33,7 @@ #include +#include "DataFlowBase_Graph.hxx" #include "DataFlowBase_FactoryNode.hxx" #include "DataFlowBase_GOTONode.hxx" #include "DataFlowBase_LoopNode.hxx" @@ -72,17 +73,18 @@ namespace GraphExecutor { GraphBase::EndOfLoopNode * _EndOfLoopNode ; GraphBase::SwitchNode * _SwitchNode ; GraphBase::EndOfSwitchNode * _EndOfSwitchNode ; + GraphBase::Graph * _GraphMacroNode ; PyObject * _MyPyRunMethod ; bool _createNewThread ; bool _createNewThreadIf ; int _RewindStack ; - SUPERV::AutomatonState _OldState ; - SUPERV::AutomatonState _currentState ; + GraphExecutor::AutomatonState _OldState ; + GraphExecutor::AutomatonState _currentState ; GraphExecutor::NodeEvent _CurrentEvent ; SUPERV::ControlState _ControlState ; - SUPERV::AutomatonState _NextState ; + GraphExecutor::AutomatonState _NextState ; GraphExecutor::StateEventAction _NextAction ; bool _PyFuncRunned ; @@ -168,8 +170,12 @@ namespace GraphExecutor { return _ComputingNode->IsOneOfInLineNodes() ; } ; const bool IsOneOfGOTONodes() const { return _ComputingNode->IsOneOfGOTONodes() ; } ; + const bool IsMacroNode() const { + return _ComputingNode->IsMacroNode() ; } ; const bool IsDataFlowNode() const { return _ComputingNode->IsDataFlowNode() ; } ; + const bool IsDataStreamNode() const { + return _ComputingNode->IsDataStreamNode() ; } ; const bool IsLoopNode() const { return _ComputingNode->IsLoopNode() ; } ; const bool IsEndLoopNode() const { @@ -207,6 +213,16 @@ namespace GraphExecutor { } ; GraphBase::LoopNode * LoopNode() { return _LoopNode ; } ; + GraphBase::Graph * GraphMacroNode() { + return _GraphMacroNode ; } ; + + SUPERV::CNode_var ObjRef() const { return _ComputingNode->ObjRef() ; } ; + void SetObjRef( SUPERV::CNode_var aNode ) { + _ComputingNode->SetObjRef( aNode ) ; } ; + + Graph_Impl * ObjImpl() const { return _GraphMacroNode->ObjImpl() ; } ; + void SetObjImpl( Graph_Impl * aGraph ) { + _GraphMacroNode->SetObjImpl( aGraph ) ; } ; Engines::Component_var Component() const ; Engines::Container_var Container() const ; @@ -328,9 +344,9 @@ namespace GraphExecutor { void RewindStack( int aRewindStack ) { _RewindStack = aRewindStack ; } ; int RewindStack() const { return _RewindStack ; } ; - SUPERV::AutomatonState State() const { + GraphExecutor::AutomatonState State() const { return _currentState; }; - void State(SUPERV::AutomatonState aState ) { + void State(GraphExecutor::AutomatonState aState ) { // cdebug << "GraphExecutor::InNode::State( " // << Automaton()->StateName( _currentState ) << " --> " // << Automaton()->StateName( aState ) << " )" << endl ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index b8a9eda..835c0e1 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -33,6 +33,19 @@ using namespace std; #include #include +#if defined __GNUC__ + #if __GNUC__ == 2 + #define __GNUC_2__ + #endif +#endif + +#if defined __GNUC_2__ +// _CS_gbo_040604 include explicite pour l'utilisation de +// std::transform dans UpperCase +#include // for toupper +#include // for transform +#endif + #include "Python.h" #include "OpUtil.hxx" @@ -43,12 +56,20 @@ using namespace std; //#include "StreamGraph_Impl.hxx" -#include "DataFlowExecutor_OutNode.hxx" +//#include "DataFlowExecutor_OutNode.hxx" +#include "DataFlowExecutor_DataFlow.hxx" static void UpperCase(std::string& rstr) { - std::transform(rstr.begin(), rstr.end(), rstr.begin(), towupper); +#if defined __GNUC_2__ + // _CS_gbo_040604 towupper n'existe pas. Utilisation de toupper. Par + // ailleurs, include explicite de cctype et algorithm pour toupper + // et transform respectivement. + std::transform(rstr.begin(), rstr.end(), rstr.begin(),toupper); +#else + std::transform(rstr.begin(), rstr.end(), rstr.begin(),towupper); +#endif } @@ -74,8 +95,8 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { } // State( _NextState ) ; -// if ( _OldState == SUPERV::SuccessedExecutingState || -// _OldState == SUPERV::ErroredExecutingState ) { +// if ( _OldState == GraphExecutor::SuccessedExecutingState || +// _OldState == GraphExecutor::ErroredExecutingState ) { // DoneAction() ; // } @@ -90,7 +111,7 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { << " _RewindStack " << _RewindStack << endl ; #if 0 - cout << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name() + //cout << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name() << endl << " ControlState : " << Automaton()->ControlStateName( ControlState() ) << endl << " OldState : " << Automaton()->StateName( _OldState ) << endl @@ -512,7 +533,7 @@ int GraphExecutor::InNode::executeAction() { pthread_t T; int pthread_sts = 1 ; // _OutNode->PushEvent( NULL , GraphExecutor::NewThreadEvent , -// SUPERV::ExecutingState ) ; +// GraphExecutor::ExecutingState ) ; while ( (pthread_sts = pthread_create(&T, NULL, run_function, this )) ) { char * msg = "Cannot pthread_create " ; perror( msg ) ; @@ -543,7 +564,7 @@ int GraphExecutor::InNode::executeAction() { << Automaton()->StateName( State() ) << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ") ReStartAction ==>" << endl; - State( SUPERV::SuspendedSuccessedState ) ; + State( GraphExecutor::SuspendedSuccessedState ) ; if ( !ReStartAction( this , GraphExecutor::ReStartEvent ) ) { cdebug << pthread_self() << "/" << ThreadNo() << " executeAction STATE & CALLED " @@ -790,6 +811,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " ControlPort inactive." << endl ; } +// That InPort get its value from an other node else if ( strcmp( DataFromNode() , anOutPort->NodeName() ) ) { if ( anInPort->State() == SUPERV::ReadyState ) { InReady += 1 ; @@ -855,6 +877,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { << LoopBeginning << endl ; } } +// That InPort get its value from the sending node else if ( anInPort->IsGate() ) { const CORBA::Any * theValue = anOutPort->Value() ; long GateOpened ; @@ -899,21 +922,34 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { cdebug << endl ; } } - else { + else if ( anOutPort->Done() ) { InReady += 1 ; anInPort->State( SUPERV::ReadyState ) ; cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " - << anInPort->PortName() << " is Done from " - << anOutPort->NodeName() << " " << anOutPort->PortName() << " " ; + << anInPort->PortName() << " " << anInPort->PortStatus() << " is Done from " + << anOutPort->NodeName() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << " " ; #ifdef _DEBUG_ - if ( GraphBase::Base::_prof_debug ) { - anOutPort->StringValue( *GraphBase::Base::_fdebug ) ; - } + if ( GraphBase::Base::_prof_debug ) { + anOutPort->StringValue( *GraphBase::Base::_fdebug ) ; + } #endif - cdebug << endl ; + cdebug << endl ; +// MacroNode : give immediately the value to the corresponding graph + if ( IsMacroNode() ) { + GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphExecutor() ; + cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Graph()->Name() << " --> InputOfAny " + << InReady << "/" << GetNodeInPortsSize() << " InPorts are Ready" << endl ; +// GraphMacroNode()->MacroObject()->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; + aMacroGraph->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; + } + } + else { + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " + << anInPort->PortName() << " " << anInPort->PortStatus() << " is NOT Done from " + << anOutPort->NodeName() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << " " ; } } - + if ( InReady == GetNodeInPortsSize() ) { // All Flags != 0 : res = SendEvent( GraphExecutor::AllDataReadyEvent ); // ==> Ready to execute } @@ -940,7 +976,7 @@ int GraphExecutor::InNode::DataUndef_AllDataReadyAction() { // << " CreateNewThreadIf " << CreateNewThreadIf() << " IsLockedDataWait " // << IsLockedDataWait() ; if ( IsLockedDataWait() ) { -// cdebug << " WOULD DEAD-LOCK" << endl ; + cdebug << "DataUndef_AllDataReadyAction() WOULD DEAD-LOCK" << endl ; return 0 ; // ==> DataUndef_AllDataReadyAction() after UnLockDataWait() } // cdebug << endl ; @@ -950,7 +986,7 @@ int GraphExecutor::InNode::DataUndef_AllDataReadyAction() { ThreadNo( pthread_self() ) ; } _OutNode->PushEvent( this , GraphExecutor::AllDataReadyEvent , - SUPERV::DataReadyState ) ; + GraphExecutor::DataReadyState ) ; ReadyAction() ; SUPERV::ControlState aControl = ControlState() ; switch ( aControl ) { @@ -1000,7 +1036,7 @@ int GraphExecutor::InNode::DataReady_SuspendAction() { << " Threads " << _OutNode->Threads() << " SuspendedThreads " << _OutNode->SuspendedThreads() << endl; _OutNode->PushEvent( this , GraphExecutor::SuspendedReadyEvent , - SUPERV::SuspendedReadyState ) ; + GraphExecutor::SuspendedReadyState ) ; GraphExecutor::InNode * aReStartNode = SuspendAction() ; cdebug << pthread_self() << "/" << ThreadNo() << "DataReady_SuspendAction Resumed " << Name() << endl; @@ -1019,13 +1055,13 @@ int GraphExecutor::InNode::SuspendedReady_ResumeAction() { << Name() << endl; // ResumeAction() ; _OutNode->PushEvent( this , GraphExecutor::ResumedReadyEvent , - SUPERV::ResumedReadyState ) ; + GraphExecutor::ResumedReadyState ) ; return 1 ; } int GraphExecutor::InNode::DataReady_KillAction() { _OutNode->PushEvent( this , GraphExecutor::KilledReadyEvent , - SUPERV::KilledReadyState ) ; + GraphExecutor::KilledReadyState ) ; KillAction() ; cdebug << pthread_self() << "/" << ThreadNo() << "DataReady_KillAction " << Name() << " will pthread_exit()" << endl; @@ -1034,7 +1070,7 @@ int GraphExecutor::InNode::DataReady_KillAction() { int GraphExecutor::InNode::DataReady_StopAction() { _OutNode->PushEvent( this , GraphExecutor::StoppedReadyEvent , - SUPERV::StoppedReadyState ) ; + GraphExecutor::StoppedReadyState ) ; StopAction() ; cdebug << pthread_self() << "/" << ThreadNo() << "DataReady_StopAction " << Name() << " will pthread_exit()" << endl; @@ -1049,63 +1085,71 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // cdebug << pthread_self() << "/" << ThreadNo() << " --> DataReady_ExecuteAction " // << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ExecuteEvent , - SUPERV::ExecutingState ) ; + GraphExecutor::ExecutingState ) ; RunningAction() ; + + bool Err = false ; + SUPERV::GraphState PortState = SUPERV::ReadyState ; - SUPERV::AutomatonState NewState = SUPERV::DataUndefState ; + GraphExecutor::AutomatonState NewState = GraphExecutor::DataUndefState ; GraphExecutor::NodeEvent NewEvent = GraphExecutor::UndefinedEvent ; - bool Err = false ; + int nInParams ; + ServicesAnyData * InParametersList ; + int nOutParams ; + ServicesAnyData * OutParametersList ; - int nInParams = GetNodeInPortsSize() ; - ServicesAnyData * InParametersList = new ServicesAnyData[nInParams]; + nInParams = GetNodeInPortsSize() ; + InParametersList = new ServicesAnyData[nInParams]; InParametersSet( Err , nInParams , InParametersList ) ; - Engines::Container_var myContainer ; - Engines::Component_var myObjComponent ; - if ( !IsFactoryNode() ) { -// cdebug << ThreadNo() << "No Component : NO StartComponent & No Ping" << endl ; - if ( IsComputingNode() ) { - ObjInterface( true ) ; - CORBA::Object_ptr obj ; - InParametersList[0].Value >>= obj ; - CORBA::Object_var objvar = CORBA::Object_var( obj ) ; - myObjComponent = Engines::Component::_narrow( objvar ) ; - } - else { + nOutParams = GetNodeOutPortsSize() ; + OutParametersList = new ServicesAnyData[nOutParams]; + InOutParametersSet( nOutParams , OutParametersList ) ; + + if ( !IsMacroNode() ) { + + Engines::Container_var myContainer ; + Engines::Component_var myObjComponent ; + if ( !IsFactoryNode() ) { +// cdebug << ThreadNo() << "No Component : NO StartComponent & No Ping" << endl ; + if ( IsComputingNode() ) { + ObjInterface( true ) ; + CORBA::Object_ptr obj ; + InParametersList[0].Value >>= obj ; + CORBA::Object_var objvar = CORBA::Object_var( obj ) ; + myObjComponent = Engines::Component::_narrow( objvar ) ; + } + else { + } } - } - else if ( CORBA::is_nil( Component() ) ) { - ostringstream astr ; - astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() - << " : load of component " << ComponentName() << " in container " - << Computer() ; -// _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; - Err = !_OutNode->Graph()->StartComponent( ThreadNo() , Computer() , - my_strdup( ComponentName() ) , - myContainer , myObjComponent ) ; - ObjInterface( false ) ; - SetContainer( myContainer ) ; - SetComponent( myObjComponent ) ; - } - else { - myContainer = Container() ; - myObjComponent = Component() ; -// cdebug << ThreadNo() << "Component known : NO StartComponent & Ping" -// << endl ; - try { - myObjComponent->ping() ; + else if ( CORBA::is_nil( Component() ) ) { +// ostringstream astr ; +// astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() +// << " : load of component " << ComponentName() << " in container " +// << Computer() ; +// _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + Err = !_OutNode->Graph()->StartComponent( ThreadNo() , Computer() , + my_strdup( ComponentName() ) , + myContainer , myObjComponent ) ; + ObjInterface( false ) ; + SetContainer( myContainer ) ; + SetComponent( myObjComponent ) ; } - catch( ... ) { - cdebug << "ping() catched" << endl ; - Err = true ; + else { + myContainer = Container() ; + myObjComponent = Component() ; +// cdebug << ThreadNo() << "Component known : NO StartComponent & Ping" +// << endl ; + try { + myObjComponent->ping() ; + } + catch( ... ) { + cdebug << "ping() catched" << endl ; + Err = true ; + } } - } - - int nOutParams = GetNodeOutPortsSize() ; - ServicesAnyData * OutParametersList = new ServicesAnyData[nOutParams]; - InOutParametersSet( nOutParams , OutParametersList ) ; if ( Err || ControlState() == SUPERV::ToKillState || ControlState() == SUPERV::ToKillDoneState || @@ -1115,8 +1159,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } else { if ( !Err ) { - ostringstream astr ; - astr << "Graph " << _OutNode->Graph()->Name() << " Run of Node " << Name() ; +// ostringstream astr ; +// astr << "Graph " << _OutNode->Graph()->Name() << " Run of Node " << Name() ; // _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; cdebug << ThreadNo() << " Run( '" << ServiceName() << "'" ; for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) { @@ -1432,46 +1476,81 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } } } -// } + } // else { // sleep( 1 ) ; // } - ostringstream astr ; - astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() << " is done : " - << Automaton()->StateName( State() ) ; +// ostringstream astr ; +// astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() << " is done : " +// << Automaton()->StateName( State() ) ; // _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; if ( Err ) { if ( ControlState() == SUPERV::ToKillState || ControlState() == SUPERV::ToKillDoneState || ControlState() == SUPERV::ToStopState ) { PortState = SUPERV::ErrorState ; - NewState = SUPERV::KilledState ; + NewState = GraphExecutor::KilledState ; NewEvent = GraphExecutor::KillEvent ; } else { PortState = SUPERV::ErrorState ; - NewState = SUPERV::ErroredState ; + NewState = GraphExecutor::ErroredState ; NewEvent = GraphExecutor::ErrorEvent ; } } else { PortState = SUPERV::ReadyState ; - NewState = SUPERV::DataReadyState ; + NewState = GraphExecutor::DataReadyState ; NewEvent = GraphExecutor::SuccessEvent ; } - bool ErrOut = OutParametersSet( Err , PortState , nOutParams , OutParametersList ) ; - - if ( !ErrOut ) { - NewEvent = GraphExecutor::ErrorEvent ; + if ( !IsMacroNode() ) { + bool ErrOut = OutParametersSet( Err , PortState , nOutParams , OutParametersList ) ; + if ( !ErrOut ) { + NewEvent = GraphExecutor::ErrorEvent ; + } + delete [] InParametersList ; + delete [] OutParametersList ; } - delete [] InParametersList ; - delete [] OutParametersList ; - - - SendEvent( NewEvent ); + if ( !IsMacroNode() ) { + SendEvent( NewEvent ) ; + } + else { + GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphExecutor() ; + cdebug << ThreadNo() << " DataReady_ExecuteAction " << aMacroGraph->Graph()->Name() << " ->DoneWait()" + << " State " << aMacroGraph->State() << endl; + aMacroGraph->DoneWait() ; + cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State " << aMacroGraph->State() << endl; + if ( aMacroGraph->State() == SUPERV::DoneState ) { + PortState = SUPERV::ReadyState ; + NewState = GraphExecutor::DataReadyState ; + NewEvent = GraphExecutor::SuccessEvent ; + } + else { + Err = true ; + if ( ControlState() == SUPERV::ToKillState || + ControlState() == SUPERV::ToKillDoneState || + ControlState() == SUPERV::ToStopState ) { + PortState = SUPERV::ErrorState ; + NewState = GraphExecutor::KilledState ; + NewEvent = GraphExecutor::KillEvent ; + } + else { + PortState = SUPERV::ErrorState ; + NewState = GraphExecutor::ErroredState ; + NewEvent = GraphExecutor::ErrorEvent ; + } + } + bool ErrOut = OutParametersSet( Err , PortState , nOutParams , OutParametersList ) ; + if ( !ErrOut ) { + NewEvent = GraphExecutor::ErrorEvent ; + } + delete [] InParametersList ; + delete [] OutParametersList ; + SendEvent( NewEvent ) ; + } // cdebug << ThreadNo() << " <-- DataReady_ExecuteAction " << Name() << endl; return 1 ; @@ -1479,14 +1558,14 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { int GraphExecutor::InNode::Executing_SuspendAction() { _OutNode->PushEvent( this , GraphExecutor::SuspendedExecutingEvent , - SUPERV::SuspendedExecutingState ) ; + GraphExecutor::SuspendedExecutingState ) ; cdebug << ThreadNo() << " Executing_SuspendAction " << Name() << endl; return 1 ; } int GraphExecutor::InNode::SuspendedExecuting_ResumeAction() { cdebug << ThreadNo() << " SuspendedExecuting_ResumeAction " << Name() << endl; - SUPERV::AutomatonState next_state ; + GraphExecutor::AutomatonState next_state ; next_state = Automaton()->NextState( State() , GraphExecutor::ExecutingEvent ) ; _OutNode->NewThread() ; // Only for Threads count _OutNode->PushEvent( this , GraphExecutor::ResumedExecutingEvent , @@ -1502,7 +1581,7 @@ int GraphExecutor::InNode::Executing_KillAction() { cdebug << "Executing_KillAction would pthread_canceled itself" << endl ; KillAction() ; _OutNode->PushEvent( this , GraphExecutor::KilledExecutingEvent , - SUPERV::KilledExecutingState ) ; + GraphExecutor::KilledExecutingState ) ; RetVal = 1 ; } else if ( pthread_cancel( ThreadNo() ) ) { @@ -1514,7 +1593,7 @@ int GraphExecutor::InNode::Executing_KillAction() { KillAction() ; _OutNode->ExitThread() ; _OutNode->PushEvent( this , GraphExecutor::KilledExecutingEvent , - SUPERV::KilledExecutingState ) ; + GraphExecutor::KilledExecutingState ) ; } return RetVal ; } @@ -1531,7 +1610,7 @@ int GraphExecutor::InNode::Executing_StopAction() { StopAction() ; _OutNode->ExitThread() ; _OutNode->PushEvent( this , GraphExecutor::StoppedExecutingEvent , - SUPERV::StoppedExecutingState ) ; + GraphExecutor::StoppedExecutingState ) ; } return RetVal ; } @@ -1539,7 +1618,7 @@ int GraphExecutor::InNode::Executing_StopAction() { int GraphExecutor::InNode::Executing_SuccessAction() { // cdebug << ThreadNo() << " --> Executing_SuccessAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::SuccessedExecutingEvent , - SUPERV::SuccessedState ) ; + GraphExecutor::SuccessedState ) ; SUPERV::ControlState aControl = ControlState() ; switch ( aControl ) { case SUPERV::VoidState : { @@ -1580,7 +1659,7 @@ int GraphExecutor::InNode::Executing_SuccessAction() { int GraphExecutor::InNode::Executing_ErrorAction() { cdebug << ThreadNo() << " --> Executing_ErrorAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ErroredExecutingEvent , - SUPERV::ErroredState ) ; + GraphExecutor::ErroredState ) ; SUPERV::ControlState aControl = ControlState() ; switch ( aControl ) { @@ -1624,7 +1703,7 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { int i ; int j ; bool docdebug = false ; - State( SUPERV::DataWaitingState ) ; + State( GraphExecutor::DataWaitingState ) ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { GraphBase::InPort * anInPort = GetChangeNodeInPort( i ) ; if ( anInPort->IsGate() ) { // Loop : Open the doors @@ -1638,8 +1717,8 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { } else if ( anInPort->State() != SUPERV::WaitingState ) { if ( !docdebug ) { -// cdebug << ThreadNo() -// << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl; + cdebug << ThreadNo() + << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl; docdebug = true ; } if ( !anInPort->IsDataStream() ) { @@ -1654,12 +1733,14 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { !( IsEndLoopNode() && ( anOutPort->IsGate() || anOutPort->IsLoop() ) ) && !anOutPort->IsDataStream() && - !anOutPort->ChangeInPorts( j )->IsDataStream() ) { -// cdebug << ThreadNo() -// << " GraphExecutor::InNodeThreads::SetWaitingStates " -// << Name() << "( " << anOutPort->PortName() << " ) --> InPort " -// << anOutPort->ChangeInPorts( j )->PortName() << " from Node " -// << anOutPort->ChangeInPorts( j )->NodeName() << endl; + !anOutPort->ChangeInPorts( j )->IsDataStream() && + !anOutPort->ChangeInPorts( j )->IsExternConnected() ) { + cdebug << ThreadNo() + << " GraphExecutor::InNodeThreads::SetWaitingStates " + << Name() << "( " << anOutPort->PortName() << " " << anOutPort->PortStatus() << " ) --> InPort " + << anOutPort->ChangeInPorts( j )->PortName() << " " + << anOutPort->ChangeInPorts( j )->PortStatus() << " from Node " + << anOutPort->ChangeInPorts( j )->NodeName() << endl; GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ; if ( aNode != EndNode ) { aNode->SetWaitingStates( EndNode ) ; @@ -1670,7 +1751,7 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { } int GraphExecutor::InNode::Successed_SuccessAction() { -// cdebug << ThreadNo() << " --> Successed_SuccessAction " << Name() << endl; + cdebug << ThreadNo() << " --> Successed_SuccessAction " << Name() << endl; int res = 1; int linkednodesnumber = LinkedNodesSize() ; GraphExecutor::InNode *firstzeroNode = NULL ; @@ -1682,6 +1763,12 @@ int GraphExecutor::InNode::Successed_SuccessAction() { DoneAction() ; + if ( IsMacroNode() ) { + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " LinkedNodes->SomeDataReady already done" + << endl ; + return 1; + } + if ( IsGOTONode() || ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) { cdebug << ThreadNo() << " Successed_SuccessAction " << Name() @@ -1696,15 +1783,15 @@ int GraphExecutor::InNode::Successed_SuccessAction() { for ( i = 0 ; i < aGateOutPort->InPortsSize() ; i++ ) { const GraphBase::InPort * anInPort = aGateOutPort->InPorts( i ) ; GraphExecutor::InNode * aLabelNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode " -// << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode " + << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ; aLabelNode->SetWaitingStates( this ) ; for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) { const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ; if ( anInPort->GetOutPort() ) { -// cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : " -// << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")" -// << endl ; + cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : " + << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")" + << endl ; } } for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) { @@ -1719,17 +1806,17 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } if ( aBusParamChangeInPort ) { aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode " -// << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port " -// << aBusParamOutPort->PortName() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode " + << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port " + << aBusParamOutPort->PortName() << endl ; if ( !aLabelNode->IsLockedDataWait() ) { res = aLabelNode->SendSomeDataReady( Name() ) ; if ( res ) { if ( firsttoNode == NULL && aLabelNode->ThreadNo() == pthread_self() ) { firsttoNode = aLabelNode ; -// cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " -// << aLabelNode->Name() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " + << aLabelNode->Name() << endl ; } else if ( firstzeroNode == NULL && aLabelNode->ThreadNo() == 0 ) { @@ -1737,33 +1824,33 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { SomeDataNodes.push_back( aLabelNode ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " -// << aLabelNode->Name() << " " << SomeDataNodes.size() -// << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " + << aLabelNode->Name() << " " << SomeDataNodes.size() + << endl ; } } } else { -// cdebug << ThreadNo() -// << " Successed_SuccessAction Loop to HeadNode " -// << aLabelNode->Name() << " with datas from " << Name() << "(" -// << aBusParamOutPort->PortName() << ") to port " -// << aBusParamChangeInPort->PortName() << endl; + cdebug << ThreadNo() + << " Successed_SuccessAction Loop to HeadNode " + << aLabelNode->Name() << " with datas from " << Name() << "(" + << aBusParamOutPort->PortName() << ") to port " + << aBusParamChangeInPort->PortName() << endl; } } else { -// cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name() -// << " NO port " << aBusParamOutPort->PortName() << " in " -// << aLabelNode->Name() << endl; + cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name() + << " NO port " << aBusParamOutPort->PortName() << " in " + << aLabelNode->Name() << endl; } } } for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) { const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ; if ( anInPort->GetOutPort() ) { -// cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : " -// << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")" -// << endl ; + cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : " + << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")" + << endl ; } } const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInGate() ; @@ -1777,8 +1864,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( firsttoNode == NULL && aLabelNode->ThreadNo() == pthread_self() ) { firsttoNode = aLabelNode ; -// cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " -// << aLabelNode->Name() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " + << aLabelNode->Name() << endl ; } else if ( firstzeroNode == NULL && aLabelNode->ThreadNo() == 0 ) { @@ -1786,9 +1873,9 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { SomeDataNodes.push_back( aLabelNode ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " -// << aLabelNode->Name() << " " << SomeDataNodes.size() -// << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " + << aLabelNode->Name() << " " << SomeDataNodes.size() + << endl ; } } } @@ -1802,22 +1889,26 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { -// cdebug << ThreadNo() << " Successed_SuccessAction of " << Name() -// << " with " << LinkedNodesSize() << " linked nodes :" ; + cdebug << ThreadNo() << " Successed_SuccessAction of " << Name() + << " with " << LinkedNodesSize() << " linked nodes :" ; for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { if ( LinkedNodes( i )->IsDataFlowNode() ) { linkednodesnumber -= 1 ; } -// cdebug << " " << LinkedNodes( i )->Name() ; + cdebug << " " << LinkedNodes( i )->Name() ; } -// cdebug << endl; + cdebug << endl; for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { bool IgnoreForEndLoop = false ; GraphBase::ComputingNode * aComputingNode ; aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ; toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ; -// cdebug << ThreadNo() << " Successed_SuccessAction of " << Name() -// << " [" << i << "] " << LinkedNodes( i )->Name() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction of " << Name() + << " [" << i << "] " << LinkedNodes( i )->Name() << " toNode " << toNode << " IgnoreForEndLoop " + << IgnoreForEndLoop ; + if ( toNode ) { + cdebug << " " << toNode->Kind() << endl ; + } if ( toNode && !toNode->IsDataFlowNode() ) { if ( IsComputingNode() && toNode->IsInLineNode() ) { GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInGate() ; @@ -1869,13 +1960,15 @@ int GraphExecutor::InNode::Successed_SuccessAction() { toNode->GetChangeNodeInPort( j )->InitialOutPort() ; } } + cdebug << ThreadNo() << " Successed_SuccessAction " << toNode->Name() << "->SendSomeDataReady( " + << Name() << " )" << endl ; res = toNode->SendSomeDataReady( Name() ) ; if ( res ) { if ( firsttoNode == NULL && toNode->ThreadNo() == pthread_self() ) { firsttoNode = toNode ; -// cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " -// << toNode->Name() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode " + << toNode->Name() << endl ; } else if ( firstzeroNode == NULL && toNode->ThreadNo() == 0 ) { @@ -1883,8 +1976,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { SomeDataNodes.push_back( toNode ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " -// << toNode->Name() << " " << SomeDataNodes.size() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push " + << toNode->Name() << " " << SomeDataNodes.size() << endl ; } } } @@ -1893,14 +1986,18 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( firsttoNode == NULL && firstzeroNode ) { firsttoNode = firstzeroNode ; -// cdebug << ThreadNo() -// << " Successed_SuccessAction firsttoNode = firstzeroNode " -// << endl ; + cdebug << ThreadNo() + << " Successed_SuccessAction firsttoNode = firstzeroNode " + << endl ; } else if ( firsttoNode && firstzeroNode ) { SomeDataNodes.push_back( firstzeroNode ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push firstzeroNode " -// << firstzeroNode->Name() << " " << SomeDataNodes.size() << endl ; + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " push firstzeroNode " + << firstzeroNode->Name() << " " << SomeDataNodes.size() << endl ; + } + else { + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " firsttoNode " << firsttoNode + << " firstzeroNode " << firstzeroNode << endl ; } while ( SomeDataNodes.size() ) { @@ -1909,7 +2006,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() { // cdebug << pthread_self() << "/" << ThreadNo() // << " Successed_SuccessAction pop " // << SomeDataNodes.size() << " " << aNode->Name() << endl ; - if ( aNode->State() == SUPERV::DataReadyState ) { + if ( aNode->State() == GraphExecutor::DataReadyState ) { aNode->CreateNewThreadIf( true ) ; aNode->UnLockDataWait() ; res = aNode->DataUndef_AllDataReadyAction() ; @@ -1927,13 +2024,13 @@ int GraphExecutor::InNode::Successed_SuccessAction() { // << SomeDataNodes.size() << " " << firsttoNode->Name() << endl ; firsttoNode->CreateNewThreadIf( false ) ; firsttoNode->RewindStack( RewindStack() ) ; - if ( firsttoNode->State() == SUPERV::SuccessedState ) { + if ( firsttoNode->State() == GraphExecutor::SuccessedState ) { // cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() // << " : " << firsttoNode->Name() << " " // << Automaton()->StateName( firsttoNode->State() ) // << " --> DataWaitingState for Thread " // << firsttoNode->ThreadNo() << endl ; - firsttoNode->State( SUPERV::DataWaitingState ) ; + firsttoNode->State( GraphExecutor::DataWaitingState ) ; } // pthread_t OldT = firsttoNode->ThreadNo() ; firsttoNode->ThreadNo( pthread_self() ) ; @@ -1947,7 +2044,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() { // << " !firsttoNode->CreateNewThreadIf() " // << !firsttoNode->CreateNewThreadIf() // << " " << Automaton()->StateName( firsttoNode->State() ) ; - if ( firsttoNode->State() == SUPERV::DataReadyState ) { + if ( firsttoNode->State() == GraphExecutor::DataReadyState ) { cdebug << endl ; firsttoNode->UnLockDataWait() ; res = firsttoNode->DataUndef_AllDataReadyAction() ; @@ -1977,8 +2074,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { bool GraphExecutor::InNode::SendSomeDataReady( char * FromNodeName ) { bool RetVal = false ; if ( IsDataFlowNode() ) { -// cdebug << ThreadNo() << " ----> " << Name() -// << " send Result to graph " << Name() << endl; + cdebug << ThreadNo() << " ----> " << Name() + << " send Result to graph " << Name() << endl; } else { // cdebug << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName @@ -1987,20 +2084,20 @@ bool GraphExecutor::InNode::SendSomeDataReady( char * FromNodeName ) { // << " CreateNewThreadIf() " << CreateNewThreadIf() // << " LockedDataWait " << IsLockedDataWait() << endl; #if 0 - cout << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName + //cout << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName << " send SomeDataReady to " << Name() << " " << Automaton()->StateName( State() ) << " CreateNewThreadIf() " << CreateNewThreadIf() << " LockedDataWait " << IsLockedDataWait() << endl; #endif - if ( State() == SUPERV::SuccessedState || - State() == SUPERV::SuspendedSuccessedState || - State() == SUPERV::SuspendedSuccessedToReStartState ) { + if ( State() == GraphExecutor::SuccessedState || + State() == GraphExecutor::SuspendedSuccessedState || + State() == GraphExecutor::SuspendedSuccessedToReStartState ) { // cdebug << ThreadNo() << " " << FromNodeName // << " : " << Name() << " " << Automaton()->StateName( State() ) // << " --> DataWaitingState for Thread " // << ThreadNo() << " " << endl ; - State( SUPERV::DataWaitingState ) ; + State( GraphExecutor::DataWaitingState ) ; } LockDataWait() ; DataFromNode( FromNodeName ) ; @@ -2024,7 +2121,7 @@ int GraphExecutor::InNode::Successed_SuspendAction() { << " Threads " << _OutNode->Threads() << " SuspendedThreads " << _OutNode->SuspendedThreads() << endl; _OutNode->PushEvent( this , GraphExecutor::SuspendedSuccessedEvent , - SUPERV::SuspendedSuccessedState ) ; + GraphExecutor::SuspendedSuccessedState ) ; DoneAction() ; GraphExecutor::InNode * aReStartNode = SuspendAction() ; cdebug << ThreadNo() << " Successed_SuspendAction Resumed " << Name() ; @@ -2045,7 +2142,7 @@ int GraphExecutor::InNode::Errored_SuspendAction() { << " Threads " << _OutNode->Threads() << " SuspendedThreads " << _OutNode->SuspendedThreads() << endl; _OutNode->PushEvent( this , GraphExecutor::SuspendedErroredEvent , - SUPERV::SuspendedErroredState ) ; + GraphExecutor::SuspendedErroredState ) ; DoneAction() ; GraphExecutor::InNode * aReStartNode = SuspendAction() ; cdebug << ThreadNo() << " Errored_SuspendAction Resumed " << Name() @@ -2064,7 +2161,7 @@ int GraphExecutor::InNode::SuspendedSuccessed_ResumeAction() { cdebug << ThreadNo() << " SuspendedSuccessed_ResumeAction " << Name() << endl; // ResumeAction() ; _OutNode->PushEvent( this , GraphExecutor::ResumedSuccessedEvent , - SUPERV::ResumedSuccessedState ) ; + GraphExecutor::ResumedSuccessedState ) ; SendEvent( ResumedSuccessedEvent ) ; return 1 ; } @@ -2073,7 +2170,7 @@ int GraphExecutor::InNode::SuspendedErrored_ResumeAction() { cdebug << ThreadNo() << " SuspendedErrored_ResumeAction " << Name() << endl; // ResumeAction() ; _OutNode->PushEvent( this , GraphExecutor::ResumedErroredEvent , - SUPERV::ResumedErroredState ) ; + GraphExecutor::ResumedErroredState ) ; SendEvent( ResumedErroredEvent ) ; return 1 ; } @@ -2081,7 +2178,7 @@ int GraphExecutor::InNode::SuspendedErrored_ResumeAction() { int GraphExecutor::InNode::Successed_KillAction() { KillAction() ; _OutNode->PushEvent( this , GraphExecutor::KilledEvent , - SUPERV::KilledSuccessedState ) ; + GraphExecutor::KilledSuccessedState ) ; cdebug << ThreadNo() << " Successed_KillAction " << Name() << endl; return 1 ; } @@ -2089,7 +2186,7 @@ int GraphExecutor::InNode::Successed_KillAction() { int GraphExecutor::InNode::Errored_KillAction() { KillAction() ; _OutNode->PushEvent( this , GraphExecutor::KilledEvent , - SUPERV::KilledErroredState ) ; + GraphExecutor::KilledErroredState ) ; cdebug << ThreadNo() << " Errored_KillAction " << Name() << endl; return 1 ; } @@ -2097,7 +2194,7 @@ int GraphExecutor::InNode::Errored_KillAction() { int GraphExecutor::InNode::Successed_StopAction() { StopAction() ; _OutNode->PushEvent( this , GraphExecutor::StoppedEvent , - SUPERV::StoppedSuccessedState ) ; + GraphExecutor::StoppedSuccessedState ) ; cdebug << ThreadNo() << " Successed_StopAction " << Name() << endl; return 1 ; } @@ -2105,7 +2202,7 @@ int GraphExecutor::InNode::Successed_StopAction() { int GraphExecutor::InNode::Errored_StopAction() { StopAction() ; _OutNode->PushEvent( this , GraphExecutor::StoppedEvent , - SUPERV::StoppedErroredState ) ; + GraphExecutor::StoppedErroredState ) ; cdebug << ThreadNo() << " Errored_StopAction " << Name() << endl; return 1 ; } @@ -2113,7 +2210,7 @@ int GraphExecutor::InNode::Errored_StopAction() { int GraphExecutor::InNode::SuspendedSuccessed_ReStartAction() { cdebug << ThreadNo() << " SuspendedSuccessed_ReStartAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ReStartedEvent , - SUPERV::ReStartedState ) ; + GraphExecutor::ReStartedState ) ; int i ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { GetChangeNodeInPort( i )->State( SUPERV::ReadyState ) ; @@ -2126,7 +2223,7 @@ int GraphExecutor::InNode::SuspendedSuccessed_ReStartAction() { int GraphExecutor::InNode::SuspendedErrored_ReStartAction() { cdebug << ThreadNo() << " SuspendedErrored_ReStartAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ReStartedEvent , - SUPERV::ReStartedState ) ; + GraphExecutor::ReStartedState ) ; int i ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { GetChangeNodeInPort( i )->State( SUPERV::ReadyState ) ; @@ -2140,8 +2237,8 @@ int GraphExecutor::InNode::SuspendedSuccessed_ReStartAndSuspendAction() { cdebug << ThreadNo() << " SuspendedSuccessed_ReStartAndSuspendAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ReStartedAndSuspendEvent , - SUPERV::ReStartedState ) ; - State( SUPERV::DataWaitingState ) ; + GraphExecutor::ReStartedState ) ; + State( GraphExecutor::DataWaitingState ) ; if ( !Suspend() ) { cdebug << "InNode::Suspend() Node " << Name() << endl ; return false ; @@ -2160,8 +2257,8 @@ int GraphExecutor::InNode::SuspendedErrored_ReStartAndSuspendAction() { cdebug << ThreadNo() << " SuspendedErrored_ReStartAndSuspendAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::ReStartedAndSuspendEvent , - SUPERV::ReStartedState ) ; - State( SUPERV::DataWaitingState ) ; + GraphExecutor::ReStartedState ) ; + State( GraphExecutor::DataWaitingState ) ; if ( !Suspend() ) { cdebug << "InNode::Suspend() Node " << Name() << endl ; return false ; @@ -2571,7 +2668,9 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , int i ; GraphBase::OutPort * aGateOutPort = NULL ; bool OrSwitch = false ; - if ( nOutParams ) { + cdebug << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " << NewState << endl ; +// cout << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " << NewState << endl ; + if ( nOutParams && !IsMacroNode() ) { GraphBase::OutPort * anOutPort ; for ( i = 0 ; i < nOutParams ; i++ ) { anOutPort = GetChangeNodeOutPort(i) ; @@ -2690,30 +2789,45 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , int j ; for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { bool fromGOTO = false ; - GraphBase::OutPort * aGOTOPort = _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInGate()->GetOutPort() ; - if ( aGOTOPort ) { - fromGOTO = aGOTOPort->IsGOTO() ; - } - if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) { - cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "(" - << anOutPort->ChangeInPorts( j )->PortName() << "," - << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from " - << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() - << "(" - << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() - << ") to " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ")" << endl ; - anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ; - } + const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ; + if ( !strcmp( ToNodeName , _OutNode->Graph()->Name() ) && _OutNode->Graph()->GraphMacroLevel() != 0 ) { + cdebug << "OutParametersSet ToNodeName " << _OutNode->Graph()->CoupledNode() + << " GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphExecutor() << endl ; + _OutNode->Graph()->CoupledNode()->GraphExecutor()->OutputOfAny( _OutNode->Graph()->CoupledNodeName() , + anOutPort->ChangeInPorts( j )->PortName() , + *anOutPort->Value() ) ; + } else { - cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "(" - << anOutPort->ChangeInPorts( j )->PortName() << "," - << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from " - << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() - << "(" - << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() - << ") to " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ")" << endl ; + GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ; + if ( ToNode ) { +// cout << "OutParametersSet ToNodeName " << ToNodeName << endl ; + cdebug << "OutParametersSet ToNodeName " << ToNodeName << " " << ToNode->Name() << endl ; + GraphBase::OutPort * aGOTOPort = ToNode->GetChangeNodeInGate()->GetOutPort() ; + if ( aGOTOPort ) { + fromGOTO = aGOTOPort->IsGOTO() ; + } + if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) { + cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "(" + << anOutPort->ChangeInPorts( j )->PortName() << "," + << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from " + << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() + << "(" + << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() + << ") to " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ")" << endl ; + anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ; + } + else { + cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "(" + << anOutPort->ChangeInPorts( j )->PortName() << "," + << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from " + << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() + << "(" + << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() + << ") to " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ")" << endl ; + } + } } } //#if 0 diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx index d8031a4..26b81bf 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx @@ -46,7 +46,7 @@ GraphExecutor::OutNode::OutNode() { _Done = false ; _Threads = 0 ; _ControlState = SUPERV::VoidState ; - _State = SUPERV::UnKnownState ; + _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; pthread_mutex_init( &_MutexWait , NULL ) ; pthread_mutex_init( &_PyMutexWait , NULL ) ; @@ -71,12 +71,12 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, if ( aKindOfNode == SUPERV::DataFlowGraph ) { _StreamGraph = NULL ; // _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ; - _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , aKindOfNode , _prof_debug , _fdebug ) ; } else if ( aKindOfNode == SUPERV::DataStreamGraph ) { // _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;; - _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , aKindOfNode , _prof_debug , _fdebug ) ; _Graph = _StreamGraph ; } @@ -85,7 +85,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, _Done = false ; _Threads = 0 ; _ControlState = SUPERV::VoidState ; - _State = SUPERV::UnKnownState ; + _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; _Orb = CORBA::ORB::_duplicate( ORB ) ; pthread_mutex_init( &_MutexWait , NULL ) ; @@ -101,46 +101,45 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, cdebug_out << "GraphEditor::OutNode::OutNode" << endl; } -GraphExecutor::OutNode::OutNode( - CORBA::ORB_ptr ORB, - SALOME_NamingService* ptrNamingService , - const SALOME_ModuleCatalog::Service& DataFlowService , - const char *DataFlowComponentName , - const char *DataFlowInterfaceName , - const char *DataFlowName , - const SUPERV::KindOfNode DataFlowkind , - const SUPERV::SDate DataFlowFirstCreation , - const SUPERV::SDate DataFlowLastModification , - const char * DataFlowEditorRelease , - const char * DataFlowAuthor , - const char * DataFlowComputer , - const char * DataFlowComment , - const char * DebugFileName ) { -// Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , -// DataFlowInterfaceName , DataFlowName , DataFlowkind , -// DataFlowFirstCreation , DataFlowLastModification , -// DataFlowEditorRelease , DataFlowAuthor , -// DataFlowComputer , DataFlowComment , DebugFileName ) { +GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, + SALOME_NamingService* ptrNamingService , + const SALOME_ModuleCatalog::Service& DataFlowService , + const char *DataFlowComponentName , + const char *DataFlowInterfaceName , + const char *DataFlowName , + const SUPERV::KindOfNode DataFlowkind , + const SUPERV::SDate DataFlowFirstCreation , + const SUPERV::SDate DataFlowLastModification , + const char * DataFlowEditorRelease , + const char * DataFlowAuthor , + const char * DataFlowComputer , + const char * DataFlowComment , + const char * DebugFileName ) { +// Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , +// DataFlowInterfaceName , DataFlowName , DataFlowkind , +// DataFlowFirstCreation , DataFlowLastModification , +// DataFlowEditorRelease , DataFlowAuthor , +// DataFlowComputer , DataFlowComment , DebugFileName ) { Set_prof_debug( ORB , DebugFileName ) ; cdebug_in << "GraphEditor::OutNode::OutNode(" << DataFlowName << " , " << DataFlowkind << ")" << endl; if ( DataFlowkind == SUPERV::DataFlowGraph ) { _StreamGraph = NULL ; _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , - DataFlowInterfaceName , DataFlowName , DataFlowkind , - DataFlowFirstCreation , DataFlowLastModification , - DataFlowEditorRelease , DataFlowAuthor , - DataFlowComputer , DataFlowComment , - _prof_debug , _fdebug ) ; -// DataFlowComputer , DataFlowComment , DebugFileName ) ; + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; +// DataFlowComputer , DataFlowComment , DebugFileName ) ; } else if ( DataFlowkind == SUPERV::DataStreamGraph ) { _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , - DataFlowInterfaceName , DataFlowName , DataFlowkind , - DataFlowFirstCreation , DataFlowLastModification , - DataFlowEditorRelease , DataFlowAuthor , - DataFlowComputer , DataFlowComment , - _prof_debug , _fdebug ) ; + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; _Graph = _StreamGraph ; } _Valid = false ; @@ -148,7 +147,7 @@ GraphExecutor::OutNode::OutNode( _Done = false ; _Threads = 0 ; _ControlState = SUPERV::VoidState ; - _State = SUPERV::UnKnownState ; + _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; _Orb = CORBA::ORB::_duplicate( ORB ) ; pthread_mutex_init( &_MutexWait , NULL ) ; @@ -176,18 +175,19 @@ void GraphExecutor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB , } } -bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph &aDataFlow ) { +bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph * aDataFlow ) { bool RetVal = false ; - RetVal = LoadInfo( aDataFlow.Info ) ; + cdebug_in << "GraphExecutor::OutNode::LoadDataFlow " << (*aDataFlow).Info.theName << endl ; + RetVal = LoadInfo( (*aDataFlow).Info ) ; if ( Graph()->ServiceName() != NULL ) { // MESSAGE( "GraphExecutor::OutNode::LoadDataFlow" ); if ( RetVal ) { - RetVal = LoadNodes( aDataFlow.Nodes ) ; + RetVal = LoadNodes( (*aDataFlow).Nodes ) ; if ( RetVal ) { - RetVal = LoadLinks( aDataFlow.Links ) ; + RetVal = LoadLinks( (*aDataFlow).Links ) ; if ( RetVal ) { IsValid() ; - RetVal = LoadDatas( aDataFlow.Datas ) ; + RetVal = LoadDatas( (*aDataFlow).Datas ) ; IsExecutable() ; if ( !RetVal) { cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadDatas Error." @@ -212,26 +212,29 @@ bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph &aDataFlow ) { else { cdebug << "GraphExecutor::OutNode::LoadDataFlow ServiceName Error." << endl ; } + cdebug_in << "GraphExecutor::OutNode::LoadDataFlow " << RetVal << endl ; return RetVal ; } +#if 0 bool GraphExecutor::OutNode::LoadXml( const char* myFileName ) { bool RetVal = false ; - GraphBase::SGraph aDataFlow ; - if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) { - RetVal = LoadDataFlow( aDataFlow ) ; + GraphBase::ListOfSGraphs aListOfDataFlows ; + if ( Graph()->LoadXml( _Orb , myFileName , aListOfDataFlows ) ) { + RetVal = LoadDataFlow( aListOfDataFlows ) ; // if ( aConstructor && RetVal ) // RetVal = Name( aDataFlow.Info.theName.c_str() ) ; } return RetVal ; -} +} +#endif bool GraphExecutor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { cdebug << "GraphExecutor::OutNode::LoadInfo _StreamGraph " << _StreamGraph << endl ; // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ; Graph()->Name( aDataFlowInfo.theName.c_str() ) ; Graph()->Kind( aDataFlowInfo.theKind ) ; - if ( Graph()->IsDataStreamNode() ) { + if ( Graph()->IsDataStreamNode() && aDataFlowInfo.theKind == SUPERV::DataStreamGraph ) { StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ; } Graph()->DataService( _Orb , aDataFlowInfo.theService , _prof_debug , _fdebug ) ; @@ -246,7 +249,7 @@ bool GraphExecutor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { return true ; } -bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNodes ) { +bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfSNodes &aListOfNodes ) { bool RetVal = true ; GraphExecutor::InNode * anInNode ; cdebug << "GraphExecutor::OutNode::LoadNodes" << endl ; @@ -268,7 +271,7 @@ bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNode RetVal = false ; break ; } - if ( anInNode->IsOneOfInLineNodes() ) { + if ( anInNode->IsOneOfInLineNodes() || anInNode->IsMacroNode() ) { anInNode->GraphExecutor::InNode::InLineNode()->DefPortsOfNode( _Orb , aNode.theService , anInNode->NamePtr() , anInNode->Kind() , @@ -335,13 +338,21 @@ bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNode if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) { GraphBase::GOTONode * aCoupledNode ; aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ; - aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; + GraphBase::GOTONode * aCoupledCoupledNode ; + aCoupledCoupledNode = (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ; + if ( aCoupledCoupledNode != NULL ) { + aCoupledNode->CoupledNode( aCoupledCoupledNode ) ; + } + else { + aCoupledNode->CoupledNodeName( aNode.theCoupledNode.c_str() ) ; + } + aCoupledNode->SetGraphExecutor( (GraphExecutor::DataFlow * ) this ) ; } } return RetVal ; } -bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfLinks &aListOfLinks ) { +bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfSLinks &aListOfLinks ) { bool RetVal = true ; cdebug << "GraphExecutor::OutNode::LoadLinks " << aListOfLinks.size() << endl ; @@ -351,16 +362,15 @@ bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfLinks &aListOfLink RetVal = Graph()->AddLink( aLink.FromNodeName.c_str() , aLink.FromServiceParameterName.c_str() , aLink.ToNodeName.c_str() , - aLink.ToServiceParameterName.c_str() , - aLink.aLinkValue ) ; -// aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ; + aLink.ToServiceParameterName.c_str() ) ; +// , aLink.aLinkValue ) ; if ( !RetVal ) break ; } return RetVal ; } -bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfLinks &aListOfDatas ) { +bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfSLinks &aListOfDatas ) { bool RetVal = true ; cdebug << "GraphExecutor::OutNode::LoadDatas " << aListOfDatas.size() << endl ; @@ -371,15 +381,11 @@ bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfLinks &aListOfData RetVal = Graph()->AddInputData( aLink.ToNodeName.c_str() , aLink.ToServiceParameterName.c_str() , aLink.aLinkValue ) ; -// aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ; - else if ( !strcmp( aLink.ToNodeName.c_str() , Graph()->Name() ) ) { - RetVal = Graph()->AddOutputData( aLink.FromNodeName.c_str() , - aLink.FromServiceParameterName.c_str() , - aLink.aLinkValue ) ; -// aLink.aLinkValue.Value , -// aLink.aLinkValue.Kind ) ; - Graph()->AddLink( aLink.FromNodeName.c_str() , (GraphBase::ComputingNode *) this ) ; - } +// else if ( !strcmp( aLink.ToNodeName.c_str() , Graph()->Name() ) ) { +// RetVal = Graph()->AddOutputData( aLink.FromNodeName.c_str() , +// aLink.FromServiceParameterName.c_str() ) ; +// Graph()->AddLink( aLink.FromNodeName.c_str() , (GraphBase::ComputingNode *) this ) ; +// } else { cdebug << "GraphExecutor::OutNode::LoadDatas Error " << aLink.FromNodeName << " and " << aLink.ToNodeName << " differents from " << Graph()->Name() @@ -425,20 +431,6 @@ GraphExecutor::InNode *GraphExecutor::OutNode::AddNode( } -bool GraphExecutor::OutNode::AddInputData( const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) { - cdebug_in << "GraphExecutor::OutNode::AddInputData" << endl; - bool RetVal = Graph()->AddInputData( ToNodeName1 , - ToParameterName1 , - ToNodeName2 , - ToParameterName2 ) ; - cdebug_out << "GraphExecutor::OutNode::AddInputData" << endl; - _Valid = false ; - return RetVal ; -} - bool GraphExecutor::OutNode::Valid() { cdebug_in << "GraphExecutor::OutNode::Valid" << endl; @@ -486,7 +478,7 @@ bool GraphExecutor::OutNode::Executable() { _Executable = false ; } - cdebug_out << "GraphExecutor::OutNode::Executable" << endl; + cdebug_out << "GraphExecutor::OutNode::Executable " << _Executable << endl; return _Executable ; } @@ -521,8 +513,8 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; if ( anInNode->IsOneOfInLineNodes() ) { if ( !anInNode->InitPythonFunctions( true ) ) { - anInNode->State( SUPERV::ErroredState ) ; - State( SUPERV::ErroredState ) ; + anInNode->State( GraphExecutor::ErroredState ) ; + State( GraphExecutor::ErroredState ) ; cdebug_out << "GraphExecutor::OutNode::Run InitPythonFunctions ERROR " << anInNode->Name() << endl ; return false ; @@ -530,69 +522,105 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } } - cdebug << "Execution starting GraphExecutor::Action_DataOk_RunService Node " - << Graph()->Name() << endl ; - - PushEvent( NULL , GraphExecutor::ReadyEvent , - SUPERV::DataReadyState ) ; - State( SUPERV::DataReadyState ) ; - - for ( i = 0 ; i < Graph()->HeadNodesSize() ; i++ ) { - GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->HeadNodes( i )->GetInNode() ; - if ( anInNode->State() != SUPERV::DataReadyState ) { - cdebug << "GraphExecutor::OutNode::Run inconsistency State of Node " - << anInNode->Name() << " : " << anInNode->State() << endl ; - cdebug_out << "GraphExecutor::OutNode::Run State ERROR" << endl ; - return false ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; + if ( anInNode->IsMacroNode() ) { + GraphBase::Graph * aMacroGraph = anInNode->GraphMacroNode() ; + cdebug << "GraphExecutor::OutNode::Run " << anInNode << " MacroNode " << aMacroGraph + << aMacroGraph->Name() << endl ; + SUPERV::Graph_var iobject = anInNode->GraphMacroNode()->MacroObject() ; + if ( CORBA::is_nil( iobject ) ) { + cdebug << "MacroObject() is a nil object. Error" << endl ; + } + else { + cdebug << "MacroObject() is NOT a nil object." << endl ; + } } -// PushEvent( anInNode , GraphExecutor::ReadyEvent , -// SUPERV::DataReadyState ) ; - anInNode->CreateNewThread( true ) ; - anInNode->DataFromNode( Graph()->Name() ) ; - if ( AndSuspend ) { - anInNode->State( SUPERV::DataWaitingState ) ; - anInNode->ControlState( SUPERV::ToSuspendStartState ) ; - if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) { - cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node " - << anInNode->Name() << endl ; - cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; + } + + if ( Graph()->GraphMacroLevel() != 0 ) { + cdebug << "Execution starting GraphExecutor::Action_DataOk_RunService Node " + << Graph()->Name() << " GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; + PushEvent( NULL , GraphExecutor::NoDataReadyEvent , + GraphExecutor::DataUndefState ) ; + } + else { + cdebug << "Execution starting GraphExecutor::Action_DataOk_RunService Node " + << Graph()->Name() << " GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; + PushEvent( NULL , GraphExecutor::ReadyEvent , + GraphExecutor::DataReadyState ) ; + State( GraphExecutor::DataReadyState ) ; + + cdebug << pthread_self() << " GraphExecutor::OutNode::Run Start of the " << Graph()->HeadNodesSize() + << " HeadNodes" << endl ; + for ( i = 0 ; i < Graph()->HeadNodesSize() ; i++ ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->HeadNodes( i )->GetInNode() ; + cdebug << pthread_self() << "GraphExecutor::OutNode::Run Start of HeadNode " << i << " " + << anInNode->Name() << endl ; + if ( anInNode->State() != GraphExecutor::DataReadyState ) { + cdebug << "GraphExecutor::OutNode::Run inconsistency State of Node " + << anInNode->Name() << " : " << anInNode->State() << endl ; + cdebug_out << "GraphExecutor::OutNode::Run State ERROR" << endl ; return false ; } - anInNode->SuspendedWait() ; +// PushEvent( anInNode , GraphExecutor::ReadyEvent , +// GraphExecutor::DataReadyState ) ; + anInNode->CreateNewThread( true ) ; + anInNode->DataFromNode( Graph()->Name() ) ; + if ( AndSuspend ) { + anInNode->State( GraphExecutor::DataWaitingState ) ; + anInNode->ControlState( SUPERV::ToSuspendStartState ) ; + if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) { + cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node " + << anInNode->Name() << endl ; + cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; + return false ; + } + anInNode->SuspendedWait() ; + } + else if ( anInNode->IsMacroNode() ) { + if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) { + cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node " + << anInNode->Name() << endl ; + cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; + return false ; + } + cdebug << pthread_self() << " GraphExecutor::OutNode::Run " << anInNode->Name() << "->RunningWait" + << endl ; + anInNode->RunningWait() ; + cdebug << pthread_self() << " GraphExecutor::OutNode::Run " << anInNode->Name() << "->RunningWaited" + << endl ; + } + else if ( !anInNode->IsMacroNode() ) { + if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) { + cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node " + << anInNode->Name() << endl ; + cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; + return false ; + } + anInNode->RunningWait() ; + } } - else if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) { - cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node " - << anInNode->Name() << endl ; - cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; - return false ; + + if ( AndSuspend ) { + PushEvent( NULL , GraphExecutor::SuspendedReadyEvent , + GraphExecutor::SuspendedReadyState ) ; } else { - anInNode->RunningWait() ; + PushEvent( NULL , GraphExecutor::ExecutingEvent , + GraphExecutor::ExecutingState ) ; + if (AutomatonState() == GraphExecutor::DataReadyState) { + State( GraphExecutor::ExecutingState ) ; + }; } +// ostringstream astr ; +// astr << "Graph " << Graph()->Name() << " is running" ; +// Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + RetVal = true ; } - - if ( AndSuspend ) { - PushEvent( NULL , GraphExecutor::SuspendedReadyEvent , - SUPERV::SuspendedReadyState ) ; - } - else { - PushEvent( NULL , GraphExecutor::ExecutingEvent , - SUPERV::ExecutingState ) ; - if (AutomatonState() == SUPERV::DataReadyState) { - State( SUPERV::ExecutingState ) ; - }; - } -// ostringstream astr ; -// astr << "Graph " << Graph()->Name() << " is running" ; -// Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; - RetVal = true ; - } - else { - PushEvent( NULL , GraphExecutor::NoDataReadyEvent , - SUPERV::DataUndefState ) ; } - cdebug_out << "GraphExecutor::OutNode::Run" << endl ; + cdebug_out << "GraphExecutor::OutNode::Run GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; return RetVal ; } @@ -613,8 +641,8 @@ bool GraphExecutor::OutNode::Run( const char * aNodeName , void GraphExecutor::OutNode::CheckAllDone() { int j ; cdebug_in << "GraphExecutor::OutNode::CheckAllDone " << endl; - SUPERV::AutomatonState OutNodeState = SUPERV::SuccessedState ; - SUPERV::AutomatonState InNodeState ; + GraphExecutor::AutomatonState OutNodeState = GraphExecutor::SuccessedState ; + GraphExecutor::AutomatonState InNodeState ; bool AllDone = true ; if ( !Done() ) { for ( j = 0 ; j < Graph()->QueueNodesSize() ; j++ ) { @@ -622,21 +650,21 @@ void GraphExecutor::OutNode::CheckAllDone() { cdebug << j << ". " << ( (GraphExecutor::InNode * ) Graph()->QueueNodes( j )->GetInNode() )->Name() << " " << theAutomaton->StateName( InNodeState ) << endl ; - if ( InNodeState != SUPERV::SuccessedState && - InNodeState != SUPERV::ErroredState && - InNodeState != SUPERV::DataWaitingState ) { + if ( InNodeState != GraphExecutor::SuccessedState && + InNodeState != GraphExecutor::ErroredState && + InNodeState != GraphExecutor::DataWaitingState ) { AllDone = false ; } - if ( InNodeState != SUPERV::SuccessedState && - InNodeState != SUPERV::DataWaitingState && - InNodeState != SUPERV::DataReadyState ) { + if ( InNodeState != GraphExecutor::SuccessedState && + InNodeState != GraphExecutor::DataWaitingState && + InNodeState != GraphExecutor::DataReadyState ) { OutNodeState = InNodeState ; } } if ( AllDone ) { if( _Threads == 0 && _SuspendedThreads == 0 ) { - if ( OutNodeState != SUPERV::ErroredState ) { - OutNodeState = SUPERV::SuccessedState ; + if ( OutNodeState != GraphExecutor::ErroredState ) { + OutNodeState = GraphExecutor::SuccessedState ; } } else { @@ -821,7 +849,7 @@ void GraphExecutor::OutNode::SuspendThread() { exit( 0 ) ; } if ( IsSuspended() ) { - PushEvent( NULL , GraphExecutor::SuspendEvent , SUPERV::SuspendedState ) ; + PushEvent( NULL , GraphExecutor::SuspendEvent , GraphExecutor::SuspendedState ) ; } } void GraphExecutor::OutNode::ResumeThread() { @@ -1004,126 +1032,126 @@ SUPERV::GraphEvent GraphExecutor::OutNode::AutomatonGraphEvent(GraphExecutor::No return aGraphEvent ; } -SUPERV::GraphState GraphExecutor::OutNode::AutomatonGraphState(SUPERV::AutomatonState aState ) { +SUPERV::GraphState GraphExecutor::OutNode::AutomatonGraphState(GraphExecutor::AutomatonState aState ) { SUPERV::GraphState aGraphState ; switch ( aState ) { - case SUPERV::UnKnownState : { + case GraphExecutor::UnKnownState : { aGraphState = SUPERV::UndefinedState ; break ; } - case SUPERV::DataUndefState : { + case GraphExecutor::DataUndefState : { aGraphState = SUPERV::UndefinedState ; break ; } - case SUPERV::DataWaitingState : { + case GraphExecutor::DataWaitingState : { aGraphState = SUPERV::WaitingState ; break ; } - case SUPERV::DataReadyState : { + case GraphExecutor::DataReadyState : { aGraphState = SUPERV::ReadyState ; break ; } - case SUPERV::SuspendedReadyState : { + case GraphExecutor::SuspendedReadyState : { aGraphState = SUPERV::SuspendReadyState ; break ; } - case SUPERV::ResumedReadyState : { + case GraphExecutor::ResumedReadyState : { aGraphState = SUPERV::ReadyState ; break ; } - case SUPERV::KilledReadyState : { + case GraphExecutor::KilledReadyState : { aGraphState = SUPERV::KillState ; break ; } - case SUPERV::StoppedReadyState : { + case GraphExecutor::StoppedReadyState : { aGraphState = SUPERV::StopState ; break ; } - case SUPERV::ExecutingState : { + case GraphExecutor::ExecutingState : { aGraphState = SUPERV::RunningState ; break ; } - case SUPERV::SuspendedExecutingState : { + case GraphExecutor::SuspendedExecutingState : { aGraphState = SUPERV::SuspendState ; break ; } - case SUPERV::ResumedExecutingState : { + case GraphExecutor::ResumedExecutingState : { aGraphState = SUPERV::RunningState ; break ; } - case SUPERV::KilledExecutingState : { + case GraphExecutor::KilledExecutingState : { aGraphState = SUPERV::KillState ; break ; } - case SUPERV::StoppedExecutingState : { + case GraphExecutor::StoppedExecutingState : { aGraphState = SUPERV::StopState ; break ; } - case SUPERV::SuccessedExecutingState : { + case GraphExecutor::SuccessedExecutingState : { aGraphState = SUPERV::DoneState ; break ; } - case SUPERV::ErroredExecutingState : { + case GraphExecutor::ErroredExecutingState : { aGraphState = SUPERV::ErrorState ; break ; } - case SUPERV::SuspendedSuccessedState : { + case GraphExecutor::SuspendedSuccessedState : { aGraphState = SUPERV::SuspendDoneState ; break ; } - case SUPERV::SuspendedErroredState : { + case GraphExecutor::SuspendedErroredState : { aGraphState = SUPERV::SuspendErroredState ; break ; } - case SUPERV::ResumedSuccessedState : { + case GraphExecutor::ResumedSuccessedState : { aGraphState = SUPERV::DoneState ; break ; } - case SUPERV::ResumedErroredState : { + case GraphExecutor::ResumedErroredState : { aGraphState = SUPERV::ErrorState ; break ; } - case SUPERV::KilledSuccessedState : { + case GraphExecutor::KilledSuccessedState : { aGraphState = SUPERV::KillState ; break ; } - case SUPERV::KilledErroredState : { + case GraphExecutor::KilledErroredState : { aGraphState = SUPERV::KillState ; break ; } - case SUPERV::StoppedSuccessedState : { + case GraphExecutor::StoppedSuccessedState : { aGraphState = SUPERV::StopState ; break ; } - case SUPERV::StoppedErroredState : { + case GraphExecutor::StoppedErroredState : { aGraphState = SUPERV::StopState ; break ; } - case SUPERV::SuccessedState : { + case GraphExecutor::SuccessedState : { aGraphState = SUPERV::DoneState ; break ; } - case SUPERV::ErroredState : { + case GraphExecutor::ErroredState : { aGraphState = SUPERV::ErrorState ; break ; } - case SUPERV::SuspendedState : { + case GraphExecutor::SuspendedState : { aGraphState = SUPERV::SuspendState ; break ; } - case SUPERV::KilledState : { + case GraphExecutor::KilledState : { aGraphState = SUPERV::KillState ; break ; } - case SUPERV::StoppedState : { + case GraphExecutor::StoppedState : { aGraphState = SUPERV::StopState ; break ; } - case SUPERV::ReRunnedState : { + case GraphExecutor::ReRunnedState : { aGraphState = SUPERV::ReRunState ; break ; } - case SUPERV::ReStartedState : { + case GraphExecutor::ReStartedState : { aGraphState = SUPERV::ReStartState ; break ; } @@ -1142,7 +1170,7 @@ int GraphExecutor::OutNode::GetListSize() { bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , GraphExecutor::NodeEvent anEvent , - SUPERV::AutomatonState aState ) { + GraphExecutor::AutomatonState aState ) { // cdebug_in << "PushEvent Threads " << Threads() << " SuspendedThreads " // << SuspendedThreads() << endl ; if ( pthread_mutex_lock( &_MutexWait ) ) { @@ -1212,7 +1240,7 @@ bool GraphExecutor::OutNode::Event( char ** aNodeName , _EventNodes.size() > 0 ; char * NodeName = "" ; GraphExecutor::NodeEvent theEvent = GraphExecutor::UndefinedEvent ; - SUPERV::AutomatonState theState = SUPERV::UnKnownState ; + GraphExecutor::AutomatonState theState = GraphExecutor::UnKnownState ; anEvent = SUPERV::UndefinedEvent ; aState = SUPERV::UndefinedState ; if ( ( Done() || IsKilled() || IsStopped() ) && _EventNodes.size() == 0 ) { @@ -1300,7 +1328,7 @@ bool GraphExecutor::OutNode::EventWait( char ** aNodeName , cdebug << "--> EventW RetVal " << RetVal << endl ; char * NodeName = "" ; GraphExecutor::NodeEvent theEvent = GraphExecutor::UndefinedEvent ; - SUPERV::AutomatonState theState = SUPERV::UnKnownState ; + GraphExecutor::AutomatonState theState = GraphExecutor::UnKnownState ; anEvent = SUPERV::UndefinedEvent ; aState = SUPERV::UndefinedState ; if ( IsDone() && _EventNodes.size() == 0 ) { @@ -1421,7 +1449,7 @@ void GraphExecutor::OutNode::EventList() { } list< char * >::iterator itEventNodes = _EventNodes.begin() ; list< GraphExecutor::NodeEvent >::iterator itEvents = _Events.begin() ; - list< SUPERV::AutomatonState >::iterator itStates = _States.begin() ; + list< GraphExecutor::AutomatonState >::iterator itStates = _States.begin() ; while ( itEventNodes != _EventNodes.end() ) { cdebug << pthread_self() << "EVENTSTACK " << *itEventNodes << " " << *itEvents << " " @@ -1437,7 +1465,15 @@ void GraphExecutor::OutNode::EventList() { } } -void GraphExecutor::OutNode::State(SUPERV::AutomatonState aState ) { +void GraphExecutor::OutNode::SendSomeDataReady( const char * aNodeName ) { + cdebug_in << "GraphExecutor::OutNode::SendSomeDataReady " << aNodeName << "->SendSomeDataReady( " + << Graph()->Name() << " )" << endl; + int sts ; + sts = ((GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( aNodeName )->GetInNode())->SendSomeDataReady( Graph()->Name() ) ; + cdebug_out << "GraphExecutor::OutNode::SendSomeDataReady sts " << sts << endl ; +} + +void GraphExecutor::OutNode::State(GraphExecutor::AutomatonState aState ) { // cdebug << "GraphExecutor::OutNode::State " << Graph()->Name() << " " // << theAutomaton->StateName( AutomatonGraphState( _State ) ) << " ---> " // << theAutomaton->StateName( AutomatonGraphState( aState ) ) << endl ; @@ -1454,7 +1490,7 @@ SUPERV::GraphState GraphExecutor::OutNode::State() { SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::State " << NodeName << endl; - SUPERV::AutomatonState aret = SUPERV::UnKnownState ; + GraphExecutor::AutomatonState aret = GraphExecutor::UnKnownState ; const GraphBase::ComputingNode * aCNode = Graph()->GetGraphNode( NodeName ) ; if ( aCNode ) { GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ; @@ -1477,15 +1513,15 @@ SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName , return aret ; } -SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState() { +GraphExecutor::AutomatonState GraphExecutor::OutNode::AutomatonState() { // cdebug_in << "GraphExecutor::OutNode::AutomatonState" << endl; // cdebug_out << "GraphExecutor::OutNode::AutomatonState" << endl ; return _State ; } -SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState( const char * NodeName ) { +GraphExecutor::AutomatonState GraphExecutor::OutNode::AutomatonState( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::AutomatonState " << NodeName << endl; - SUPERV::AutomatonState aret = SUPERV::UnKnownState ; + GraphExecutor::AutomatonState aret = GraphExecutor::UnKnownState ; GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) aret = anInNode->State() ; @@ -1671,7 +1707,7 @@ bool GraphExecutor::OutNode::ContainerKill() { } RetVal = true ; } - State( SUPERV::KilledState ) ; + State( GraphExecutor::KilledState ) ; cdebug_out << "GraphExecutor::OutNode::ContainerKill" << endl ; return RetVal ; } @@ -1699,7 +1735,7 @@ bool GraphExecutor::OutNode::Suspend() { } } if ( RetVal ) { - State( SUPERV::SuspendedState ) ; + State( GraphExecutor::SuspendedState ) ; MESSAGE("================================================================================") ; MESSAGE( Graph()->Name() << " IS SUSPENDED" ) ; MESSAGE("================================================================================") ; @@ -1717,7 +1753,7 @@ bool GraphExecutor::OutNode::Resume() { int RetVal = 0 ; cdebug_in << "GraphExecutor::OutNode::Resume" << endl; if ( IsSuspended() ) { - State( SUPERV::ExecutingState ) ; + State( GraphExecutor::ExecutingState ) ; int i ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; @@ -1791,7 +1827,7 @@ bool GraphExecutor::OutNode::Kill() { } RetVal = true ; } - State( SUPERV::KilledState ) ; + State( GraphExecutor::KilledState ) ; if ( RetVal ) { MESSAGE("================================================================================") ; MESSAGE( Graph()->Name() << " IS KILLED" << theAutomaton->StateName( AutomatonState() ) << " EventQSize " diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx index 2676c74..72c38db 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx @@ -50,7 +50,7 @@ namespace GraphExecutor { bool _PyInitialized ; bool _Valid ; bool _Executable ; - SUPERV::AutomatonState _State ; + GraphExecutor::AutomatonState _State ; SUPERV::ControlState _ControlState ; bool _Done ; @@ -63,15 +63,15 @@ namespace GraphExecutor { int _SuspendedThreads ; list< char * > _EventNodes ; list< GraphExecutor::NodeEvent > _Events ; - list< SUPERV::AutomatonState > _States ; + list< GraphExecutor::AutomatonState > _States ; bool Valid() ; void UnValid() ; bool Executable() ; - bool LoadNodes( const GraphBase::ListOfNodes &aNodes ) ; - bool LoadLinks( const GraphBase::ListOfLinks &aLinks ) ; - bool LoadDatas( const GraphBase::ListOfLinks &aDatas ) ; + bool LoadNodes( const GraphBase::ListOfSNodes &aNodes ) ; + bool LoadLinks( const GraphBase::ListOfSLinks &aLinks ) ; + bool LoadDatas( const GraphBase::ListOfSLinks &aDatas ) ; CORBA::ORB_ptr _Orb ; @@ -107,8 +107,8 @@ namespace GraphExecutor { GraphBase::Graph * Graph() const { return _Graph ; } ; - bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ; - bool LoadXml( const char* myFileName ) ; + bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ; +// bool LoadXml( const char* myFileName ) ; bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ; GraphExecutor::InNode * AddNode( @@ -128,11 +128,6 @@ namespace GraphExecutor { const int NodeX = 0 , const int NodeY = 0 ) ; - bool AddInputData( const char* ToNodeName1 , - const char* ToParameterName1 , - const char* ToNodeName2 , - const char* ToParameterName2 ) ; - bool IsValid() { if ( !_Valid ) return Valid() ; return _Valid ; } ; @@ -170,7 +165,7 @@ namespace GraphExecutor { bool PushEvent( GraphExecutor::InNode * aNode , GraphExecutor::NodeEvent anEvent , - SUPERV::AutomatonState aState ) ; + GraphExecutor::AutomatonState aState ) ; int GetListSize(); bool StateWait( SUPERV::GraphState aState ) ; bool Event( char ** aNodeName , @@ -186,8 +181,10 @@ namespace GraphExecutor { long EventQSize() ; void EventList() ; - void State(SUPERV::AutomatonState aState ) ; - const char * StateName(SUPERV::AutomatonState aState ) { + void SendSomeDataReady( const char * aNodeName ) ; + + void State(GraphExecutor::AutomatonState aState ) ; + const char * StateName(GraphExecutor::AutomatonState aState ) { return theAutomaton->StateName( aState ) ; } SUPERV::GraphState State() ; @@ -196,10 +193,10 @@ namespace GraphExecutor { const char * ServiceParameterName ) ; SUPERV::GraphEvent AutomatonGraphEvent(GraphExecutor::NodeEvent anEvent) ; - SUPERV::GraphState AutomatonGraphState(SUPERV::AutomatonState anAutomatonState) ; + SUPERV::GraphState AutomatonGraphState(GraphExecutor::AutomatonState anAutomatonState) ; - SUPERV::AutomatonState AutomatonState() ; - SUPERV::AutomatonState AutomatonState( const char * NodeName ) ; + GraphExecutor::AutomatonState AutomatonState() ; + GraphExecutor::AutomatonState AutomatonState( const char * NodeName ) ; SUPERV::ControlState ControlState() ; SUPERV::ControlState ControlState( const char * aNodeName ) ; diff --git a/src/GraphExecutor/Makefile.in b/src/GraphExecutor/Makefile.in index 2786b4f..ccf0b54 100644 --- a/src/GraphExecutor/Makefile.in +++ b/src/GraphExecutor/Makefile.in @@ -47,7 +47,7 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ +CXXFLAGS+= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS+= -export-dynamic -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lOpUtil -lSALOMELocalTrace \ -lc $(QT_MT_LIBS) $(OGL_LIBS) \ diff --git a/src/MulComponent/MulComponent.cxx b/src/MulComponent/MulComponent.cxx deleted file mode 100644 index 1b4c41f..0000000 --- a/src/MulComponent/MulComponent.cxx +++ /dev/null @@ -1,90 +0,0 @@ -// SuperVisionTest MulComponent : example of component that multiplies two numbers -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : MulComponentEngine.cxx -// Author : MARC TAJCHMAN, CEA -// Module : SuperVisionTest - -using namespace std; -#include -#include -#include -#include -#include - -//#include "utilities.h" -#include "MulComponent.hxx" - -MulComponentEngine::MulComponentEngine( CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) -{ -// MESSAGE("MulComponentEngine::MulComponentEngine activate object instanceName(" -// << instanceName << ") interfaceName(" << interfaceName << ")" ) - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - _nexec = 0 ; -} - -MulComponentEngine::MulComponentEngine() -{ -} - -MulComponentEngine::~MulComponentEngine() -{ -} - -void MulComponentEngine::Mul( double x , double y , double & z ) { - beginService( " MulComponentEngine::Mul" ); - z = x * y ; - int S; - - sendMessage(NOTIF_STEP, "Mul is Computing"); - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z - << " ) after " << S << " seconds" ) - endService( " MulComponentEngine::Mul" ); -} - -extern "C" -{ - PortableServer::ObjectId * MulComponentEngine_factory - (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) - { - MESSAGE("MulComponentEngine_factory MulComponentEngine (" - << instanceName << "," << interfaceName << ")"); - MulComponentEngine * myMulComponent - = new MulComponentEngine(orb, poa, contId, instanceName, interfaceName); - return myMulComponent->getId() ; - } -} - - diff --git a/src/SubComponent/SubComponent.cxx b/src/SubComponent/SubComponent.cxx deleted file mode 100644 index 76ed6e1..0000000 --- a/src/SubComponent/SubComponent.cxx +++ /dev/null @@ -1,90 +0,0 @@ -// SuperVisionTest SubComponent : example of component that sunstracts one number from another -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SubComponentEngine.cxx -// Author : MARC TAJCHMAN, CEA -// Module : SuperVisionTest - -using namespace std; -#include -#include -#include -#include -#include - -//#include "utilities.h" -#include "SubComponent.hxx" - -SubComponentEngine::SubComponentEngine( CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) -{ -// MESSAGE("SubComponentEngine::SubComponentEngine activate object instanceName(" -// << instanceName << ") interfaceName(" << interfaceName << ")" ) - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - _nexec = 0 ; -} - -SubComponentEngine::SubComponentEngine() -{ -} - -SubComponentEngine::~SubComponentEngine() -{ -} - -void SubComponentEngine::Sub( double x , double y , double & z ) { - beginService( " SubComponentEngine::Sub" ); - z = x - y ; - int S; - - sendMessage(NOTIF_STEP, "Sub is Computing"); - S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z - << " ) after " << S << " seconds" ) - endService( " SubComponentEngine::Sub" ); -} - -extern "C" -{ - PortableServer::ObjectId * SubComponentEngine_factory - (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) - { - MESSAGE("SubComponentEngine_factory SubComponentEngine (" - << instanceName << "," << interfaceName << ")"); - SubComponentEngine * mySubComponent - = new SubComponentEngine(orb, poa, contId, instanceName, interfaceName); - return mySubComponent->getId() ; - } -} - - diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 452dff0..e33332e 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -28,7 +28,8 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) : + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName(" // << instanceName << ") interfaceName(" << interfaceName << ") --> " @@ -36,13 +37,21 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , // _thisObj = this ; // _id = _poa->activate_object(_thisObj); // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " ); - beginService( "CNode_Impl::CNode_Impl" ); +// beginService( "CNode_Impl::CNode_Impl" ); _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; + _DataFlowEditor = NULL ; + _DataFlowExecutor = NULL ; _DataFlowNode = NULL ; - _IsNode = false ; - endService( "CNode_Impl::CNode_Impl" ); + _DataFlowExecutorNode = NULL ; + if ( aKindOfNode == SUPERV::MacroNode ) { + _IsNode = true ; + } + else { + _IsNode = false ; + } +// endService( "CNode_Impl::CNode_Impl" ); } CNode_Impl::CNode_Impl() { @@ -53,14 +62,14 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - GraphEditor::DataFlow * DataFlowEditor , + GraphEditor::DataFlow * aDataFlowEditor , const SALOME_ModuleCatalog::Service &NodeService , const char * NodeName , const SUPERV::KindOfNode NodeKindOfNode , const char * FuncName , const SUPERV::ListOfStrings & PythonFunction ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { - beginService( "CNode_Impl::CNode_Impl" ); +// beginService( "CNode_Impl::CNode_Impl" ); // cout << "CNode_Impl::CNode_Impl -->" << endl ; // if ( FuncName && NodeName ) { // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName @@ -68,14 +77,16 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , // << " " << strlen( FuncName ) << endl ; // } if ( NodeKindOfNode == SUPERV::ComputingNode ) { - MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" ); +// MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - _DataFlowEditor = DataFlowEditor ; + _DataFlowEditor = aDataFlowEditor ; + _DataFlowExecutor = NULL ; + DataFlowEditor()->Graph()->SetGraphEditor( aDataFlowEditor ) ; GraphBase::ListOfFuncName aFuncName ; GraphBase::ListOfPythonFunctions aPythonFunction ; if ( FuncName ) { @@ -88,8 +99,9 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , NodeKindOfNode , aFuncName , aPythonFunction ) ; + _DataFlowExecutorNode = NULL ; _IsNode = true ; - endService( "CNode_Impl::CNode_Impl" ); +// endService( "CNode_Impl::CNode_Impl" ); // cout << "<-- CNode_Impl::CNode_Impl" << endl ; } @@ -98,33 +110,36 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - GraphEditor::DataFlow * DataFlowEditor , + GraphEditor::DataFlow * aDataFlowEditor , const SALOME_ModuleCatalog::Service &NodeService , const char * NodeName , const SUPERV::KindOfNode NodeKindOfNode , const GraphBase::ListOfFuncName & aFuncName , const GraphBase::ListOfPythonFunctions & aPythonFunction ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { - MESSAGE( NodeName << " " ); - beginService( "CNode_Impl::CNode_Impl" ); +// MESSAGE( NodeName << " " ); +// beginService( "CNode_Impl::CNode_Impl" ); if ( NodeName ) { - MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ; +// MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ; } if ( NodeKindOfNode == SUPERV::ComputingNode ) { - MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" ); +// MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - _DataFlowEditor = DataFlowEditor ; + _DataFlowEditor = aDataFlowEditor ; + _DataFlowExecutor = NULL ; + DataFlowEditor()->Graph()->SetGraphEditor( aDataFlowEditor ) ; _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName , NodeKindOfNode , aFuncName , aPythonFunction ) ; + _DataFlowExecutorNode = NULL ; _IsNode = true ; - endService( "CNode_Impl::CNode_Impl" ); +// endService( "CNode_Impl::CNode_Impl" ); } CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , @@ -132,26 +147,67 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - GraphEditor::DataFlow * DataFlowEditor , - GraphEditor::InNode * DataFlowNode ) : + GraphEditor::DataFlow * aDataFlowEditor , + GraphEditor::InNode * aDataFlowNode ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { - MESSAGE( DataFlowNode->Name() << " " ); - beginService( "CNode_Impl::CNode_Impl" ); - if ( DataFlowNode->IsComputingNode() ) { - MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" ); +// beginService( "CNode_Impl::CNode_Impl" ); + if ( aDataFlowNode && aDataFlowNode->IsComputingNode() ) { +// MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } else { - MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " ); +// MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " ); } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - _DataFlowEditor = DataFlowEditor ; - _DataFlowNode = DataFlowNode ; - _IsNode = true ; - endService( "CNode_Impl::CNode_Impl" ); + _DataFlowEditor = aDataFlowEditor ; + _DataFlowExecutor = NULL ; + DataFlowEditor()->Graph()->SetGraphEditor( aDataFlowEditor ) ; + _DataFlowNode = aDataFlowNode ; + _DataFlowExecutorNode = NULL ; + if ( aDataFlowNode ) { + _IsNode = true ; + } + else { + _IsNode = false ; + } +// endService( "CNode_Impl::CNode_Impl" ); +} + +CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * aDataFlowExecutor , + GraphExecutor::InNode * aDataFlowExecutorNode ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { +// beginService( "CNode_Impl::CNode_Impl" ); + if ( aDataFlowExecutorNode && aDataFlowExecutorNode->IsComputingNode() ) { +// MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; + _DataFlowEditor = NULL ; + _DataFlowExecutor = aDataFlowExecutor ; + DataFlowExecutor()->Graph()->SetGraphExecutor( aDataFlowExecutor ) ; + _DataFlowNode = NULL ; + _DataFlowExecutorNode = aDataFlowExecutorNode ; + if ( aDataFlowExecutorNode ) { + _IsNode = true ; + } + else { + _IsNode = false ; + } +// endService( "CNode_Impl::CNode_Impl" ); } CNode_Impl::~CNode_Impl() { @@ -177,6 +233,7 @@ bool CNode_Impl::Delete() { beginService( "CNode_Impl::Delete" ); bool RetVal = false ; if ( _DataFlowEditor->IsEditing() ) { + DeletePorts() ; RetVal = _DataFlowEditor->RemoveNode( Name() ) ; if ( RetVal ) { RetVal = _DataFlowEditor->UnValid() ; @@ -186,6 +243,26 @@ bool CNode_Impl::Delete() { return RetVal ; } +void CNode_Impl::DeletePorts() { + beginService( "CNode_Impl::DeletePorts" ); + if ( _DataFlowEditor->IsEditing() && _DataFlowNode ) { + int i ; + for ( i = 0 ; i < _DataFlowNode->ComputingNode()->GetNodeInPortsSize() ; i++ ) { + SUPERV::Port_var aPort = _DataFlowNode->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ; + if ( !CORBA::is_nil( aPort ) ) { + aPort->Remove() ; + } + } + for ( i = 0 ; i < _DataFlowNode->ComputingNode()->GetNodeOutPortsSize() ; i++ ) { + SUPERV::Port_var aPort = _DataFlowNode->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ; + if ( !CORBA::is_nil( aPort ) ) { + aPort->Remove() ; + } + } + } + endService( "CNode_Impl::DeletePorts" ); +} + SALOME_ModuleCatalog::Service * CNode_Impl::Service() { // beginService( "CNode_Impl::Service" ); SALOME_ModuleCatalog::Service * RetVal ; @@ -220,7 +297,8 @@ bool CNode_Impl::SetName( const char * aDataFlowName ) { aDataFlowName ) ; } else { - RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ; +// RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ; + RetVal = _DataFlowEditor->Name( aDataFlowName ) ; } } // endService( "CNode_Impl::SetName" ); @@ -262,6 +340,47 @@ bool CNode_Impl::IsStreamGraph() { // endService( "CNode_Impl::IsStreamGraph" ); return RetVal ; } +bool CNode_Impl::IsMacro() { +// beginService( "CNode_Impl::IsMacro" ); + bool RetVal = false ; + if ( _IsNode && _DataFlowNode->IsMacroNode() ) { + RetVal = true ; + } +// endService( "CNode_Impl::IsMacro" ); + return RetVal ; +} +bool CNode_Impl::IsFlowMacro() { +// beginService( "CNode_Impl::IsFlowMacro" ); + bool RetVal = false ; + if ( _IsNode && _DataFlowNode->IsMacroNode() && _DataFlowNode->ComputingNode()->MacroObject()->IsGraph() ) { + RetVal = true ; + } +// endService( "CNode_Impl::IsFlowMacro" ); + return RetVal ; +} +bool CNode_Impl::IsStreamMacro() { +// beginService( "CNode_Impl::IsStreamMacro" ); + bool RetVal = false ; + if ( _IsNode && _DataFlowNode->IsMacroNode() && _DataFlowNode->ComputingNode()->MacroObject()->IsStreamGraph() ) { + RetVal = true ; + } +// endService( "CNode_Impl::IsStreamMacro" ); + return RetVal ; +} +bool CNode_Impl::IsHeadGraph() { + bool RetVal = false ; + beginService( "CNode_Impl::IsHeadGraph" ); + endService( "CNode_Impl::IsHeadGraph" ); + return RetVal ; +} +long CNode_Impl::GraphLevel() { + long RetVal = 0 ; + beginService( "CNode_Impl::GraphLevel" ); + RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ; + endService( "CNode_Impl::GraphLevel" ); + return RetVal ; +} + bool CNode_Impl::IsComputing() { // beginService( "CNode_Impl::IsComputing" ); bool RetVal = SUPERV::UnknownNode ; @@ -605,7 +724,7 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName , GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; bool sts = false ; GraphBase::InPort * anInPort = NULL ; - if ( _DataFlowEditor->IsEditing() ) { + if ( _DataFlowEditor->IsEditing() && _DataFlowEditor->Graph()->GraphMacroLevel() == 0 ) { if ( _IsNode ) { sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() , ToServiceParameterName , @@ -692,6 +811,49 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName , return SUPERV::Port::_duplicate( iobject ) ; } +#if 0 +bool CNode_Impl::InputOfAny( const char * ToServiceParameterName , + const CORBA::Any & aValue ) { + beginService( "CNode_Impl::InputOfAny" ); + GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; + bool RetVal = false ; + MESSAGE( pthread_self() << "CNode_Impl::InputOfAny " << Name() << "(" << ToServiceParameterName << ")" ) ; + if ( !_DataFlowEditor->IsEditing() && _DataFlowExecutor && _DataFlowEditor->Graph()->GraphMacroLevel() ) { + if ( !_IsNode ) { + GraphBase::OutPort * anOutPort ; + anOutPort = _DataFlowExecutor->Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ; + MESSAGE( pthread_self() << "CNode_Impl::InputOfAny " << _DataFlowExecutor->Graph()->Name() << " " << ToServiceParameterName + << " " << anOutPort->State() << " Done " << anOutPort->Done() ) ; + RetVal = _DataFlowExecutor->AddInputData( _DataFlowExecutor->Graph()->Name() , + ToServiceParameterName , + aValue ) ; + anOutPort->State( SUPERV::ReadyState ) ; + anOutPort->Done( true ) ; + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) _DataFlowExecutor->Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ; + MESSAGE( pthread_self() << "CNode_Impl::InputOfAny : " << anInNode->Name() << "->SendSomeDataReady( " + << _DataFlowExecutor->Graph()->Name() << " ) " ) ; + anInNode->SendSomeDataReady( _DataFlowExecutor->Graph()->Name() ) ; + if ( anInNode->IsReady() ) { + MESSAGE( pthread_self() << "CNode_Impl::InputOfAny : " << anInNode->Name() + << "->SendEvent( GraphExecutor::ExecuteEvent ) " + << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State " + << anInNode->State() ) ; + if ( anInNode->IsLockedDataWait() ) { + MESSAGE( pthread_self() << "CNode_Impl::InputOfAny : " << anInNode->Name() + << " IsLockedDataWait() ==> UnLockDataWait" ) ; + anInNode->UnLockDataWait() ; + } + anInNode->CreateNewThread( true ) ; + anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ; + _DataFlowExecutor->State( GraphExecutor::ExecutingState ) ; + } + } + } + endService( "CNode_Impl::InputOfAny" ); + return RetVal ; +} +#endif + SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) { SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ; Port_Impl * myInPort = NULL ; @@ -796,6 +958,13 @@ SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName return SUPERV::StreamPort::_duplicate( Outobject ); } +bool CNode_Impl::HasStreamPort() { + bool RetVal = false ; + beginService( "CNode_Impl::HasStreamPort" ); + endService( "CNode_Impl::HasStreamPort" ); + return RetVal ; +} + SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) { bool begin = true ; SUPERV::Link_var iobject = SUPERV::Link::_nil() ; @@ -895,8 +1064,6 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { int PortCount = 0 ; SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ; if ( _IsNode ) { -// RetVal->length( _DataFlowNode->GetNodeInPortsSize() + -// _DataFlowNode->GetNodeOutPortsSize() ) ; for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) { GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ; if ( !anInPort->IsDataStream() ) { @@ -904,15 +1071,14 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { beginService( "CNode_Impl::Ports" ); begin = false ; } - if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && + if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() && ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { - MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; -// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; +// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; } else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { - MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " - << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() - << "/" << anInPort->IsConnected() ) ; +// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " +// << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() +// << "/" << anInPort->IsNotConnected() ) ; Port_Impl * myPort ; if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) { const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; @@ -942,15 +1108,14 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; } else { - MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ; +// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ; PortCount += 1 ; RetVal->length( PortCount ) ; RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ; } } else { - MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; -// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; +// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; } } for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) { @@ -960,13 +1125,12 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { beginService( "CNode_Impl::Ports" ); begin = false ; } - if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() && + if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() && ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { - MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; -// RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; +// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; } else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { - MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; +// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; const CORBA::Any * anAny = anOutPort->Value() ; Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , @@ -985,15 +1149,14 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; } else { - MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; +// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; PortCount += 1 ; RetVal->length( PortCount ) ; RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ; } } else { - MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; -// RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; +// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; } } } @@ -1044,7 +1207,6 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { } } else { -// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; } } j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; @@ -1091,15 +1253,16 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { } } else { -// RetVal[ j + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; } } } } -// int RetVallength = (unsigned int ) RetVal->length() ; -// for ( i = 0 ; i < RetVallength ; i++ ) { -// MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ; -// } +#if 0 + int RetVallength = (unsigned int ) RetVal->length() ; + for ( i = 0 ; i < RetVallength ; i++ ) { + MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ; + } +#endif if ( !begin ) { endService( "CNode_Impl::Ports " ) ; } @@ -1124,7 +1287,7 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { beginService( "CNode_Impl::StreamPorts" ); begin = false ; } - if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && + if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() && ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; @@ -1132,7 +1295,7 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() - << "/" << anInPort->IsConnected() ) ; + << "/" << anInPort->IsNotConnected() ) ; StreamPort_Impl * myStreamPort ; if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) { const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; @@ -1179,7 +1342,7 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { beginService( "CNode_Impl::StreamPorts" ); begin = false ; } - if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() && + if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() && ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; // RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; @@ -1328,6 +1491,7 @@ SUPERV::ListOfLinks * CNode_Impl::Links() { beginService( "CNode_Impl::Links" ) ; SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; if ( _DataFlowNode ) { +// MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << _DataFlowNode->ComputingNode() << " " << _DataFlowNode->ComputingNode()->Name() ) ; RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ; } else { @@ -1418,9 +1582,9 @@ long CNode_Impl::Thread() { // endService( "CNode_Impl::Thread" ); return RetVal ; } -SUPERV::AutomatonState CNode_Impl::AutoState() { +GraphExecutor::AutomatonState CNode_Impl::AutoState() { // beginService( "CNode_Impl::AutoState" ); - SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ; + GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ; GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { if ( _IsNode ) { @@ -1727,6 +1891,7 @@ bool CNode_Impl::Run() { beginService( "CNode_Impl::Run" ); bool RetVal = false ; GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; + MESSAGE( "CNode_Impl::Run DataFlowExecutor " << _DataFlowExecutor << Name() << " _IsNode " << _IsNode ) ; if ( _DataFlowExecutor ) { _DataFlowEditor->EditedAfterExecution( false ) ; if ( _IsNode ) { diff --git a/src/Supervision/CNode_Impl.hxx b/src/Supervision/CNode_Impl.hxx index eeb4028..d67d4d2 100644 --- a/src/Supervision/CNode_Impl.hxx +++ b/src/Supervision/CNode_Impl.hxx @@ -31,8 +31,10 @@ class CNode_Impl : public POA_SUPERV::CNode , PortableServer::POA_ptr _Poa ; PortableServer::ObjectId * _ContId ; - GraphEditor::DataFlow * _DataFlowEditor ; - GraphEditor::InNode * _DataFlowNode ; + GraphEditor::DataFlow * _DataFlowEditor ; + GraphExecutor::DataFlow * _DataFlowExecutor ; + GraphEditor::InNode * _DataFlowNode ; + GraphExecutor::InNode * _DataFlowExecutorNode ; bool _IsNode ; public: @@ -42,7 +44,8 @@ class CNode_Impl : public POA_SUPERV::CNode , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) ; + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) ; CNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -72,18 +75,35 @@ class CNode_Impl : public POA_SUPERV::CNode , const char *interfaceName , GraphEditor::DataFlow * DataFlowEditor , GraphEditor::InNode * DataFlowNode ) ; + CNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * DataFlowExecutor , + GraphExecutor::InNode * DataFlowExecutorNode ) ; virtual ~CNode_Impl() ; virtual void destroy() ; virtual bool Delete() ; + void DeletePorts() ; + virtual void DataFlowEditor( GraphEditor::DataFlow * DataFlowEditor ) { _DataFlowEditor = DataFlowEditor ; } ; virtual GraphEditor::DataFlow * DataFlowEditor() { return _DataFlowEditor ; } ; + virtual void DataFlowExecutor( GraphExecutor::DataFlow * DataFlowExecutor ) { + _DataFlowExecutor = DataFlowExecutor ; } ; + virtual GraphExecutor::DataFlow * DataFlowExecutor() { + return _DataFlowExecutor ; } ; virtual void DataFlowNode( GraphEditor::InNode * DataFlowNode ) { _DataFlowNode = DataFlowNode ; } ; virtual GraphEditor::InNode * DataFlowNode() { return _DataFlowNode ; } ; + virtual void DataFlowNode( GraphExecutor::InNode * DataFlowExecutorNode ) { + _DataFlowExecutorNode = DataFlowExecutorNode ; } ; + virtual GraphExecutor::InNode * DataFlowExecutorNode() { + return _DataFlowExecutorNode ; } ; virtual char * Name() ; virtual bool SetName( const char * aDataFlowName ) ; @@ -116,7 +136,13 @@ class CNode_Impl : public POA_SUPERV::CNode , _DataFlowNode->SetObjRef( aNode ) ; } else { - _DataFlowEditor->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ; + if ( _DataFlowEditor ) { + _DataFlowEditor->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ; + } + if ( _DataFlowExecutor ) { + _DataFlowExecutor->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ; + } + } } ; @@ -138,6 +164,8 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName , const SUPERV::Value_ptr aValue ) ; +// virtual bool InputOfAny( const char * ToServiceParameterName , +// const CORBA::Any & aValue ) ; virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ; virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ; @@ -148,6 +176,8 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual SUPERV::ListOfPorts * Ports() ; virtual SUPERV::ListOfStreamPorts * StreamPorts() ; + virtual bool HasStreamPort() ; + virtual SUPERV::ListOfLinks * Links() ; virtual SUPERV::ListOfStreamLinks * StreamLinks() ; @@ -156,6 +186,11 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual bool IsStreamGraph() ; virtual bool IsGraph() ; + virtual bool IsMacro() ; + virtual bool IsFlowMacro() ; + virtual bool IsStreamMacro() ; + virtual bool IsHeadGraph() ; + virtual long GraphLevel() ; virtual bool IsComputing() ; virtual bool IsFactory() ; virtual bool IsInLine() ; @@ -186,7 +221,7 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual long Thread() ; - virtual SUPERV::AutomatonState AutoState() ; + GraphExecutor::AutomatonState AutoState() ; virtual bool ReadyW() ; virtual bool RunningW() ; diff --git a/src/Supervision/ELNode_Impl.cxx b/src/Supervision/ELNode_Impl.cxx index 86290ca..e5913bd 100644 --- a/src/Supervision/ELNode_Impl.cxx +++ b/src/Supervision/ELNode_Impl.cxx @@ -98,6 +98,7 @@ bool ELNode_Impl::Delete() { MESSAGE("--------> ELNode_Impl::Delete() BEGIN"); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; MESSAGE("--------> In Delete: Editing dataflow"); RetVal = DataFlowEditor()->RemoveNode( Name() ) ; MESSAGE("--------> RetVal = "<IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) RetVal = DataFlowEditor()->IsValid() ; diff --git a/src/Supervision/FNode_Impl.cxx b/src/Supervision/FNode_Impl.cxx index d5c9f0c..290df45 100644 --- a/src/Supervision/FNode_Impl.cxx +++ b/src/Supervision/FNode_Impl.cxx @@ -93,6 +93,7 @@ bool FNode_Impl::Delete() { // beginService( "FNode_Impl::Delete" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) RetVal = DataFlowEditor()->IsValid() ; diff --git a/src/Supervision/GNode_Impl.cxx b/src/Supervision/GNode_Impl.cxx index 02fc37e..6d7cd4a 100644 --- a/src/Supervision/GNode_Impl.cxx +++ b/src/Supervision/GNode_Impl.cxx @@ -22,6 +22,27 @@ using namespace std; GNode_Impl::GNode_Impl() { } +GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) : + INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) { +// MESSAGE("GNode_Impl::GNode_Impl activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName << ") --> " +// << hex << (void *) this << dec ) +// _thisObj = this ; +// _id = _poa->activate_object(_thisObj); +// MESSAGE( "GNode_Impl::GNode_Impl " << aDataFlowName ); +// beginService( "GNode_Impl::GNode_Impl" ); + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; +// endService( "INode_Impl::INode_Impl" ); +} + GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -34,7 +55,7 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , PythonFunction , NodeKindOfNode ) { // MESSAGE( NodeName << " " ); - beginService( "GNode_Impl::GNode_Impl" ); +// beginService( "GNode_Impl::GNode_Impl" ); if ( FuncName ) { // cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName // << " " << strlen( FuncName ) << endl ; @@ -52,7 +73,7 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() , // "" , "" , "" , // NodeKindOfNode ) ) ; - endService( "GNode_Impl::GNode_Impl" ); +// endService( "GNode_Impl::GNode_Impl" ); } GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , @@ -67,7 +88,7 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncNameList , PythonFunctionList , NodeKindOfNode ) { // MESSAGE( NodeName << " " ); - beginService( "GNode_Impl::GNode_Impl" ); +// beginService( "GNode_Impl::GNode_Impl" ); if ( NodeKindOfNode == SUPERV::GOTONode ) { _thisObj = this ; _id = _poa->activate_object(_thisObj); @@ -81,7 +102,7 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() , // "" , "" , "" , // NodeKindOfNode ) ) ; - endService( "GNode_Impl::GNode_Impl" ); +// endService( "GNode_Impl::GNode_Impl" ); } GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , @@ -93,16 +114,45 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , GraphEditor::InNode * aDataFlowNode ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) { - MESSAGE( DataFlowNode()->Name() << " " ); - beginService( "GNode_Impl::GNode_Impl" ); - if ( DataFlowNode()->IsGOTONode() ) { +// beginService( "GNode_Impl::GNode_Impl" ); + if ( DataFlowNode() && DataFlowNode()->IsGOTONode() ) { +// MESSAGE( "GNode_Impl::GNode_Impl " << DataFlowNode()->PyFuncName() +// << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } + else { +// MESSAGE( "GNode_Impl::GNode_Impl NO _poa->activate_object" ); + } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - endService( "GNode_Impl::GNode_Impl" ); +// endService( "GNode_Impl::GNode_Impl" ); +} + +GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * aDataFlowExecutor , + GraphExecutor::InNode * aDataFlowExecutorNode ) : +// Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { + INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowExecutor , aDataFlowExecutorNode ) { +// beginService( "GNode_Impl::GNode_Impl" ); + if ( DataFlowExecutorNode() && DataFlowExecutorNode()->IsGOTONode() ) { +// MESSAGE( "GNode_Impl::GNode_Impl " << DataFlowExecutorNode()->Name() +// << " _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "GNode_Impl::GNode_Impl NO _poa->activate_object" ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; +// endService( "GNode_Impl::GNode_Impl" ); } GNode_Impl::~GNode_Impl() { @@ -127,6 +177,7 @@ bool GNode_Impl::Delete() { beginService( "GNode_Impl::Delete" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) RetVal = DataFlowEditor()->IsValid() ; @@ -138,19 +189,38 @@ bool GNode_Impl::Delete() { SUPERV::INode_ptr GNode_Impl::Coupled() { // beginService( "GNode_Impl::Coupled" ); SUPERV::INode_var iobject = SUPERV::INode::_nil() ; - if ( DataFlowNode()->CoupledNode() ) { - if ( CORBA::is_nil( DataFlowNode()->CoupledNode()->ObjRef() ) ) { - INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - DataFlowEditor() , - (GraphEditor::InNode *) DataFlowNode()->CoupledNode()->GetInNode() ) ; - PortableServer::ObjectId * id = myNode->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - iobject = SUPERV::INode::_narrow(obj) ; - myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ; + if ( DataFlowNode() ) { + if ( DataFlowNode()->CoupledNode() ) { + if ( CORBA::is_nil( DataFlowNode()->CoupledNode()->ObjRef() ) ) { + INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + (GraphEditor::InNode *) DataFlowNode()->CoupledNode()->GetInNode() ) ; + PortableServer::ObjectId * id = myNode->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::INode::_narrow(obj) ; + myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ; + } + else { + iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ; + } } - else { - iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ; + } + else { + if ( DataFlowEditor()->Graph()->CoupledNode() ) { + if ( CORBA::is_nil( DataFlowEditor()->Graph()->CoupledNode()->ObjRef() ) ) { + INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + (GraphEditor::InNode *) DataFlowEditor()->Graph()->CoupledNode()->GetInNode() ) ; + PortableServer::ObjectId * id = myNode->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::INode::_narrow(obj) ; + myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ; + } + else { + iobject = SUPERV::INode::_narrow( DataFlowEditor()->Graph()->CoupledNode()->ObjRef() ) ; + } } } // endService( "GNode_Impl::Coupled" ); diff --git a/src/Supervision/GNode_Impl.hxx b/src/Supervision/GNode_Impl.hxx index 3821296..52ddcc1 100644 --- a/src/Supervision/GNode_Impl.hxx +++ b/src/Supervision/GNode_Impl.hxx @@ -36,6 +36,13 @@ class GNode_Impl : public INode_Impl , public: GNode_Impl(); + GNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) ; GNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -61,6 +68,13 @@ class GNode_Impl : public INode_Impl , const char *interfaceName , GraphEditor::DataFlow * DataFlowEditor , GraphEditor::InNode * DataFlowNode ) ; + GNode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * DataFlowExecutor , + GraphExecutor::InNode * DataFlowExecutorNode ) ; virtual ~GNode_Impl() ; virtual void destroy() ; virtual bool Delete() ; diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index abbebd9..31358d7 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -34,33 +34,21 @@ using namespace std; //#include "utilities.h" -#include "Graph_Impl.hxx" +#include "StreamGraph_Impl.hxx" #include "DataFlowEditor_DataFlow.hxx" extern GraphExecutor::FiniteStateMachine * theAutomaton ; -Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char *instanceName , - const char *interfaceName , - const char *aDataFlowName , - const SUPERV::KindOfNode aKindOfNode ) : - INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName ) { -// MESSAGE("Graph_Impl::Graph_Impl activate object instanceName(" -// << instanceName << ") interfaceName(" << interfaceName << ") --> " -// << hex << (void *) this << dec ) - beginService( "Graph_Impl::Graph_Impl" ); - _Orb = CORBA::ORB::_duplicate(orb); - _Poa = poa ; - _ContId = contId ; - if ( aKindOfNode == SUPERV::DataFlowGraph ) { - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - } - - string dbgfile = "/tmp/" ; +static void CreateEditor( CORBA::ORB_ptr orb , + const char *instanceName , + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode , + string & dbgfile , + GraphEditor::DataFlow ** aDataFlowEditor ) { +// string dbgfile = "/tmp/" ; + bool aXmlFile = false ; + dbgfile = "/tmp/" ; dbgfile += instanceName ; dbgfile += "_" ; int lenname = strlen( aDataFlowName ) ; @@ -70,35 +58,167 @@ Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , if ( lenname > 4 && !strcmp( &aDataFlowName[ lenname - 4 ] , ".xml" ) ) { strncpy( theDataFlowName , &aDataFlowName[ 0 ] , lenname-4 ) ; theDataFlowName[ lenname-4 ] = '\0' ; + aXmlFile = true ; int i ; for ( i = lenname - 5 ; i >= 0 ; i-- ) { if ( aDataFlowName[ i ] == '/' ) { strncpy( theDataFlowName , &aDataFlowName[ i + 1 ] , lenname-5-i ) ; theDataFlowName[ lenname-5-i ] = '\0' ; break ; - } + } } } else { strcpy( theDataFlowName , &aDataFlowName[ 0 ] ) ; } - dbgfile += theDataFlowName ; } - dbgfile += ".log" ; - _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ; - strcpy( _DebugFileName , dbgfile.c_str() ) ; + string theDataFlowInstanceName = theDataFlowName ; + if ( !aXmlFile ) { + theDataFlowInstanceName = theAutomaton->GraphInstanceName( theDataFlowName ) ; + } + dbgfile += theDataFlowInstanceName ; + dbgfile = dbgfile + "_" + theAutomaton->DbgFileNumber() + ".log" ; + SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ; + *aDataFlowEditor = new GraphEditor::DataFlow( orb , NamingService , + theDataFlowInstanceName.c_str() , dbgfile.c_str() , + aKindOfNode ) ; + MESSAGE( "CreateEditor " << theDataFlowName << " uniquely named " << theDataFlowInstanceName << " created with " + << dbgfile.c_str() ) ; + delete [] theDataFlowName ; +} + +static void CreateEditor( CORBA::ORB_ptr orb , + const char *instanceName , + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode , + string & dbgfile , + GraphExecutor::DataFlow ** aDataFlowExecutor ) { +// string dbgfile = "/tmp/" ; + dbgfile = "/tmp/" ; + dbgfile += instanceName ; + dbgfile += "_" ; + int lenname = strlen( aDataFlowName ) ; + char * theDataFlowName = new char [ lenname+1 ] ; + strcpy( theDataFlowName , aDataFlowName ) ; + if ( aDataFlowName ) { + strcpy( theDataFlowName , &aDataFlowName[ 0 ] ) ; + } + string theDataFlowInstanceName = theDataFlowName ; + dbgfile += theDataFlowInstanceName ; + dbgfile = dbgfile + "_" + theAutomaton->DbgFileNumber() ; + + ostringstream astr ; + astr << theAutomaton->ExecNumber() ; + dbgfile += astr.str() ; + dbgfile += string( "_Exec.log" ) ; + + SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ; + *aDataFlowExecutor = new GraphExecutor::DataFlow( orb , NamingService , + theDataFlowInstanceName.c_str() , dbgfile.c_str() , + aKindOfNode ) ; + MESSAGE( "CreateEditor " << theDataFlowName << " " << theDataFlowInstanceName << " created with " + << dbgfile.c_str() ) ; + delete [] theDataFlowName ; +} + +Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) : + GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) { +// MESSAGE("Graph_Impl::Graph_Impl activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName << ") --> " +// << hex << (void *) this << dec ) +// beginService( "Graph_Impl::Graph_Impl" ); + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; + if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::MacroNode ) { +// MESSAGE( "Graph_Impl::Graph_Impl _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "Graph_Impl::Graph_Impl NO _poa->activate_object " ); + } - _NamingService = new SALOME_NamingService( orb ) ; - GraphEditor::DataFlow * aDataFlowEditor ; - aDataFlowEditor = new GraphEditor::DataFlow( _Orb , _NamingService , - theDataFlowName , _DebugFileName , - aKindOfNode ) ; + if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::DataStreamGraph ) { + string dbgfile ; + GraphEditor::DataFlow * aDataFlowEditor ; + CreateEditor( orb , instanceName , aDataFlowName , aKindOfNode , + dbgfile , &aDataFlowEditor ) ; + _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ; + strcpy( _DebugFileName , dbgfile.c_str() ) ; + + _NamingService = new SALOME_NamingService( orb ) ; + DataFlowEditor( aDataFlowEditor ) ; + DataFlowEditor()->Graph()->SetGraphEditor( aDataFlowEditor ) ; + DataFlowEditor()->Graph()->SetObjImpl( this ) ; + } + pthread_mutex_init( &_MutexExecutorWait , NULL ) ; +// DataFlowExecutor( NULL ) ; +// endService( "Graph_Impl::Graph_Impl" ); +} + +Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphEditor::DataFlow * aDataFlowEditor , + GraphEditor::InNode * aDataFlowNode ) : + GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) { +// beginService( "Graph_Impl::Graph_Impl" ); +// MESSAGE( aDataFlowEditor->Graph()->Name() << " " ); + if ( aDataFlowEditor->Graph()->IsDataFlowNode() || aDataFlowNode->IsMacroNode() ) { +// MESSAGE( "Graph_Impl::Graph_Impl _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "Graph_Impl::Graph_Impl NO _poa->activate_object " ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; DataFlowEditor( aDataFlowEditor ) ; + DataFlowEditor()->Graph()->SetGraphEditor( aDataFlowEditor ) ; DataFlowEditor()->Graph()->SetObjImpl( this ) ; pthread_mutex_init( &_MutexExecutorWait , NULL ) ; - _DataFlowExecutor = NULL ; - delete [] theDataFlowName ; - endService( "Graph_Impl::Graph_Impl" ); +// DataFlowExecutor( NULL ) ; +// endService( "Graph_Impl::Graph_Impl" ); +} + +Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * aDataFlowExecutor , + GraphExecutor::InNode * aDataFlowExecutorNode ) : + GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowExecutor , aDataFlowExecutorNode ) { +// beginService( "Graph_Impl::Graph_Impl" ); +// MESSAGE( aDataFlowExecutor->Graph()->Name() << " " ); + if ( aDataFlowExecutor->Graph()->IsDataFlowNode() || aDataFlowExecutorNode->IsMacroNode() ) { +// MESSAGE( "Graph_Impl::Graph_Impl _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "Graph_Impl::Graph_Impl NO _poa->activate_object " ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; + DataFlowExecutor( aDataFlowExecutor ) ; + DataFlowExecutor()->Graph()->SetGraphExecutor( aDataFlowExecutor ) ; + DataFlowExecutor()->Graph()->SetObjImpl( this ) ; + pthread_mutex_init( &_MutexExecutorWait , NULL ) ; +// DataFlowExecutor( NULL ) ; +// endService( "Graph_Impl::Graph_Impl" ); } Graph_Impl::Graph_Impl() { @@ -118,8 +238,12 @@ void Graph_Impl::destroy() { // endService( "Graph_Impl::destroy" ); } + char* Graph_Impl::getIOR() { - if (CORBA::is_nil(myServant)) { + if ( IsMacro() ) { + return CORBA::string_dup( NULLSTRING ) ; + } + else if ( CORBA::is_nil( myServant ) ) { PortableServer::ObjectId* id = getId(); CORBA::Object_var obj; obj = _poa->id_to_reference(*id); @@ -130,16 +254,18 @@ char* Graph_Impl::getIOR() { SUPERV::Graph_ptr Graph_Impl::Copy() { beginService( "Graph_Impl::Copy" ); - Graph_Impl * myGraph ; - myGraph = new Graph_Impl( _Orb , _Poa, _ContId, - instanceName() , interfaceName() , - DataFlowEditor()->Graph()->Name() , SUPERV::DataFlowGraph ) ; - PortableServer::ObjectId * id = myGraph->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Graph_var iobject ; - iobject = SUPERV::Graph::_narrow(obj) ; - GraphBase::SGraph * aSGraph = GetGraph() ; - myGraph->LoadGraph( aSGraph ) ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; + if ( !IsMacro() ) { + Graph_Impl * myGraph ; + myGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + DataFlowEditor()->Graph()->Name() , SUPERV::DataFlowGraph ) ; + PortableServer::ObjectId * id = myGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::Graph::_narrow(obj) ; + GraphBase::ListOfSGraphs * aListOfSGraphs = GetGraphs() ; + myGraph->LoadGraphs( aListOfSGraphs ) ; + } endService( "Graph_Impl::Copy" ); return SUPERV::Graph::_duplicate(iobject) ; } @@ -158,103 +284,68 @@ SUPERV::INode_ptr Graph_Impl::Node() { return SUPERV::Graph::_duplicate(iobject) ; } -GraphBase::SGraph * Graph_Impl::GetGraph() { - return DataFlowEditor()->GetDataFlow() ; +GraphBase::ListOfSGraphs * Graph_Impl::GetGraphs() { + return DataFlowEditor()->GetDataFlows() ; } -#if 0 -char * Graph_Impl::DataFlowInfo() { - beginService( "Graph_Impl::DataFlowInfo" ); - char * RetVal = DataFlowEditor()->DataFlowInfo() ; - endService( "Graph_Impl::DataFlowInfo" ); - return CORBA::string_dup( RetVal ) ; -} - -char * Graph_Impl::DataNodeInfo() { - beginService( "Graph_Impl::DataNodeInfo" ); - char * RetVal = DataFlowEditor()->DataNodeInfo() ; - endService( "Graph_Impl::DataNodeInfo" ); - return CORBA::string_dup( RetVal ) ; -} - -char * Graph_Impl::NodeInfo( const char * aNodeName ) { - beginService( "Graph_Impl::NodeInfo" ); - char * RetVal = DataFlowEditor()->NodeInfo( aNodeName ) ; - endService( "Graph_Impl::NodeInfo" ); - return CORBA::string_dup( RetVal ) ; -} -#endif - -bool Graph_Impl::LoadGraph(const GraphBase::SGraph * aDataFlow ) { -// beginService( "Graph_Impl::LoadGraph" ); +bool Graph_Impl::LoadGraphs( GraphBase::ListOfSGraphs * aListOfDataFlows ) { + beginService( "Graph_Impl::LoadGraphs" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { - RetVal = DataFlowEditor()->LoadDataFlow( aDataFlow ) ; +// RetVal = DataFlowEditor()->LoadDataFlows( aListOfDataFlows ) ; + RetVal = LoadDataFlows( DataFlowEditor() , aListOfDataFlows , 0 ) ; } -// endService( "Graph_Impl::LoadGraph" ); + endService( "Graph_Impl::LoadGraphs" ); return RetVal ; } bool Graph_Impl::Import(const char * aXmlFile ) { -// beginService( "Graph_Impl::Import" ); + beginService( "Graph_Impl::Import" ); bool RetVal = false ; - if ( DataFlowEditor()->IsEditing() ) { - RetVal = DataFlowEditor()->LoadXml( aXmlFile ) ; + if ( DataFlowEditor()->IsEditing() && !IsMacro() ) { + GraphBase::ListOfSGraphs aListOfDataFlows ; + RetVal = DataFlowEditor()->LoadXml( aXmlFile , aListOfDataFlows ) ; + if ( RetVal && aXmlFile != NULL ) { +// RetVal = DataFlowEditor()->LoadDataFlows( &aListOfDataFlows ) ; + RetVal = LoadDataFlows( DataFlowEditor() , &aListOfDataFlows , 0 ) ; + } } -// endService( "Graph_Impl::Import" ); + endService( "Graph_Impl::Import" ); return RetVal ; } bool Graph_Impl::Export(const char * anXmlFile ) { beginService( "Graph_Impl::Export" ); - char * aFile = new char [ strlen( anXmlFile ) + 5 ] ; - strcpy( aFile , anXmlFile ) ; - int len = strlen( aFile ) ; - if ( !strcmp( &aFile[ len - 4 ] , ".xml" ) ) { - } - else if ( !strcmp( &aFile[ len - 3 ] , ".py" ) ) { - strcpy( &aFile[ len - 3 ] , ".xml" ) ; - len = strlen( aFile ) ; - } - else { - strcat( aFile , ".xml" ) ; - len = strlen( aFile ) ; - } - bool RetVal = DataFlowEditor()->SaveXml( aFile ) ; - if ( RetVal ) { - strcpy( &aFile[ len - 4 ] , ".py" ) ; - RetVal = DataFlowEditor()->SavePy( aFile ) ; + bool RetVal = false ; + if ( !IsMacro() ) { + char * aFile = new char [ strlen( anXmlFile ) + 5 ] ; + strcpy( aFile , anXmlFile ) ; + int len = strlen( aFile ) ; + if ( !strcmp( &aFile[ len - 4 ] , ".xml" ) ) { + } + else if ( !strcmp( &aFile[ len - 3 ] , ".py" ) ) { + strcpy( &aFile[ len - 3 ] , ".xml" ) ; + len = strlen( aFile ) ; + } + else { + strcat( aFile , ".xml" ) ; + len = strlen( aFile ) ; + } + RetVal = DataFlowEditor()->SaveXml( aFile ) ; + if ( RetVal ) { + strcpy( &aFile[ len - 4 ] , ".py" ) ; + RetVal = DataFlowEditor()->SavePy( aFile ) ; + } + delete [] aFile ; } - delete [] aFile ; endService( "Graph_Impl::Export" ); return RetVal ; } -#if 0 -GraphBase::ListOfNodes * Graph_Impl::GetNodes() { -// beginService( "Graph_Impl::GetNodes" ); - GraphBase::ListOfNodes * RetVal = DataFlowEditor()->GetNodes() ; -// endService( "Graph_Impl::GetNodes" ); - return RetVal ; -} -GraphBase::ListOfLinks * Graph_Impl::GetLinks() { -// beginService( "Graph_Impl::GetLinks" ); - GraphBase::ListOfLinks * RetVal = DataFlowEditor()->GetLinks() ; -// endService( "Graph_Impl::GetLinks" ); - return RetVal ; -} -GraphBase::ListOfLinks * Graph_Impl::GetDatas() { -// beginService( "Graph_Impl::GetDatas" ); - GraphBase::ListOfLinks * RetVal = DataFlowEditor()->GetDatas() ; -// endService( "Graph_Impl::GetDatas" ); - return RetVal ; -} -#endif - SUPERV::CNode_ptr Graph_Impl::CNode( const SALOME_ModuleCatalog::Service &NodeService ) { beginService( "Graph_Impl::CNode" ); SUPERV::CNode_var iobject = SUPERV::CNode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -276,7 +367,7 @@ SUPERV::FNode_ptr Graph_Impl::FNode( const char * NodeComponentName , const SALOME_ModuleCatalog::Service &NodeService ) { beginService( "Graph_Impl::FNode" ); SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -298,7 +389,7 @@ SUPERV::INode_ptr Graph_Impl::INode( const char * FuncName , const SUPERV::ListOfStrings & PythonFuntion ) { beginService( "Graph_Impl::INode" ); SUPERV::INode_var iobject = SUPERV::INode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -321,7 +412,7 @@ SUPERV::GNode_ptr Graph_Impl::GNode( const char * FuncName , const char * anInLineNode ) { beginService( "Graph_Impl::GNode" ); SUPERV::GNode_var iobject = SUPERV::GNode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { GNode_Impl * myNode = new GNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -355,7 +446,7 @@ SUPERV::LNode_ptr Graph_Impl::LNode( const char * InitName , beginService( "Graph_Impl::LNode" ); SUPERV::LNode_var iobject = SUPERV::LNode::_nil() ; SUPERV::ELNode_var iendobject = SUPERV::ELNode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { GraphBase::ListOfFuncName FuncNameList ; FuncNameList.resize(3) ; FuncNameList[0] = InitName ; @@ -417,7 +508,7 @@ SUPERV::SNode_ptr Graph_Impl::SNode( const char * FuncName , beginService( "Graph_Impl::SNode" ); SUPERV::SNode_var iobject = SUPERV::SNode::_nil() ; SUPERV::ESNode_var iendobject = SUPERV::ESNode::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) { + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { SNode_Impl * myNode = new SNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -464,6 +555,469 @@ SUPERV::SNode_ptr Graph_Impl::SNode( const char * FuncName , return SUPERV::SNode::_duplicate( iobject ) ; } +// WARNING : THIS IS COMPLICATED : +bool Graph_Impl::LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor , + GraphBase::ListOfSGraphs * aListOfDataFlows , + int index ) { + beginService( "Graph_Impl::EditorLoadDataFlows" ) ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; + if ( !aDataFlowEditor->LoadDataFlow( &(*aListOfDataFlows)[ index ] ) ) { + MESSAGE("Graph_Impl::LoadDataFlows failed" ) ; + return false ; + } +// That graph is not a StreamGraph : + else if ( !aDataFlowEditor->Graph()->HasDataStream() ) { + aDataFlowEditor->Graph()->Kind( SUPERV::DataFlowGraph ) ; + aDataFlowEditor->Graph()->SetGraphEditor( aDataFlowEditor ) ; + Graph_Impl * myGraph ; +// We create a Graph ObjRef for that graph + myGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aDataFlowEditor , NULL ) ; + PortableServer::ObjectId * id = myGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + iobject = SUPERV::Graph::_narrow( obj ) ; + myGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + GraphBase::Graph * aGraph = myGraph->DataFlowEditor()->Graph() ; + int i ; + for ( i = 0 ; i < aGraph->GraphNodesSize() ; i++ ) { + if ( aGraph->GraphNodes( i )->IsMacroNode() ) { + GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) aGraph->GraphNodes( i ) ; + + + +// Creation of a GraphMacroNode in the current editor + SUPERV::Graph_var macroiobject = SUPERV::Graph::_nil() ; + string aMacroNodeName = string( "Macro_" ) + string( myGraph->Name() ) ; + Graph_Impl * myMacroNode ; + myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroNodeName.c_str() , SUPERV::MacroNode ) ; + id = myMacroNode->getId() ; + obj = _poa->id_to_reference(*id); + macroiobject = SUPERV::Graph::_narrow( obj ) ; + myMacroNode->DataFlowEditor( DataFlowEditor() ) ; + aMacroNode->SetGraphEditor( DataFlowEditor() ) ; + GraphEditor::InNode * aDataFlowNode = (GraphEditor::InNode * ) aMacroNode->GetInNode() ; + myMacroNode->DataFlowNode( aDataFlowNode ) ; + aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ; + aDataFlowNode->SetObjImpl( this ) ; + + + + + + char * aCoupledNodeName = aMacroNode->CoupledNodeName() ; + MESSAGE( "LoadDataFlows MacroNode " << aMacroNode->Name() << " --> " << aCoupledNodeName + << " to be searched among " << (*aListOfDataFlows).size() << " Graphs" ) ; + int index ; + for ( index = 0 ; index < (int ) (*aListOfDataFlows).size() ; index++ ) { + if ( !strcmp( aCoupledNodeName , (*aListOfDataFlows)[index].Info.theName.c_str() ) ) { + string dbgfile ; +// At first create the editor and a StreamGraph + GraphEditor::DataFlow * aMacroGraphDataFlowEditor ; + CreateEditor( _Orb , instanceName() , aCoupledNodeName , SUPERV::DataStreamGraph , + dbgfile , &aMacroGraphDataFlowEditor ) ; +// if ( !aDataFlowEditor->LoadDataFlow( aDataFlowEditor , aListOfDataFlows , index ) ) { + MESSAGE( "RECURSIVE IMPORT OF GRAPHS OF MACRONODES :" << aCoupledNodeName ) ; + if ( !LoadDataFlows( aMacroGraphDataFlowEditor , aListOfDataFlows , index ) ) { + MESSAGE("Graph_Impl::LoadDataFlows failed" ) ; + return false ; + } + +// That graph is not a StreamGraph : + else if ( !aMacroGraphDataFlowEditor->Graph()->HasDataStream() ) { + aMacroGraphDataFlowEditor->Graph()->Kind( SUPERV::DataFlowGraph ) ; + aMacroGraphDataFlowEditor->Graph()->SetGraphEditor( aMacroGraphDataFlowEditor ) ; + Graph_Impl * myMacroGraph ; +// We create a Graph ObjRef for that graph + myMacroGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroGraphDataFlowEditor , NULL ) ; + PortableServer::ObjectId * id = myMacroGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Graph_var iobject = SUPERV::Graph::_narrow( obj ) ; + myMacroGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + + GraphBase::Graph * aMacroGraph = myMacroGraph->DataFlowEditor()->Graph() ; + aMacroGraph->GraphMacroLevel( aGraph->GraphMacroLevel() + 1 ) ; + aMacroGraph->CoupledNode( aMacroNode ) ; + + aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; + aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ; + +// Set the GraphMacroNode ObjRef in the MacroNode + aMacroNode->CoupledNode( aMacroGraph ) ; + aMacroNode->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; + } + } + } + } + } + } + + endService( "Graph_Impl::EditorLoadDataFlows" ); + return true ; +} + +bool Graph_Impl::LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor , + GraphBase::ListOfSGraphs * aListOfDataFlows , + int index ) { + beginService( "Graph_Impl::ExecutorLoadDataFlows" ) ; + MESSAGE("Graph_Impl::LoadDataFlows index " << index << " " << (*aListOfDataFlows)[index].Info.theName.c_str() ) ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; +// That method is recursive : +// At first we load the supergraph with index = 0 : +// (After we load the graph corresponding to each MacroNode :) + if ( !aDataFlowExecutor->LoadDataFlow( &(*aListOfDataFlows)[ index ] ) ) { + MESSAGE("Graph_Impl::LoadDataFlows failed" ) ; + return false ; + } +// That graph is not a StreamGraph : + else if ( !aDataFlowExecutor->Graph()->HasDataStream() ) { + aDataFlowExecutor->Graph()->Kind( SUPERV::DataFlowGraph ) ; + GraphEditor::DataFlow * aDataFlowEditor ; + aDataFlowEditor = theAutomaton->MapGraph( (*aListOfDataFlows)[index].Info.theName.c_str() )->GraphEditor() ; + aDataFlowEditor->Executor( aDataFlowExecutor ) ; + aDataFlowEditor->Graph()->SetGraphEditor( aDataFlowEditor ) ; + aDataFlowEditor->Graph()->SetGraphExecutor( aDataFlowExecutor ) ; + aDataFlowExecutor->Graph()->SetGraphEditor( aDataFlowEditor ) ; + aDataFlowExecutor->Graph()->SetGraphExecutor( aDataFlowExecutor ) ; + Graph_Impl * myGraph ; +// We create a Graph ObjRef for that graph + myGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aDataFlowExecutor , NULL ) ; + PortableServer::ObjectId * id = myGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + iobject = SUPERV::Graph::_narrow( obj ) ; + myGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + myGraph->DataFlowEditor( aDataFlowEditor ) ; + myGraph->DataFlowExecutor( aDataFlowExecutor ) ; + MESSAGE("ExecutorLoadDataFlows IsEditing " << myGraph->Name() << " " + << myGraph->DataFlowEditor() << " " << myGraph->DataFlowEditor()->IsEditing() << " " + << myGraph->DataFlowEditor()->Graph()->Name() << " " + << myGraph->DataFlowEditor()->Graph()->GraphEditor() << " " + << myGraph->DataFlowEditor()->Graph()->GraphEditor()->IsEditing() ) ; + GraphBase::Graph * aGraph = myGraph->DataFlowExecutor()->Graph() ; + int i ; +// For the supergraph or each graph of MacroNodes we search MacroNodes recursively : + for ( i = 0 ; i < aGraph->GraphNodesSize() ; i++ ) { + if ( aGraph->GraphNodes( i )->IsMacroNode() ) { + GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) aGraph->GraphNodes( i ) ; + + + +// Creation of a GraphMacroNode ObjRef in the current executor + SUPERV::Graph_var macroiobject = SUPERV::Graph::_nil() ; + string aMacroNodeName = string( "Macro_" ) + string( aGraph->Name() ) ; + Graph_Impl * myMacroNode ; + myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroNodeName.c_str() , SUPERV::MacroNode ) ; + id = myMacroNode->getId() ; + obj = _poa->id_to_reference(*id); + macroiobject = SUPERV::Graph::_narrow( obj ) ; + myMacroNode->DataFlowEditor( DataFlowEditor() ) ; + myMacroNode->DataFlowExecutor( DataFlowExecutor() ) ; + aMacroNode->SetGraphEditor( DataFlowEditor() ) ; + GraphExecutor::InNode * aDataFlowExecutorNode = (GraphExecutor::InNode * ) aMacroNode->GetInNode() ; + myMacroNode->DataFlowNode( aDataFlowExecutorNode ) ; + aDataFlowExecutorNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ; + aDataFlowExecutorNode->SetObjImpl( this ) ; + + char * aCoupledNodeName = aMacroNode->CoupledNodeName() ; + MESSAGE( "LoadDataFlows MacroNode " << aMacroNode->Name() << " --> " << aCoupledNodeName + << " to be searched among " << (*aListOfDataFlows).size() << " Graphs" ) ; + int index ; + for ( index = 0 ; index < (int ) (*aListOfDataFlows).size() ; index++ ) { + if ( !strcmp( aCoupledNodeName , (*aListOfDataFlows)[index].Info.theName.c_str() ) ) { + string dbgfile ; +// At first create the editor and a StreamGraph + GraphExecutor::DataFlow * aMacroGraphDataFlowExecutor ; + CreateEditor( _Orb , instanceName() , aCoupledNodeName , SUPERV::DataStreamGraph , + dbgfile , &aMacroGraphDataFlowExecutor ) ; +// if ( !aDataFlowEditor->LoadDataFlow( aDataFlowEditor , aListOfDataFlows , index ) ) { + MESSAGE( "RECURSIVE IMPORT OF GRAPHS OF MACRONODES :" << aCoupledNodeName ) ; + if ( !LoadDataFlows( aMacroGraphDataFlowExecutor , aListOfDataFlows , index ) ) { + MESSAGE("Graph_Impl::LoadDataFlows failed" ) ; + return false ; + } + +// That graph is not a StreamGraph : + else if ( !aMacroGraphDataFlowExecutor->Graph()->HasDataStream() ) { + aMacroGraphDataFlowExecutor->Graph()->Kind( SUPERV::DataFlowGraph ) ; + aMacroGraphDataFlowExecutor->Graph()->SetGraphExecutor( aMacroGraphDataFlowExecutor ) ; + GraphEditor::DataFlow * aDataFlow = theAutomaton->MapGraph( aCoupledNodeName )->GraphEditor() ; + if ( aDataFlow == NULL ) { + MESSAGE( "ExecutorLoadDataFlows NULL GraphEditor ERROR" ) ; + } + aMacroGraphDataFlowExecutor->Graph()->SetGraphEditor( aDataFlow ) ; + aMacroGraphDataFlowExecutor->Graph()->SetGraphExecutor( aMacroGraphDataFlowExecutor ) ; + aMacroGraphDataFlowExecutor->Graph()->SetGraphPorts() ; + Graph_Impl * myMacroGraph ; +// We create a Graph ObjRef for that graph + myMacroGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroGraphDataFlowExecutor , NULL ) ; + PortableServer::ObjectId * id = myMacroGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Graph_var iobject = SUPERV::Graph::_narrow( obj ) ; + myMacroGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + myMacroGraph->DataFlowEditor( aDataFlow ) ; + aDataFlow->Executor( aMacroGraphDataFlowExecutor ) ; + myMacroGraph->DebugFileName( (char * ) dbgfile.c_str() ) ; + + GraphBase::Graph * aMacroGraph = myMacroGraph->DataFlowExecutor()->Graph() ; + aMacroGraph->GraphMacroLevel( aGraph->GraphMacroLevel() + 1 ) ; + +// Set the MacroNode ObjRef in the GraphMacroNode + aMacroGraph->CoupledNode( aMacroNode ) ; + aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ; + +// Set the GraphMacroNode ObjRef in the MacroNode + aMacroNode->CoupledNode( aMacroGraph ) ; + aMacroNode->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; + + iobject->Run() ; + } + break ; + } + } + } + } + } + + endService( "Graph_Impl::ExecutorLoadDataFlows" ); + return true ; +} + +SUPERV::Graph_ptr Graph_Impl::MNode( const char * aXmlFileName ) { + beginService( "Graph_Impl::MNode" ); + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { + GraphBase::ListOfSGraphs aListOfDataFlows ; + string dbgfile ; +// At first create the editor and a StreamGraph with the xml file + GraphEditor::DataFlow * aDataFlowEditor ; + CreateEditor( _Orb , instanceName() , aXmlFileName , SUPERV::DataStreamGraph , + dbgfile , &aDataFlowEditor ) ; + int lenname = strlen( aXmlFileName ) ; + bool loaded = false ; +// Import of the xml file + if ( lenname > 4 && !strcmp( &aXmlFileName[ lenname - 4 ] , ".xml" ) ) { + loaded = aDataFlowEditor->LoadXml( aXmlFileName , aListOfDataFlows ) ; + if ( loaded ) { + iobject = MNode( aDataFlowEditor , aListOfDataFlows ) ; + } + } + } + return iobject ; +} + +// WARNING : THIS IS COMPLICATED : +// I should have to remove duplicated code ... +SUPERV::Graph_ptr Graph_Impl::MNode( GraphEditor::DataFlow * aMacroGraphDataFlowEditor , + GraphBase::ListOfSGraphs aListOfDataFlows ) { + beginService( "Graph_Impl::MNode" ) ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; + SUPERV::Graph_var macroiobject = SUPERV::Graph::_nil() ; + + if ( !IsMacro() ) { + if ( !aMacroGraphDataFlowEditor->LoadDataFlow( &aListOfDataFlows[ 0 ] ) ) { + MESSAGE("Graph_Impl::MNode LoadDataFlow failed" ) ; + return false ; + } + +// That graph is not a StreamGraph : + else if ( !aMacroGraphDataFlowEditor->Graph()->HasDataStream() ) { + aMacroGraphDataFlowEditor->Graph()->Kind( SUPERV::DataFlowGraph ) ; + aMacroGraphDataFlowEditor->Graph()->SetGraphEditor( aMacroGraphDataFlowEditor ) ; + Graph_Impl * myMacroGraph ; +// We create a Graph ObjRef for that graph + myMacroGraph = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroGraphDataFlowEditor , NULL ) ; + PortableServer::ObjectId * id = myMacroGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::Graph::_narrow( obj ) ; + myMacroGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + + + +// Creation of a GraphMacroNode in the current editor + string aMacroNodeName = string( "Macro_" ) + string( myMacroGraph->Name() ) ; + Graph_Impl * myMacroNode ; + myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroNodeName.c_str() , SUPERV::MacroNode ) ; + id = myMacroNode->getId() ; + obj = _poa->id_to_reference(*id); + macroiobject = SUPERV::Graph::_narrow( obj ) ; + myMacroNode->DataFlowEditor( DataFlowEditor() ) ; + +// Creation of the MacroNode itself in the current Graph + GraphBase::ListOfFuncName aFuncName ; + aFuncName.resize( 1 ) ; + aFuncName[0] = "" ; + SUPERV::ListOfStrings aListOfStrings ; + aListOfStrings.length( 1 ) ; + aListOfStrings[0] = "" ; + GraphBase::ListOfPythonFunctions aPythonFunction ; + aPythonFunction.resize( 1 ) ; + aPythonFunction[0] = &aListOfStrings ; + SALOME_ModuleCatalog::Service * aMacroNodeService = myMacroGraph->Service() ; + GraphEditor::InNode * aDataFlowNode = DataFlowEditor()->AddNode( *aMacroNodeService , "" , "" , + aMacroNodeName.c_str() , SUPERV::MacroNode , + aFuncName , aPythonFunction ) ; + aDataFlowNode->SetPythonFunction( "" , aListOfStrings ) ; + myMacroNode->DataFlowNode( aDataFlowNode ) ; + aDataFlowNode->ComputingNode()->SetService( *aMacroNodeService ) ; + aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ; + aDataFlowNode->SetObjImpl( this ) ; + + + + GraphBase::Graph * aGraph = myMacroGraph->DataFlowEditor()->Graph() ; + GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ; + GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ; + aMacroGraph->Kind( SUPERV::MacroNode ) ; + aMacroGraph->SetGraphEditor( DataFlowEditor() ) ; +// Creation of the Ports of the MacroNode from the ports of the GraphMacroNode + aMacroGraph->SetMacroPorts( aGraph ) ; +// Valid ==> creation of Service and the ports of the current Graph + DataFlowEditor()->IsValid() ; +// Set the Input Datas from the GraphMacroNode to the current Graph + aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ; + aMacroGraphDataFlowEditor->UnValid() ; +// Set the MacroNode ObjRef in the GraphMacroNode + aGraph->CoupledNode( aMacroGraph ) ; + aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ; +// Set the GraphMacroNode ObjRef in the MacroNode + aMacroGraph->CoupledNode( aGraph ) ; + aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; +// aDataFlowNode->CoupledNode( aGraph ) ; +// aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; +// Set the MacroLevel of that graph + aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ; + aMacroGraph->Coordinates( 0 , 0 ) ; + MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode " + << aDataFlowNode << " " << aDataFlowNode->Name() << " created" ) ; + } + else { + delete aMacroGraphDataFlowEditor ; + } + } + endService( "Graph_Impl::MNode" ); + return SUPERV::Graph::_duplicate( macroiobject ) ; +} + +SUPERV::Graph_ptr Graph_Impl::GraphMNode( SUPERV::Graph_ptr myMacroGraph ) { + SUPERV::Graph_var iobject = myMacroGraph ; + beginService( "Graph_Impl::GraphMNode" ) ; + +// GraphBase::Graph * myMacroGraph = aGraph; + SUPERV::Graph_var macroiobject = SUPERV::StreamGraph::_nil() ; +// Creation of a GraphMacroNode in the current editor + if ( !IsMacro() ) { + string aMacroNodeName = string( "Macro_" ) + string( myMacroGraph->Name() ) ; + MESSAGE( "GraphMNode( " << myMacroGraph->Name() << " )" ) ; + Graph_Impl * myMacroNode ; + myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aMacroNodeName.c_str() , SUPERV::MacroNode ) ; + PortableServer::ObjectId * id = myMacroNode->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + macroiobject = SUPERV::Graph::_narrow( obj ) ; + myMacroNode->DataFlowEditor( DataFlowEditor() ) ; + +// Creation of the MacroNode itself in the current Graph + GraphBase::ListOfFuncName aFuncName ; + aFuncName.resize( 1 ) ; + aFuncName[0] = "" ; + SUPERV::ListOfStrings aListOfStrings ; + aListOfStrings.length( 1 ) ; + aListOfStrings[0] = "" ; + GraphBase::ListOfPythonFunctions aPythonFunction ; + aPythonFunction.resize( 1 ) ; + aPythonFunction[0] = &aListOfStrings ; + SALOME_ModuleCatalog::Service * aMacroNodeService = myMacroGraph->Service() ; + GraphEditor::InNode * aDataFlowNode = DataFlowEditor()->AddNode( *aMacroNodeService , "" , "" , + aMacroNodeName.c_str() , SUPERV::MacroNode , + aFuncName , aPythonFunction ) ; + aDataFlowNode->SetPythonFunction( "" , aListOfStrings ) ; + myMacroNode->DataFlowNode( aDataFlowNode ) ; + aDataFlowNode->ComputingNode()->SetService( *aMacroNodeService ) ; + aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ; + aDataFlowNode->SetObjImpl( this ) ; + + + +// GraphBase::Graph * aGraph = myMacroGraph->DataFlowEditor()->Graph() ; + GraphBase::Graph * aGraph = DataFlowEditor()->Automaton()->MapGraph( myMacroGraph->Name() ) ; + GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ; + GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ; + aMacroGraph->Kind( SUPERV::MacroNode ) ; + aMacroGraph->SetGraphEditor( DataFlowEditor() ) ; +// Creation of the Ports of the MacroNode from the ports of the GraphMacroNode + aMacroGraph->SetMacroPorts( aGraph ) ; +// Valid ==> creation of Service and the ports of the current Graph + DataFlowEditor()->IsValid() ; +// Set the Input Datas from the GraphMacroNode to the current Graph + aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ; +// aMacroGraphDataFlowEditor->UnValid() ; + aGraph->GraphEditor()->UnValid() ; +// Set the MacroNode ObjRef in the GraphMacroNode + aGraph->CoupledNode( aMacroGraph ) ; + aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ; +// Set the GraphMacroNode ObjRef in the MacroNode + aMacroGraph->CoupledNode( aGraph ) ; + aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; +// aDataFlowNode->CoupledNode( aGraph ) ; +// aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ; +// Set the MacroLevel of that graph + aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ; + aMacroGraph->Coordinates( 0 , 0 ) ; + MESSAGE( aGraph->Name() << "->CoupledNode()->GraphEditor() : " << aGraph->CoupledNode()->GraphEditor() ) ; + MESSAGE( aMacroGraph->Name() << "->CoupledNode()->GraphEditor() : " << aMacroGraph->CoupledNode()->GraphEditor() ) ; + MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode " + << aDataFlowNode << " " << aDataFlowNode->Name() << " created" ) ; + } + endService( "Graph_Impl::GraphMNode" ) ; + return SUPERV::Graph::_duplicate( macroiobject ) ; +} + +SUPERV::Graph_ptr Graph_Impl::FlowObjRef() { + beginService( "Graph_Impl::FlowObjRef" ); + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; + if ( IsMacro() ) { + iobject = SUPERV::Graph::_narrow( DataFlowNode()->GraphMacroNode()->MacroObject() ) ; + } + else if ( IsGraph() ) { + iobject = SUPERV::Graph::_narrow( DataFlowEditor()->Graph()->MacroObject() ) ; + } + if ( CORBA::is_nil( iobject ) ) { + MESSAGE( "Graph_Impl::FlowObjRef() returns a NIL Object" ) ; + } + endService( "Graph_Impl::FlowObjRef" ); + return SUPERV::Graph::_duplicate( iobject ) ; +} + +SUPERV::StreamGraph_ptr Graph_Impl::StreamObjRef() { + beginService( "Graph_Impl::StreamObjRef" ); + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; + if ( IsMacro() ) { + iobject = SUPERV::StreamGraph::_narrow( DataFlowNode()->GraphMacroNode()->MacroObject() ) ; + } + else if ( IsGraph() || IsStreamGraph() ) { + iobject = SUPERV::StreamGraph::_narrow( DataFlowEditor()->Graph()->MacroObject() ) ; + } + if ( CORBA::is_nil( iobject ) ) { + MESSAGE( "Graph_Impl::StreamObjRef() returns a NIL Object" ) ; + } + endService( "Graph_Impl::StreamObjRef" ); + return SUPERV::StreamGraph::_duplicate( iobject ) ; +} SUPERV::CNode_ptr Graph_Impl::Node(char const * aNodeName ) { // beginService( "Graph_Impl::Node" ); @@ -482,12 +1036,14 @@ SUPERV::CNode_ptr Graph_Impl::Node(char const * aNodeName ) { else { iobject = DataFlowEditor()->GetNode( aNodeName )->ObjRef() ; */ - GraphEditor::InNode * anInNode = DataFlowEditor()->GetNode( aNodeName ) ; - if ( anInNode ) { - if ( CORBA::is_nil( anInNode->ObjRef() ) ) { - SetNodeObjRef( anInNode ) ; + if ( !IsMacro() ) { + GraphEditor::InNode * anInNode = DataFlowEditor()->GetNode( aNodeName ) ; + if ( anInNode ) { + if ( CORBA::is_nil( anInNode->ObjRef() ) ) { + SetNodeObjRef( anInNode ) ; + } + iobject = anInNode->ObjRef() ; } - iobject = anInNode->ObjRef() ; } // endService( "Graph_Impl::Node" ); return SUPERV::CNode::_duplicate( iobject ) ; @@ -498,7 +1054,7 @@ SUPERV::Link_ptr Graph_Impl::Link( SUPERV::Port_ptr OutPort , beginService( "Graph_Impl::Link" ); SUPERV::Link_var iobject = SUPERV::Link::_nil() ; if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && - !OutPort->IsDataStream() && !InPort->IsDataStream() ) { + !OutPort->IsDataStream() && !InPort->IsDataStream() && !IsMacro() ) { GraphBase::InPort * anInPort = DataFlowEditor()->GetNode( InPort->Node()->Name() )->ComputingNode()->GetChangeInPort( InPort->Name() ) ; GraphBase::OutPort * anOutPort = DataFlowEditor()->GetNode( OutPort->Node()->Name() )->ComputingNode()->GetChangeOutPort( OutPort->Name() ) ; if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { @@ -532,7 +1088,11 @@ SUPERV::Link_ptr Graph_Impl::Link( SUPERV::Port_ptr OutPort , return SUPERV::Link::_duplicate( iobject ) ; } +// Only to see MacroNodes with actual GUI ... : +#define GOTOMacroNode 0 + void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) { + MESSAGE("Graph_Impl::SetNodeObjRef " << anInNode->Name() << " " << anInNode->Kind() ) ; CORBA::Object_var obj ; if ( anInNode->IsComputingNode() ) { CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId , @@ -564,7 +1124,14 @@ void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) { SUPERV::INode_var iobject = SUPERV::INode::_narrow(obj) ; myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ; } +#if GOTOMacroNode + else if ( anInNode->IsGOTONode() || anInNode->IsMacroNode() ) { + if ( anInNode->IsMacroNode() ) { + anInNode->ComputingNode()->Kind( SUPERV::GOTONode ) ; + } +#else else if ( anInNode->IsGOTONode() ) { +#endif GNode_Impl * myNode = new GNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -574,6 +1141,16 @@ void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) { SUPERV::GNode_var iobject = SUPERV::GNode::_narrow(obj) ; myNode->SetObjRef( SUPERV::GNode::_duplicate( iobject ) ) ; } + else if ( anInNode->IsMacroNode() ) { + Graph_Impl * myNode = new Graph_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + anInNode ) ; + PortableServer::ObjectId * id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::Graph_var iobject = SUPERV::Graph::_narrow(obj) ; + myNode->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; + } else if ( anInNode->IsLoopNode() ) { LNode_Impl * myNode = new LNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , @@ -619,9 +1196,10 @@ void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) { SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , GraphBase::ComputingNode * aNode ) { int index = 0 ; - if ( _DataFlowExecutor ) { +// if ( _DataFlowExecutor ) { + if ( DataFlowExecutor() ) { MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() << " " - << _DataFlowExecutor->StateName( _DataFlowExecutor->AutomatonState( aNode->Name() ) ) ) ; + << DataFlowExecutor()->StateName( DataFlowExecutor()->AutomatonState( aNode->Name() ) ) ) ; } else { MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() ) ; @@ -638,10 +1216,18 @@ SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , index = RetVal->INodes.length() ; RetVal->INodes.length( index+1 ); } +#if GOTOMacroNode + else if ( aNode->IsGOTONode() || aNode->IsMacroNode() ) { +#else else if ( aNode->IsGOTONode() ) { +#endif index = RetVal->GNodes.length() ; RetVal->GNodes.length( index+1 ); } + else if ( aNode->IsMacroNode() ) { + index = RetVal->Graphs.length() ; + RetVal->Graphs.length( index+1 ); + } else if ( aNode->IsLoopNode() ) { index = RetVal->LNodes.length() ; RetVal->LNodes.length( index+1 ); @@ -671,9 +1257,16 @@ SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , else if ( aNode->IsInLineNode() ) { RetVal->INodes[index] = SUPERV::INode::_duplicate( SUPERV::INode::_narrow( aNodeObjRef ) ) ; } +#if GOTOMacroNode + else if ( aNode->IsGOTONode() || aNode->IsMacroNode() ) { +#else else if ( aNode->IsGOTONode() ) { +#endif RetVal->GNodes[index] = SUPERV::GNode::_duplicate( SUPERV::GNode::_narrow( aNodeObjRef ) ) ; } + else if ( aNode->IsMacroNode() ) { + RetVal->Graphs[index] = SUPERV::Graph::_duplicate( SUPERV::Graph::_narrow( aNodeObjRef ) ) ; + } else if ( aNode->IsLoopNode() ) { RetVal->LNodes[index] = SUPERV::LNode::_duplicate( SUPERV::LNode::_narrow( aNodeObjRef ) ) ; } @@ -698,29 +1291,59 @@ SUPERV::ListOfNodes * Graph_Impl::Nodes() { RetVal->LNodes.length(0) ; RetVal->SNodes.length(0) ; RetVal->GNodes.length(0) ; - int i ; - for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { - GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GraphNodes( i ) ; - RetVal = SetNode( RetVal , aNode ) ; - } + RetVal->Graphs.length(0) ; + if ( !IsMacro() ) { + int i ; + for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { + GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GraphNodes( i ) ; + RetVal = SetNode( RetVal , aNode ) ; + } #if 0 - char * aStateG = "" ; - if ( _DataFlowExecutor ) { - aStateG = (char *) _DataFlowExecutor->StateName( _DataFlowExecutor->AutomatonState() ) ; - } - MESSAGE("Graph_Impl::Nodes GraphState " << aStateG - << " CNodes " << RetVal->CNodes.length() - << " FNodes " << RetVal->FNodes.length() - << " INodes " << RetVal->INodes.length() - << " GNodes " << RetVal->GNodes.length() - << " LNodes " << RetVal->LNodes.length() - << " ELNodes " << RetVal->ELNodes.length() - << " SNodes " << RetVal->SNodes.length() - << " ESNodes " << RetVal->ESNodes.length() ) ; - if ( _DataFlowExecutor ) { - _DataFlowExecutor->EventList() ; - } + char * aStateG = "" ; + if ( DataFlowExecutor() ) { + aStateG = (char *) DataFlowExecutor()->StateName( DataFlowExecutor()->AutomatonState() ) ; + } + MESSAGE("Graph_Impl::Nodes GraphState " << aStateG << " CNodes " << RetVal->CNodes.length() ) ; + for ( i = 0 ; i < RetVal->CNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->CNodes[ i ] ->Name() ) ; + } + MESSAGE("FNodes " << RetVal->FNodes.length() ) ; + for ( i = 0 ; i < RetVal->FNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->FNodes[ i ] ->Name() ) ; + } + MESSAGE("INodes " << RetVal->INodes.length() ) ; + for ( i = 0 ; i < RetVal->INodes.length() ; i++ ) { + MESSAGE(" " << RetVal->INodes[ i ] ->Name() ) ; + } + MESSAGE("GNodes " << RetVal->GNodes.length() ) ; + for ( i = 0 ; i < RetVal->GNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->GNodes[ i ] ->Name() ) ; + } + MESSAGE("LNodes " << RetVal->LNodes.length() ) ; + for ( i = 0 ; i < RetVal->LNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->LNodes[ i ] ->Name() ) ; + } + MESSAGE("ELNodes " << RetVal->ELNodes.length() ) ; + for ( i = 0 ; i < RetVal->ELNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->ELNodes[ i ] ->Name() ) ; + } + MESSAGE("SNodes " << RetVal->SNodes.length() ) ; + for ( i = 0 ; i < RetVal->SNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->SNodes[ i ] ->Name() ) ; + } + MESSAGE("ESNodes " << RetVal->ESNodes.length() ) ; + for ( i = 0 ; i < RetVal->ESNodes.length() ; i++ ) { + MESSAGE(" " << RetVal->ESNodes[ i ] ->Name() ) ; + } + MESSAGE("Graphs " << RetVal->Graphs.length() ) ; + for ( i = 0 ; i < RetVal->Graphs.length() ; i++ ) { + MESSAGE(" " << RetVal->Graphs[ i ] ->Name() ) ; + } + if ( DataFlowExecutor() ) { + DataFlowExecutor()->EventList() ; + } #endif + } endService( "Graph_Impl::Nodes" ); return ( RetVal._retn() ) ; } @@ -734,237 +1357,267 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , bool begin = true ; SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; RetVal->length( 0 ) ; - int i , j , countlink ; - countlink = 0 ; - for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { - GraphEditor::InNode * aNode = NULL ; - aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ; - bool ToProcess = false ; - if ( theNode == NULL ) { - ToProcess = true ; - } - else { - if ( !strcmp( theNode->Name() , aNode->Name() ) ) { - if ( !theNode->IsEndSwitchNode() ) { - ToProcess = true ; - } - } - else if ( theNode->IsEndSwitchNode() ) { + if ( !IsMacro() ) { + int i , j , countlink ; + countlink = 0 ; + for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { + GraphEditor::InNode * aNode = NULL ; + aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ; + bool ToProcess = false ; + if ( theNode == NULL ) { ToProcess = true ; } - } - if ( ToProcess ) { - for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) { - GraphBase::InPort * anInPort = NULL ; - anInPort = aNode->GetChangeNodeInPort( j ) ; - if ( anInputParam == NULL || - !strcmp( anInPort->PortName() , anInputParam ) ) { - GraphBase::OutPort * anOutPort = NULL ; - anOutPort = anInPort->GetOutPort() ; - if ( anOutPort && !anOutPort->IsDataStream() ) { - if ( strcmp( anOutPort->NodeName() , Name() ) ) { -// MESSAGE("Graph_Impl::Links " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" -// << anInPort->PortName() << ")" ) ; - if ( theNode == NULL || - ( theNode != NULL && !theNode->IsEndSwitchNode() && - !strcmp( theNode->Name() , aNode->Name() ) ) ) { - if ( anInPort->IsLoop() || anOutPort->IsLoop() || - ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , - anOutPort->NodeName() ) ) ) { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" -// << anInPort->PortName() << ")" << " ignored" ) ; - } - else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { - if ( begin ) { - beginService( "Graph_Impl::Links" ); - begin = false ; - } - GraphEditor::InNode * anOutNode = NULL ; - anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; - if ( anOutNode ) { - bool Success ; - Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - DataFlowEditor() , - aNode , - anInPort->PortName() , - anOutNode , - anOutPort->PortName() , - false , true , Success ) ; - if ( Success ) { - PortableServer::ObjectId * id = myLink->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Link_var iobject ; - iobject = SUPERV::Link::_narrow(obj) ; - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; - anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; - } - } - } - else { - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( anOutPort->InPortObjRef( anInPort ) ) ; - } -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" -// << anInPort->PortName() << ")" << " selected" ) ; - } - else { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" -// << anInPort->PortName() << ")" << " skipped" ) ; - } - } - } - } + else { + if ( !strcmp( theNode->Name() , aNode->Name() ) ) { + if ( !theNode->IsEndSwitchNode() ) { + ToProcess = true ; + } + } + else if ( theNode->IsEndSwitchNode() ) { + ToProcess = true ; + } } - } - for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { - GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ; - int k ; - for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { - GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; - GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; - if ( theNode == NULL || - !strcmp( theNode->Name() , aNode->Name() ) ) { - if ( !anInPort->IsDataStream() ) { - if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { - if ( anInputParam == NULL || - !strcmp( anInPort->PortName() , anInputParam ) ) { - if ( anInPort->IsLoop() || anOutPort->IsLoop() || - ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , - anOutPort->NodeName() ) ) ) { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" -// << anInPort->PortName() << ")" << " ignored" ) ; - } - else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { - if ( begin ) { - beginService( "Graph_Impl::Links" ); - begin = false ; - } - bool Success ; - Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - DataFlowEditor() , - toNode , - anInPort->PortName() , - aNode , - anOutPort->PortName() , - false , true , Success ) ; - if ( Success ) { - PortableServer::ObjectId * id = myLink->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Link_var iobject ; - iobject = SUPERV::Link::_narrow(obj) ; - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; - anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + if ( ToProcess ) { + for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = NULL ; + anInPort = aNode->GetChangeNodeInPort( j ) ; + if ( anInputParam == NULL || + !strcmp( anInPort->PortName() , anInputParam ) ) { + GraphBase::OutPort * anOutPort = NULL ; + anOutPort = anInPort->GetOutPort() ; + if ( anOutPort && !anOutPort->IsDataStream() ) { + if ( strcmp( anOutPort->NodeName() , Name() ) ) { +// MESSAGE("Graph_Impl::Links " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" ) ; + if ( theNode == NULL || + ( theNode != NULL && !theNode->IsEndSwitchNode() && + !strcmp( theNode->Name() , aNode->Name() ) ) ) { + if ( anInPort->IsLoop() || anOutPort->IsLoop() || + ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , + anOutPort->NodeName() ) ) ) { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" << " ignored" ) ; } + else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "Graph_Impl::Links" ); + begin = false ; + } + GraphEditor::InNode * anOutNode = NULL ; + anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; + if ( anOutNode ) { + bool Success ; + Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + aNode , + anInPort->PortName() , + anOutNode , + anOutPort->PortName() , + false , true , Success ) ; + if ( Success ) { + PortableServer::ObjectId * id = myLink->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Link_var iobject ; + iobject = SUPERV::Link::_narrow(obj) ; + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + } + } + } + else { + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( anOutPort->InPortObjRef( anInPort ) ) ; + } +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" << " selected" ) ; } else { - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( SUPERV::Link::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" << " skipped" ) ; } -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" -// << anInPort->PortName() << ")" << " selected" ) ; } - else { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" -// << anInPort->PortName() << ")" << " skipped" ) ; + } + } + } + } + for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ; +// MESSAGE( "Graph_Impl::Links " << aNode->Name() << " Out" << j << " " << anOutPort->PortName() << " " +// << anOutPort->PortStatus() << " PortConnected to " << anOutPort->InPortsSize() << " InPorts" ) ; + int k ; + for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; +// MESSAGE( " --> In" << k << " " << anInPort->NodeName() << " " << anInPort->PortName() +// << " " << anInPort->PortStatus() ) ; + if ( !anInPort->IsExternConnected() ) { + GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; + if ( theNode == NULL || + !strcmp( theNode->Name() , aNode->Name() ) ) { + if ( !anInPort->IsDataStream() ) { + if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { + if ( anInputParam == NULL || + !strcmp( anInPort->PortName() , anInputParam ) ) { + if ( anInPort->IsLoop() || anOutPort->IsLoop() || + ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , + anOutPort->NodeName() ) ) ) { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " ignored" ) ; + } + else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "Graph_Impl::Links" ); + begin = false ; + } + bool Success ; + Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + toNode , + anInPort->PortName() , + aNode , + anOutPort->PortName() , + false , true , Success ) ; + if ( Success ) { + PortableServer::ObjectId * id = myLink->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Link_var iobject ; + iobject = SUPERV::Link::_narrow(obj) ; + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + } + } + else { + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( SUPERV::Link::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; + } +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " selected" ) ; + } + else { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " skipped" ) ; + } + } } } } } } } - } + #if 0 - const char * NodeName = "" ; - const char * InputParamName = "" ; - if ( theNode ) { - NodeName = theNode->Name() ; - } - if ( anInputParam ) { - InputParamName = anInputParam ; - } - MESSAGE( RetVal->length() << " Links of Node " << NodeName << " and of InPort " << InputParamName ) ; - for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { - MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "(" - << RetVal[i]->OutPort()->Name() << ") --> " - << RetVal[i]->InPort()->Node()->Name() << "(" - << RetVal[i]->InPort()->Name() << ")" ) ; - } + const char * NodeName = "" ; + const char * InputParamName = "" ; + if ( theNode ) { + NodeName = theNode->Name() ; + } + if ( anInputParam ) { + InputParamName = anInputParam ; + } + MESSAGE( RetVal->length() << " Links of Node " << NodeName << " and of InPort " << InputParamName ) ; + for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { + MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "(" + << RetVal[i]->OutPort()->Name() << ") --> " + << RetVal[i]->InPort()->Node()->Name() << "(" + << RetVal[i]->InPort()->Name() << ")" ) ; + } #endif - if ( !begin ) { - endService( "Graph_Impl::Links" ); + if ( !begin ) { + endService( "Graph_Impl::Links" ); + } } return ( RetVal._retn() ) ; } Engines::Component_ptr Graph_Impl::ComponentRef( const char * aComputerContainer , const char * aComponentName ) { - Engines::Container_var myContainer ; - Engines::Component_var objComponent ; - DataFlowEditor()->Graph()->StartComponent( 0 , aComputerContainer , aComponentName , - myContainer , objComponent ) ; + Engines::Component_var objComponent = Engines::Component::_nil() ; + if ( !IsMacro() ) { + Engines::Container_var myContainer ; + DataFlowEditor()->Graph()->StartComponent( 0 , aComputerContainer , aComponentName , + myContainer , objComponent ) ; + } return Engines::Component::_duplicate( objComponent ) ; } bool Graph_Impl::IsValid() { // beginService( "Graph_Impl::IsValid" ); - bool RetVal = DataFlowEditor()->IsValid() ; + bool RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->IsValid() ; + } // endService( "Graph_Impl::IsValid" ); return RetVal ; } bool Graph_Impl::IsExecutable() { // beginService( "Graph_Impl::IsExecutable" ); - bool RetVal = DataFlowEditor()->IsExecutable() ; + bool RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->IsExecutable() ; + } // endService( "Graph_Impl::IsExecutable" ); return RetVal ; } bool Graph_Impl::IsEditing() { // beginService( "Graph_Impl::IsEditing" ); - bool RetVal = DataFlowEditor()->IsEditing() ; + bool RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->IsEditing() ; + } // endService( "Graph_Impl::IsEditing" ); return RetVal ; } bool Graph_Impl::IsExecuting() { // beginService( "Graph_Impl::IsExecuting" ); - bool RetVal = !DataFlowEditor()->IsEditing() ; + bool RetVal = false ; + if ( !IsMacro() ) { + RetVal = !DataFlowEditor()->IsEditing() ; + } // endService( "Graph_Impl::IsExecuting" ); return RetVal ; } bool Graph_Impl::IsReadOnly() { // beginService( "Graph_Impl::IsExecuting" ); - bool RetVal = DataFlowEditor()->IsReadOnly() ; + bool RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->IsReadOnly() ; + } // endService( "Graph_Impl::IsExecuting" ); return RetVal ; } long Graph_Impl::LevelMax() { // beginService( "Graph_Impl::LevelMax" ); - long RetVal = DataFlowEditor()->LevelMax() ; + long RetVal = 0 ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->LevelMax() ; + } // endService( "Graph_Impl::LevelMax" ); return RetVal ; } SUPERV::ListOfNodes * Graph_Impl::LevelNodes(long aLevel ) { // beginService( "Graph_Impl::LevelNodes" ); SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes; - int i ; - SUPERV::ListOfStrings_var Nodes = DataFlowEditor()->LevelNodes( aLevel ) ; + if ( !IsMacro() ) { + int i ; + SUPERV::ListOfStrings_var Nodes = DataFlowEditor()->LevelNodes( aLevel ) ; // RetVal->length( Nodes->length() ); - for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) { + for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) { // char * aNode = Nodes[ i ] ; - GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GetChangeGraphNode( Nodes[ i ] ) ; - RetVal = SetNode( RetVal , aNode ) ; + GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GetChangeGraphNode( Nodes[ i ] ) ; + RetVal = SetNode( RetVal , aNode ) ; // cout << "Graph_Impl::LevelNodes( " << aLevel << " ) " << aNode->Name() << endl ; // CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId , // instanceName() , interfaceName() , @@ -975,25 +1628,35 @@ SUPERV::ListOfNodes * Graph_Impl::LevelNodes(long aLevel ) { // SUPERV::CNode_var iobject ; // iobject = SUPERV::CNode::_narrow(obj) ; // RetVal[i] = SUPERV::CNode::_duplicate( iobject ) ; + } } // endService( "Graph_Impl::LevelNodes" ); return ( RetVal._retn() ) ; } long Graph_Impl::ThreadsMax() { // beginService( "Graph_Impl::ThreadsMax" ); - long RetVal = DataFlowEditor()->ThreadsMax() ; + long RetVal = 0 ; + if ( !IsMacro() ) { + RetVal = DataFlowEditor()->ThreadsMax() ; + } // endService( "Graph_Impl::ThreadsMax" ); return RetVal ; } long Graph_Impl::Threads() { // beginService( "Node_Impl::Threads" ); - long RetVal = _DataFlowExecutor->Threads() ; + long RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowExecutor()->Threads() ; + } // endService( "Node_Impl::Threads" ); return RetVal ; } long Graph_Impl::SuspendedThreads() { // beginService( "Node_Impl::SuspendedThreads" ); - long RetVal = _DataFlowExecutor->SuspendedThreads() ; + long RetVal = false ; + if ( !IsMacro() ) { + RetVal = DataFlowExecutor()->SuspendedThreads() ; + } // endService( "Node_Impl::SuspendedThreads" ); return RetVal ; } @@ -1005,34 +1668,46 @@ bool Graph_Impl::Begin() { perror("pthread_mutex_lock _MutexExecutorWait") ; exit( 0 ) ; } - if ( _DataFlowExecutor ) { - MESSAGE( "Graph_Impl::Begin " << _DataFlowExecutor->Threads() << " threads" ) - if ( _DataFlowExecutor->Threads() ) { - _DataFlowExecutor->JoinedWait() ; + if ( DataFlowExecutor() ) { + MESSAGE( "Graph_Impl::Begin " << DataFlowExecutor()->Threads() << " threads" ) + if ( DataFlowExecutor()->Threads() ) { + DataFlowExecutor()->JoinedWait() ; } - delete _DataFlowExecutor ; - _DataFlowExecutor = NULL ; + delete DataFlowExecutor() ; + DataFlowExecutor( NULL ) ; DataFlowEditor()->Executor( NULL ) ; } - DataFlowEditor()->EditedAfterExecution( false ) ; - int _ExecNumber = theAutomaton->ExecNumber() ; - char ExecNumber[30] ; - sprintf( ExecNumber , "_%d" , _ExecNumber ) ; - int len = strlen( _DebugFileName ) ; - char * DebugFileName = new char [ len + strlen( ExecNumber ) + 6 ] ; - strncpy( DebugFileName , _DebugFileName , len - 4 ) ; - DebugFileName[ len - 4 ] = '\0' ; - strcat( DebugFileName , ExecNumber ) ; - strcat( DebugFileName , "_Exec.log" ) ; - GraphBase::SGraph * myGraph = DataFlowEditor()->GetDataFlow() ; - _DataFlowExecutor = new GraphExecutor::DataFlow( _Orb , _NamingService , - myGraph->Info.theName.c_str() , - DebugFileName , Kind() ) ; - MESSAGE( "Graph_Impl::Begin : DataFlowExecutor created" ); - RetVal = _DataFlowExecutor->LoadDataFlow( *myGraph ) ; - if ( RetVal ) { - _DataFlowExecutor->Graph()->SetObjImpl( DataFlowEditor()->Graph()->ObjImpl() ) ; - DataFlowEditor()->Executor( _DataFlowExecutor ) ; + if ( DataFlowEditor()->IsExecutable() ) { + DataFlowEditor()->EditedAfterExecution( false ) ; + int _ExecNumber = theAutomaton->ExecNumber() ; + char ExecNumber[30] ; + sprintf( ExecNumber , "_%d" , _ExecNumber ) ; + int len = strlen( _DebugFileName ) ; + char * DebugFileName = new char [ len + strlen( ExecNumber ) + 6 ] ; + strncpy( DebugFileName , _DebugFileName , len - 4 ) ; + DebugFileName[ len - 4 ] = '\0' ; + strcat( DebugFileName , ExecNumber ) ; + strcat( DebugFileName , "_Exec.log" ) ; + GraphExecutor::DataFlow * aDataFlowExecutor ; + GraphBase::ListOfSGraphs * myListOfGraphs = DataFlowEditor()->GetDataFlows() ; + int i ; + for ( i = 0 ; i < (int ) myListOfGraphs->size() ; i++ ) { + GraphEditor::DataFlow * aDataFlowEditor ; + aDataFlowEditor = theAutomaton->MapGraph( (*myListOfGraphs)[ i ].Info.theName.c_str() )->GraphEditor() ; + MESSAGE("myListOfGraphs" << i << " " << (*myListOfGraphs)[ i ].Info.theName.c_str() << " " + << aDataFlowEditor << " IsEditing " << aDataFlowEditor->IsEditing() ) ; + + } + aDataFlowExecutor = new GraphExecutor::DataFlow( _Orb , _NamingService , + (*myListOfGraphs)[ 0 ].Info.theName.c_str() , + DebugFileName , Kind() ) ; + DataFlowExecutor( aDataFlowExecutor ) ; + MESSAGE( "Graph_Impl::Begin : DataFlowExecutor created" ); + RetVal = LoadDataFlows( DataFlowExecutor() , myListOfGraphs , 0 ) ; + if ( RetVal ) { + DataFlowExecutor()->Graph()->SetObjImpl( DataFlowEditor()->Graph()->ObjImpl() ) ; + DataFlowEditor()->Executor( DataFlowExecutor() ) ; + } } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { perror("pthread_mutex_unlock _MutexExecutorWait") ; @@ -1044,16 +1719,28 @@ bool Graph_Impl::Begin() { bool Graph_Impl::Run() { beginService( "Graph_Impl::Run" ); bool RetVal = false ; - if ( DataFlowEditor()->IsEditing() ) { - MESSAGE( "Graph_Impl::Run IsEditing" ); - RetVal = Begin() ; + if ( DataFlowEditor()->IsEditing() && !IsMacro() ) { + MESSAGE( "Graph_Impl::Run " << DataFlowEditor()->Graph()->Name() << " " << DataFlowEditor() << " IsEditing" ); + if ( DataFlowEditor()->Graph()->GraphMacroLevel() ) { + MESSAGE( "Graph_Impl::Run " << DataFlowEditor()->Graph()->Name() << " GraphMacroLevel " + << DataFlowEditor()->Graph()->GraphMacroLevel() ) ; + RetVal = true ; + } + else { + MESSAGE( "Graph_Impl::Run " << DataFlowEditor()->Graph()->Name() << " GraphMacroLevel " + << DataFlowEditor()->Graph()->GraphMacroLevel() << " --> Begin()" ) ; + RetVal = Begin() ; + } if ( RetVal ) { - MESSAGE( "Graph_Impl::(Re)Run " ); + MESSAGE( "Graph_Impl::Run " ); + DataFlowEditor()->Executing() ; RetVal = CNode_Impl::Run() ; } } - else { - MESSAGE( "Graph_Impl::(Re)Run " ); + else if ( !IsMacro() ) { + MESSAGE( "Graph_Impl::Run " << DataFlowEditor()->Graph()->Name() << " " << DataFlowEditor() + << " IsNOTEditing --> CNode_Impl::ReRun" ); + DataFlowEditor()->Executing() ; RetVal = CNode_Impl::ReRun() ; } endService( "Graph_Impl::Run" ); @@ -1062,16 +1749,21 @@ bool Graph_Impl::Run() { bool Graph_Impl::Start() { beginService( "Graph_Impl::Start" ); bool RetVal = false ; - if ( DataFlowEditor()->IsEditing() ) { - MESSAGE( "Graph_Impl::Start IsEditing" ); - RetVal = Begin() ; - } - else { - RetVal = true ; - } - if ( RetVal ) { - MESSAGE( "Graph_Impl::(Re)Start " ); - RetVal = ReStart() ; + if ( !IsMacro() ) { + if ( DataFlowEditor()->IsEditing() ) { + MESSAGE( "Graph_Impl::Start IsEditing" ); + RetVal = Begin() ; + } + else { + RetVal = true ; + } + if ( RetVal ) { + MESSAGE( "Graph_Impl::(Re)Start " ); + // Added by NKV to fix PAL6222 --> to be confirm by JR + DataFlowEditor()->Executing() ; + // End of NKV's correction + RetVal = ReStart() ; + } } endService( "Graph_Impl::Start" ); return RetVal ; @@ -1088,9 +1780,9 @@ bool Graph_Impl::EventNoW( SUPERV::CNode_out aNode , perror("pthread_mutex_lock _MutexExecutorWait") ; exit( 0 ) ; } - if ( _DataFlowExecutor && - ( _DataFlowExecutor->GetListSize() || !DataFlowEditor()->IsEditing() ) ) { - RetVal = _DataFlowExecutor->Event( & aNodeName , theEvent , theState , false ) ; + if ( DataFlowExecutor() && !IsMacro() && + ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ) { + RetVal = DataFlowExecutor()->Event( & aNodeName , theEvent , theState , false ) ; // endService( "Graph_Impl::Event" ); if ( strlen( aNodeName ) ) { if ( strcmp( aNodeName , Name() ) ) { @@ -1103,10 +1795,10 @@ bool Graph_Impl::EventNoW( SUPERV::CNode_out aNode , else { aNode = SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ; } -// cout << "Graph_Impl::EventNoW " << aNode->Name() << " QSize " << _DataFlowExecutor->GetListSize() << endl ; +// cout << "Graph_Impl::EventNoW " << aNode->Name() << " QSize " << DataFlowExecutor()->GetListSize() << endl ; } else { -// cout << "Graph_Impl::EventNoW NO DataFlowExecutor or QSize=0 " << endl ; +// cout << "Graph_Impl::EventNoW NO DataFlowExecutor() or QSize=0 " << endl ; } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { perror("pthread_mutex_unlock _MutexExecutorWait") ; @@ -1129,9 +1821,9 @@ bool Graph_Impl::Event( SUPERV::CNode_out aNode , perror("pthread_mutex_lock _MutexExecutorWait") ; exit( 0 ) ; } - if ( _DataFlowExecutor && - ( _DataFlowExecutor->GetListSize() || !DataFlowEditor()->IsEditing() ) ){ - RetVal = _DataFlowExecutor->Event( & aNodeName , theEvent , theState ) ; + if ( DataFlowExecutor() && !IsMacro() && + ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ){ + RetVal = DataFlowExecutor()->Event( & aNodeName , theEvent , theState ) ; // endService( "Graph_Impl::Event" ); if ( strlen( aNodeName ) ) { if ( strcmp( aNodeName , Name() ) ) { @@ -1144,10 +1836,10 @@ bool Graph_Impl::Event( SUPERV::CNode_out aNode , else { aNode = SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ; } -// cout << "Graph_Impl::Event " << aNode->Name() << " QSize " << _DataFlowExecutor->GetListSize() << endl ; +// cout << "Graph_Impl::Event " << aNode->Name() << " QSize " << DataFlowExecutor()->GetListSize() << endl ; } else { -// cout << "Graph_Impl::Event NO DataFlowExecutor or QSize=0 " << endl ; +// cout << "Graph_Impl::Event NO DataFlowExecutor() or QSize=0 " << endl ; } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { perror("pthread_mutex_unlock _MutexExecutorWait") ; @@ -1170,9 +1862,9 @@ bool Graph_Impl::EventW( SUPERV::CNode_out aNode , perror("pthread_mutex_lock _MutexExecutorWait") ; exit( 0 ) ; } - if ( _DataFlowExecutor && - ( _DataFlowExecutor->GetListSize() || !DataFlowEditor()->IsEditing() ) ) { - RetVal = _DataFlowExecutor->EventW( & aNodeName , theEvent , theState ) ; + if ( DataFlowExecutor() && !IsMacro() && + ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ) { + RetVal = DataFlowExecutor()->EventW( & aNodeName , theEvent , theState ) ; if ( RetVal && strcmp( aNodeName , Name() ) ) { aNode = Node( aNodeName ) ; } @@ -1197,8 +1889,8 @@ long Graph_Impl::EventQSize() { perror("pthread_mutex_lock _MutexExecutorWait") ; exit( 0 ) ; } - if ( _DataFlowExecutor ) { - QSize = _DataFlowExecutor->EventQSize() ; + if ( DataFlowExecutor() && !IsMacro() ) { + QSize = DataFlowExecutor()->EventQSize() ; } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { perror("pthread_mutex_unlock _MutexExecutorWait") ; @@ -1215,8 +1907,8 @@ long Graph_Impl::LastLevelDone() { exit( 0 ) ; } long RetVal = 0 ; - if ( _DataFlowExecutor ) { - RetVal = _DataFlowExecutor->LastLevelDone() ; + if ( DataFlowExecutor() && !IsMacro() ) { + RetVal = DataFlowExecutor()->LastLevelDone() ; } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { perror("pthread_mutex_unlock _MutexExecutorWait") ; @@ -1229,7 +1921,7 @@ long Graph_Impl::LastLevelDone() { long Graph_Impl::SubGraphsNumber() { // beginService( "Graph_Impl::SubGraphsNumber" ); long RetVal = 0 ; - if ( DataFlowEditor()->IsExecutable() ) { + if ( DataFlowEditor()->IsExecutable() && !IsMacro() ) { RetVal = DataFlowEditor()->SubGraphsNumber() ; } // endService( "Graph_Impl::SubGraphsNumber" ); @@ -1239,7 +1931,7 @@ long Graph_Impl::SubGraphsNumber() { SUPERV::ListOfNodes * Graph_Impl::SubGraphsNodes( const long aSubGraphNumber ) { beginService( "Graph_Impl::SubGraphsNodes" ); SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes ; - if ( DataFlowEditor()->IsEditing() ) { + if ( DataFlowEditor()->IsEditing() && !IsMacro() ) { SUPERV::ListOfNodes * aGraphNodes = Nodes() ; int i ; // ComputingNodes @@ -1306,8 +1998,10 @@ SUPERV::ListOfNodes * Graph_Impl::SubGraphsNodes( const long aSubGraphNumber ) { bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { // beginService( "Graph_Impl::Merge" ); bool RetVal = true ; - map< string , int > aMapOfNodes ; - RetVal = Merge( aGraph , aMapOfNodes ) ; + if ( !IsMacro() ) { + map< string , int > aMapOfNodes ; + RetVal = Merge( aGraph , aMapOfNodes ) ; + } // endService( "Graph_Impl::Merge" ); return RetVal ; } @@ -1315,7 +2009,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) { beginService( "Graph_Impl::Merge" ); bool RetVal = true ; - if ( DataFlowEditor()->IsEditing() ) { + if ( DataFlowEditor()->IsEditing() && !IsMacro() ) { SUPERV::ListOfNodes * aGraphNodes = aGraph->Nodes() ; int i ; SUPERV::Port_ptr aPort ; @@ -1655,14 +2349,23 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM char * aPortName = aPort->Name() ; char * aNodeName = new char[ strlen( aPortName ) + 1 ] ; strcpy( aNodeName , aPortName ) ; - char * thePortName = strchr( aNodeName , '\\' ) ; - thePortName[ 0 ] = '\0' ; - bool hasinput = aGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ; +// char * thePortName = strchr( aNodeName , '\\' ) ; + char * thePortName = aNodeName ; + while ( ( thePortName = strchr( thePortName , '_' ) ) ) { + if ( thePortName[1] == '_' ) { + thePortName[ 0 ] = '\0' ; + break ; + } + else { + thePortName = &thePortName[2] ; + } + } + bool hasinput = aGraph->Node( aNodeName )->Port( thePortName + 2 )->HasInput() ; // cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1 // << " HasInput " << hasinput << endl ; if ( hasinput ) { RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() , - thePortName + 1 , + thePortName + 2 , *(aPort->ToAny()) ) ; } delete [] aNodeName ; @@ -1682,7 +2385,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::StreamGraph_ptr Graph_Impl::ToStreamGraph() { SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; beginService( "Graph_Impl::ToStreamGraph" ); - if ( IsStreamGraph() ) { + if ( IsStreamGraph() && !IsMacro() ) { // StreamGraph_Impl * myStreamGraph = new StreamGraph_Impl( _Orb , _Poa , _ContId , // instanceName() , interfaceName() ) ; // PortableServer::ObjectId * id = myStreamGraph->getId() ; @@ -1700,3 +2403,4 @@ SUPERV::StreamGraph_ptr Graph_Impl::ToStreamGraph() { } + diff --git a/src/Supervision/Graph_Impl.hxx b/src/Supervision/Graph_Impl.hxx index 0a3b874..66c29ba 100644 --- a/src/Supervision/Graph_Impl.hxx +++ b/src/Supervision/Graph_Impl.hxx @@ -48,8 +48,8 @@ #include "DataFlowEditor_DataFlow.hxx" #include "DataFlowExecutor_DataFlow.hxx" -class Graph_Impl :public INode_Impl , - public POA_SUPERV::Graph { +class Graph_Impl : public POA_SUPERV::Graph , + public GNode_Impl { private: CORBA::ORB_ptr _Orb ; @@ -60,7 +60,7 @@ class Graph_Impl :public INode_Impl , char * _DebugFileName ; pthread_mutex_t _MutexExecutorWait ; - GraphExecutor::DataFlow * _DataFlowExecutor ; +// GraphExecutor::DataFlow * _DataFlowExecutor ; SUPERV::Graph_var myServant; // mpv 23.12.2002: store servant of graph to get constant IOR @@ -73,11 +73,30 @@ class Graph_Impl :public INode_Impl , const char *interfaceName , const char *aDataFlowName , const SUPERV::KindOfNode aKindOfNode ) ; + Graph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphEditor::DataFlow * DataFlowEditor , + GraphEditor::InNode * DataFlowNode ) ; + Graph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * DataFlowExecutor , + GraphExecutor::InNode * DataFlowExecutorNode ) ; virtual SUPERV::Graph_ptr Copy() ; virtual ~Graph_Impl() ; virtual void destroy() ; + void DebugFileName( char * aDebugFileName ) { + _DebugFileName = my_strdup( aDebugFileName ) ; } ; + char * DebugFileName() { + return _DebugFileName ; } ; + virtual char* getIOR(); virtual void ReadOnly() ; @@ -88,9 +107,9 @@ class Graph_Impl :public INode_Impl , // virtual char * DataNodeInfo() ; // virtual char * NodeInfo( const char * aNodeName ) ; - virtual GraphBase::SGraph * GetGraph() ; + virtual GraphBase::ListOfSGraphs * GetGraphs() ; - virtual bool LoadGraph(const GraphBase::SGraph *aGraph ) ; + virtual bool LoadGraphs( GraphBase::ListOfSGraphs *aListOfGraphs ) ; virtual bool Import(const char * aXmlFile ) ; virtual bool Export(const char * aXmlFile ) ; @@ -121,13 +140,30 @@ class Graph_Impl :public INode_Impl , const SUPERV::ListOfStrings & PythonFunction , SUPERV::INode_out anEndOfSwitch ) ; + bool LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor , + GraphBase::ListOfSGraphs * aListOfDataFlows , + int index ) ; + bool LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor , + GraphBase::ListOfSGraphs * aListOfDataFlows , + int index ) ; + virtual SUPERV::Graph_ptr MNode( const char * aXmlFileName ) ; + + virtual SUPERV::Graph_ptr MNode( GraphEditor::DataFlow * aDataFlowEditor , + GraphBase::ListOfSGraphs aListOfDataFlows ) ; + + virtual SUPERV::Graph_ptr GraphMNode( SUPERV::Graph_ptr aGraph ) ; + + virtual SUPERV::Graph_ptr FlowObjRef() ; + + virtual SUPERV::StreamGraph_ptr StreamObjRef() ; + virtual SUPERV::CNode_ptr Node( const char * NodeName ); virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort , SUPERV::Port_ptr InPort ) ; virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , - GraphBase::ComputingNode * aNode ) ; + GraphBase::ComputingNode * aNode ) ; virtual SUPERV::ListOfNodes * Nodes() ; virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ; diff --git a/src/Supervision/INode_Impl.cxx b/src/Supervision/INode_Impl.cxx index cd5e83e..a17f538 100644 --- a/src/Supervision/INode_Impl.cxx +++ b/src/Supervision/INode_Impl.cxx @@ -24,20 +24,21 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) : + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { - CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName ) { + CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) { // MESSAGE("INode_Impl::INode_Impl activate object instanceName(" // << instanceName << ") interfaceName(" << interfaceName << ") --> " // << hex << (void *) this << dec ) // _thisObj = this ; // _id = _poa->activate_object(_thisObj); - MESSAGE( "INode_Impl::INode_Impl " << aDataFlowName ); - beginService( "INode_Impl::INode_Impl" ); +// MESSAGE( "INode_Impl::INode_Impl " << aDataFlowName ); +// beginService( "INode_Impl::INode_Impl" ); _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - endService( "INode_Impl::INode_Impl" ); +// endService( "INode_Impl::INode_Impl" ); } INode_Impl::INode_Impl() { @@ -54,22 +55,22 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb , const SUPERV::KindOfNode NodeKindOfNode ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName , NodeKindOfNode , FuncName , aPythonFunction ) { - beginService( "INode_Impl::INode_Impl" ); +// beginService( "INode_Impl::INode_Impl" ); if ( FuncName ) { // cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName // << " " << strlen( FuncName ) << endl ; } if ( NodeKindOfNode == SUPERV::InLineNode ) { - MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" ); +// MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } - MESSAGE("INode_Impl::INode_Impl " << FuncName << " " << strlen( FuncName ) ) ; +// MESSAGE("INode_Impl::INode_Impl " << FuncName << " " << strlen( FuncName ) ) ; _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; // DataFlowNode()->SetPythonFunction( FuncName , aPythonFunction ) ; - endService( "INode_Impl::INode_Impl" ); +// endService( "INode_Impl::INode_Impl" ); } INode_Impl::INode_Impl( CORBA::ORB_ptr orb , @@ -83,18 +84,18 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb , const SUPERV::KindOfNode NodeKindOfNode ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName[0].c_str() , NodeKindOfNode , FuncName , aPythonFunction ) { - beginService( "INode_Impl::INode_Impl" ); +// beginService( "INode_Impl::INode_Impl" ); if ( NodeKindOfNode == SUPERV::InLineNode ) { - MESSAGE( "INode_Impl::INode_Impl " << FuncName[0] << " _poa->activate_object" ); +// MESSAGE( "INode_Impl::INode_Impl " << FuncName[0] << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } - MESSAGE("INode_Impl::INode_Impl " << FuncName[0].c_str() << " " << strlen( FuncName[0].c_str() ) ) ; +// MESSAGE("INode_Impl::INode_Impl " << FuncName[0].c_str() << " " << strlen( FuncName[0].c_str() ) ) ; _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; // DataFlowNode()->SetPythonFunction( FuncName , aPythonFunction ) ; - endService( "INode_Impl::INode_Impl" ); +// endService( "INode_Impl::INode_Impl" ); } INode_Impl::INode_Impl( CORBA::ORB_ptr orb , @@ -106,18 +107,45 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb , GraphEditor::InNode * aDataFlowNode ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) { - MESSAGE( DataFlowNode()->Name() << " " ); - beginService( "INode_Impl::INode_Impl" ); - if ( DataFlowNode()->IsInLineNode() ) { - MESSAGE( "INode_Impl::INode_Impl " << DataFlowNode()->PyFuncName() - << " _poa->activate_object" ); +// beginService( "INode_Impl::INode_Impl" ); + if ( DataFlowNode() && DataFlowNode()->IsInLineNode() ) { +// MESSAGE( "INode_Impl::INode_Impl " << DataFlowNode()->PyFuncName() +// << " _poa->activate_object" ); _thisObj = this ; _id = _poa->activate_object(_thisObj); } + else { +// MESSAGE( "INode_Impl::INode_Impl NO _poa->activate_object" ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; +// endService( "INode_Impl::INode_Impl" ); +} + +INode_Impl::INode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * aDataFlowExecutor , + GraphExecutor::InNode * aDataFlowExecutorNode ) : +// Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { + CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowExecutor , aDataFlowExecutorNode ) { +// beginService( "INode_Impl::INode_Impl" ); + if ( DataFlowExecutorNode() && DataFlowExecutorNode()->IsInLineNode() ) { +// MESSAGE( "INode_Impl::INode_Impl " << DataFlowExecutorNode()->Name() +// << " _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { +// MESSAGE( "INode_Impl::INode_Impl NO _poa->activate_object" ); + } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - endService( "INode_Impl::INode_Impl" ); +// endService( "INode_Impl::INode_Impl" ); } INode_Impl::~INode_Impl() { @@ -142,6 +170,7 @@ bool INode_Impl::Delete() { // beginService( "INode_Impl::Delete" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) RetVal = DataFlowEditor()->UnValid() ; @@ -184,8 +213,8 @@ SUPERV::Port_ptr INode_Impl::InPort( const char *aParameterName , SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ; Port_Impl * myInPort = NULL ; bool InPortCreated = false ; - MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " - << aParameterType << " )" ) ; +// MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " +// << aParameterType << " )" ) ; GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; if ( anInPort == NULL ) { anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ; @@ -227,8 +256,8 @@ SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName , const char *aParameterType ) { Port_Impl * myOutPort = NULL ; SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; - MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " - << aParameterType << " )" ) ; +// MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " +// << aParameterType << " )" ) ; GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; if ( anOutPort == NULL ) { anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ; diff --git a/src/Supervision/INode_Impl.hxx b/src/Supervision/INode_Impl.hxx index fd7342f..f0324d4 100644 --- a/src/Supervision/INode_Impl.hxx +++ b/src/Supervision/INode_Impl.hxx @@ -42,7 +42,8 @@ class INode_Impl : public CNode_Impl , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) ; + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) ; INode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -68,6 +69,13 @@ class INode_Impl : public CNode_Impl , const char *interfaceName , GraphEditor::DataFlow * DataFlowEditor , GraphEditor::InNode * DataFlowNode ) ; + INode_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphExecutor::DataFlow * DataFlowExecutor , + GraphExecutor::InNode * DataFlowExecutorNode ) ; virtual ~INode_Impl() ; virtual void destroy() ; virtual bool Delete() ; diff --git a/src/Supervision/LNode_Impl.cxx b/src/Supervision/LNode_Impl.cxx index 5e20dd8..ce4f467 100644 --- a/src/Supervision/LNode_Impl.cxx +++ b/src/Supervision/LNode_Impl.cxx @@ -98,6 +98,7 @@ bool LNode_Impl::Delete() { beginService( "LNode_Impl::Delete" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) { RetVal = DataFlowEditor()->IsValid() ; diff --git a/src/Supervision/Port_Impl.cxx b/src/Supervision/Port_Impl.cxx index cab7239..3593476 100644 --- a/src/Supervision/Port_Impl.cxx +++ b/src/Supervision/Port_Impl.cxx @@ -117,21 +117,27 @@ void Port_Impl::destroy() { if ( anInPort->GetOutPort() ) { anInPort->GetOutPort()->RemoveInPort( anInPort ) ; } - _DataFlowNode->DelInPort( _DataFlowPort->PortName() ) ; - if ( _DataFlowNode->IsLoopNode() ) { - _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ; - _DataFlowNode->CoupledNode()->DelInPort( _DataFlowPort->PortName() ) ; - _DataFlowNode->CoupledNode()->DelOutPort( _DataFlowPort->PortName() ) ; + if ( _DataFlowNode->IsOneOfInLineNodes() ) { + _DataFlowNode->DelInPort( _DataFlowPort->PortName() ) ; + if ( _DataFlowNode->IsLoopNode() ) { + _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ; + _DataFlowNode->CoupledNode()->DelInPort( _DataFlowPort->PortName() ) ; + _DataFlowNode->CoupledNode()->DelOutPort( _DataFlowPort->PortName() ) ; + } + } + else { } destroyed = true ; } - else if ( !_DataFlowNode->IsLoopNode() ) { + else if ( _DataFlowNode->IsOneOfInLineNodes() && !_DataFlowNode->IsLoopNode() ) { _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ; destroyed = true ; } + else { + destroyed = true ; + } if ( destroyed ) { _DataFlowEditor->UnValid() ; -// _DataFlowEditor->IsValid() ; } } if ( destroyed ) { @@ -143,6 +149,15 @@ void Port_Impl::destroy() { endService( "Port_Impl::destroy" ); } +void Port_Impl::Remove() { + beginService( "Port_Impl::Remove" ); + _poa->deactivate_object(*_id) ; + CORBA::release(_poa) ; + delete(_id) ; + _thisObj->_remove_ref(); + endService( "Port_Impl::Remove" ); +} + bool Port_Impl::Input( const SUPERV::Value_ptr aValue ) { return Input( aValue->ToAny() ) ; } @@ -150,21 +165,23 @@ bool Port_Impl::Input( const SUPERV::Value_ptr aValue ) { bool Port_Impl::Input( const CORBA::Any * anAny ) { beginService( "Port_Impl::Input" ); bool RetVal = false ; - if ( _InputPort && _DataFlowEditor->IsEditing() ) { - RetVal = true ; - Value_Impl::Input( anAny ) ; - RetVal = _DataFlowEditor->AddInputData( _DataFlowNode->Name() , - _DataFlowPort->PortName() , - *anAny ) ; - } - else if ( _DataFlowEditor->IsExecuting() ) { - GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; -// if ( _DataFlowExecutor && ( _DataFlowExecutor->IsSuspended() || -// _DataFlowExecutor->IsSuspended( _DataFlowNode->Name() ) ) ) { - if ( _DataFlowExecutor ) { - RetVal = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() , - _DataFlowPort->PortName() , - *anAny ) ; + if ( _DataFlowEditor->Graph()->GraphMacroLevel() == 0 ) { + if ( _InputPort && _DataFlowEditor->IsEditing() ) { + RetVal = true ; + Value_Impl::Input( anAny ) ; + RetVal = _DataFlowEditor->AddInputData( _DataFlowNode->Name() , + _DataFlowPort->PortName() , + *anAny ) ; + } + else if ( _DataFlowEditor->IsExecuting() ) { + GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; +// if ( _DataFlowExecutor && ( _DataFlowExecutor->IsSuspended() || +// _DataFlowExecutor->IsSuspended( _DataFlowNode->Name() ) ) ) { + if ( _DataFlowExecutor ) { + RetVal = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() , + _DataFlowPort->PortName() , + *anAny ) ; + } } } if ( !RetVal ) { diff --git a/src/Supervision/Port_Impl.hxx b/src/Supervision/Port_Impl.hxx index eddd426..dcf7bff 100644 --- a/src/Supervision/Port_Impl.hxx +++ b/src/Supervision/Port_Impl.hxx @@ -83,6 +83,8 @@ class Port_Impl : public Value_Impl , virtual ~Port_Impl() ; virtual void destroy() ; + virtual void Remove() ; + GraphEditor::DataFlow * DataFlowEditor() { return _DataFlowEditor ; } ; GraphEditor::InNode * DataFlowNode() { diff --git a/src/Supervision/SNode_Impl.cxx b/src/Supervision/SNode_Impl.cxx index 1d6b83e..d1d0275 100644 --- a/src/Supervision/SNode_Impl.cxx +++ b/src/Supervision/SNode_Impl.cxx @@ -95,6 +95,7 @@ bool SNode_Impl::Delete() { // beginService( "SNode_Impl::Delete" ); bool RetVal = false ; if ( DataFlowEditor()->IsEditing() ) { + DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) RetVal = DataFlowEditor()->IsValid() ; diff --git a/src/Supervision/StreamGraph_Impl.cxx b/src/Supervision/StreamGraph_Impl.cxx index 0319e26..315560d 100644 --- a/src/Supervision/StreamGraph_Impl.cxx +++ b/src/Supervision/StreamGraph_Impl.cxx @@ -35,8 +35,10 @@ StreamGraph_Impl::StreamGraph_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) : - Graph_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName , SUPERV::DataStreamGraph ) { + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfGraphNode ) : +// Graph_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName , SUPERV::DataStreamGraph ) { + Graph_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName , aKindOfGraphNode ) { // MESSAGE("StreamGraph_Impl::StreamGraph_Impl activate object instanceName(" // << instanceName << ") interfaceName(" << interfaceName << ") --> " // << hex << (void *) this << dec ) @@ -50,6 +52,30 @@ StreamGraph_Impl::StreamGraph_Impl( CORBA::ORB_ptr orb , endService( "StreamGraph_Impl::StreamGraph_Impl" ); } +StreamGraph_Impl::StreamGraph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphEditor::DataFlow * aDataFlowEditor , + GraphEditor::InNode * aDataFlowNode ) : + Graph_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) { + MESSAGE( aDataFlowNode->Name() << " " ); + beginService( "StreamGraph_Impl::StreamGraph_Impl" ); + if ( aDataFlowNode->IsMacroNode() ) { + MESSAGE( "StreamGraph_Impl::StreamGraph_Impl _poa->activate_object" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } + else { + MESSAGE( "StreamGraph_Impl::StreamGraph_Impl NO _poa->activate_object " ); + } + _Orb = CORBA::ORB::_duplicate(orb); + _Poa = poa ; + _ContId = contId ; + endService( "StreamGraph_Impl::StreamGraph_Impl" ); +} + StreamGraph_Impl::StreamGraph_Impl() { } @@ -69,25 +95,99 @@ void StreamGraph_Impl::destroy() { SUPERV::StreamGraph_ptr StreamGraph_Impl::StreamCopy() { beginService( "StreamGraph_Impl::StreamCopy" ); - StreamGraph_Impl * myStreamGraph ; - myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId, - instanceName() , interfaceName() , - DataFlowEditor()->Graph()->Name() ) ; - PortableServer::ObjectId * id = myStreamGraph->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::StreamGraph_var iobject ; - iobject = SUPERV::StreamGraph::_narrow(obj) ; - GraphBase::SGraph * aSGraph = GetGraph() ; - myStreamGraph->LoadGraph( aSGraph ) ; + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; + if ( !IsMacro() ) { + StreamGraph_Impl * myStreamGraph ; + myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + DataFlowEditor()->Graph()->Name() ) ; + PortableServer::ObjectId * id = myStreamGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::StreamGraph::_narrow(obj) ; + GraphBase::ListOfSGraphs * aListOfSGraphs = GetGraphs() ; + myStreamGraph->LoadGraphs( aListOfSGraphs ) ; + } endService( "StreamGraph_Impl::StreamCopy" ); return SUPERV::StreamGraph::_duplicate(iobject) ; } +SUPERV::StreamGraph_ptr StreamGraph_Impl::StreamMNode( const char * aXmlFileName ) { + beginService( "StreamGraph_Impl::StreamMNode" ); + SUPERV::StreamGraph_var streamiobject = SUPERV::StreamGraph::_nil() ; + SUPERV::StreamGraph_var macroiobject = SUPERV::StreamGraph::_nil() ; +#if 0 + string dbgfile ; + GraphEditor::DataFlow * aDataFlowEditor ; + CreateEditor( _Orb , instanceName() , aXmlFileName , SUPERV::DataStreamGraph , + dbgfile , &aDataFlowEditor ) ; + int lenname = strlen( aXmlFileName ) ; + bool created = false ; + if ( lenname > 4 && !strcmp( &aXmlFileName[ lenname - 4 ] , ".xml" ) ) { + created = aDataFlowEditor->LoadXml( aXmlFileName ) ; + } + if ( created ) { + StreamGraph_Impl * myStreamGraph ; + myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aDataFlowEditor , NULL ) ; + PortableServer::ObjectId * id = myStreamGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + streamiobject = SUPERV::StreamGraph::_narrow( obj ) ; + myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( streamiobject ) ) ; + + StreamGraph_Impl * myStreamMacroNode ; + myStreamMacroNode = new StreamGraph_Impl( _Orb , _Poa, _ContId, + instanceName() , interfaceName() , + aXmlFileName , SUPERV::StreamMacroNode ) ; + id = myStreamMacroNode->getId() ; + obj = _poa->id_to_reference(*id); + macroiobject = SUPERV::StreamGraph::_narrow( obj ) ; + myStreamMacroNode->DataFlowEditor( DataFlowEditor() ) ; + myStreamMacroNode->DataFlowEditor()->Graph()->SetObjImpl( this ) ; + myStreamMacroNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ; + char * aMacroNodeName = myStreamGraph->Name() ; + GraphBase::ListOfFuncName aFuncName ; + aFuncName.resize( 1 ) ; + aFuncName[0] = "" ; + SUPERV::ListOfStrings aListOfStrings ; + aListOfStrings.length( 1 ) ; + aListOfStrings[0] = "" ; + GraphBase::ListOfPythonFunctions aPythonFunction ; + aPythonFunction.resize( 1 ) ; + aPythonFunction[0] = &aListOfStrings ; + SALOME_ModuleCatalog::Service * aMacroNodeService = myStreamGraph->Service() ; + GraphEditor::InNode * aDataFlowNode = DataFlowEditor()->AddNode( *aMacroNodeService , "" , "" , + aMacroNodeName , SUPERV::StreamMacroNode , + aFuncName , aPythonFunction ) ; + myStreamMacroNode->DataFlowNode( aDataFlowNode ) ; + myStreamGraph->MacroObject( SUPERV::StreamGraph::_duplicate( macroiobject ) ) ; + myStreamMacroNode->MacroObject( SUPERV::StreamGraph::_duplicate( streamiobject ) ) ; + MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode " + << aDataFlowNode << " " << aDataFlowNode->Name() + << " created" ) ; + } + else { + delete aDataFlowEditor ; + } +#endif + endService( "StreamGraph_Impl::StreamMNode" ); + return SUPERV::StreamGraph::_duplicate( macroiobject ) ; +} + +SUPERV::StreamGraph_ptr StreamGraph_Impl::StreamGraphMNode( SUPERV::StreamGraph_ptr myMacroStreamGraph ) { + SUPERV::StreamGraph_var iobject = myMacroStreamGraph ; +// GraphBase::Graph * myMacroGraph = aGraph; + SUPERV::StreamGraph_var macroiobject = SUPERV::StreamGraph::_nil() ; + beginService( "StreamGraph_Impl::StreamGraphMNode" ) ; + endService( "StreamGraph_Impl::StreamGraphMNode" ) ; + return SUPERV::StreamGraph::_duplicate( macroiobject ) ; +} + SUPERV::StreamLink_ptr StreamGraph_Impl::StreamLink( SUPERV::StreamPort_ptr OutStreamPort , SUPERV::StreamPort_ptr InStreamPort ) { beginService( "StreamGraph_Impl::StreamLink" ); SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ; - if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && + if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() && OutStreamPort->IsDataStream() && InStreamPort->IsDataStream() ) { GraphBase::InPort * anInPort = DataFlowEditor()->GetNode( InStreamPort->Node()->Name() )->ComputingNode()->GetChangeInPort( InStreamPort->Name() ) ; GraphBase::OutPort * anOutPort = DataFlowEditor()->GetNode( OutStreamPort->Node()->Name() )->ComputingNode()->GetChangeOutPort( OutStreamPort->Name() ) ; @@ -131,64 +231,134 @@ SUPERV::ListOfStreamLinks * StreamGraph_Impl::StreamLinks( GraphBase::ComputingN const char * anInputParam ) { bool begin = true ; SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ; - int i , j , countlink ; - countlink = 0 ; - for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { - GraphEditor::InNode * aNode = NULL ; - aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ; - bool ToProcess = false ; - if ( theNode == NULL ) { - ToProcess = true ; - } - else { - if ( !strcmp( theNode->Name() , aNode->Name() ) ) { - if ( !theNode->IsEndSwitchNode() ) { + if ( !IsMacro() ) { + int i , j , countlink ; + countlink = 0 ; + for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { + GraphEditor::InNode * aNode = NULL ; + aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ; + bool ToProcess = false ; + if ( theNode == NULL ) { + ToProcess = true ; + } + else { + if ( !strcmp( theNode->Name() , aNode->Name() ) ) { + if ( !theNode->IsEndSwitchNode() ) { + ToProcess = true ; + } + } + else if ( theNode->IsEndSwitchNode() ) { ToProcess = true ; - } + } } - else if ( theNode->IsEndSwitchNode() ) { - ToProcess = true ; + if ( ToProcess ) { + for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = NULL ; + anInPort = aNode->GetChangeNodeInPort( j ) ; + if ( anInputParam == NULL || + !strcmp( anInPort->PortName() , anInputParam ) ) { + GraphBase::OutPort * anOutPort = NULL ; + anOutPort = anInPort->GetOutPort() ; + if ( anOutPort && anOutPort->IsDataStream() ) { + if ( strcmp( anOutPort->NodeName() , Name() ) ) { + MESSAGE("StreamGraph_Impl::StreamLinks " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ") --> " << aNode->Name() << "(" + << anInPort->PortName() << ")" ) ; + if ( theNode == NULL || + ( theNode != NULL && !theNode->IsEndSwitchNode() && + !strcmp( theNode->Name() , aNode->Name() ) ) ) { + if ( anInPort->IsLoop() || anOutPort->IsLoop() || + ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , + anOutPort->NodeName() ) ) ) { + MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ") --> " << aNode->Name() << "(" + << anInPort->PortName() << ")" << " ignored" ) ; + } + else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "StreamGraph_Impl::StreamLinks" ); + begin = false ; + } + GraphEditor::InNode * anOutNode = NULL ; + anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; + if ( anOutNode ) { + bool Success ; + StreamLink_Impl * myStreamLink = new StreamLink_Impl( + _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + aNode , + anInPort->PortName() , + anOutNode , + anOutPort->PortName() , + false , Success ) ; + if ( Success ) { + PortableServer::ObjectId * id = myStreamLink->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamLink_var iobject ; + iobject = SUPERV::StreamLink::_narrow(obj) ; + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ; + MESSAGE( "Link" << countlink-1 << " " + << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "(" + << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> " + << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "(" + << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; + } + } + } + else { + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; + MESSAGE( "Link" << countlink-1 << " " + << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "(" + << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> " + << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "(" + << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; + } + } + } + } + } + } } - } - if ( ToProcess ) { - for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) { - GraphBase::InPort * anInPort = NULL ; - anInPort = aNode->GetChangeNodeInPort( j ) ; - if ( anInputParam == NULL || - !strcmp( anInPort->PortName() , anInputParam ) ) { - GraphBase::OutPort * anOutPort = NULL ; - anOutPort = anInPort->GetOutPort() ; - if ( anOutPort && anOutPort->IsDataStream() ) { - if ( strcmp( anOutPort->NodeName() , Name() ) ) { - MESSAGE("StreamGraph_Impl::StreamLinks " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ") --> " << aNode->Name() << "(" - << anInPort->PortName() << ")" ) ; - if ( theNode == NULL || - ( theNode != NULL && !theNode->IsEndSwitchNode() && - !strcmp( theNode->Name() , aNode->Name() ) ) ) { - if ( anInPort->IsLoop() || anOutPort->IsLoop() || - ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , - anOutPort->NodeName() ) ) ) { + for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ; + int k ; + for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; + GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; + if ( theNode == NULL || + !strcmp( theNode->Name() , aNode->Name() ) ) { + if ( anInPort->IsDataStream() ) { + if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { + if ( anInputParam == NULL || + !strcmp( anInPort->PortName() , anInputParam ) ) { MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ") --> " << aNode->Name() << "(" - << anInPort->PortName() << ")" << " ignored" ) ; - } - else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { - if ( begin ) { - beginService( "StreamGraph_Impl::StreamLinks" ); - begin = false ; - } - GraphEditor::InNode * anOutNode = NULL ; - anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; - if ( anOutNode ) { + << anOutPort->PortName() << ") --> " << toNode->Name() << "(" + << anInPort->PortName() << ")" ) ; + MESSAGE( " IOR " << DataFlowEditor()->ObjectToString( anOutPort->InPortObjRef( anInPort ) ) ) ; + if ( anInPort->IsLoop() || anOutPort->IsLoop() || + ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , + anOutPort->NodeName() ) ) ) { + MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ") --> " << toNode->Name() << "(" + << anInPort->PortName() << ")" << " ignored" ) ; + } + else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "Graph_Impl::StreamLinks" ); + begin = false ; + } bool Success ; StreamLink_Impl * myStreamLink = new StreamLink_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , - aNode , + toNode , anInPort->PortName() , - anOutNode , + aNode , anOutPort->PortName() , false , Success ) ; if ( Success ) { @@ -206,115 +376,47 @@ SUPERV::ListOfStreamLinks * StreamGraph_Impl::StreamLinks( GraphBase::ComputingN << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; } } - } - else { - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; - MESSAGE( "Link" << countlink-1 << " " - << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "(" - << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> " - << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "(" - << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; - } - } - } - } - } - } - } - for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { - GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ; - int k ; - for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { - GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; - GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; - if ( theNode == NULL || - !strcmp( theNode->Name() , aNode->Name() ) ) { - if ( anInPort->IsDataStream() ) { - if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { - if ( anInputParam == NULL || - !strcmp( anInPort->PortName() , anInputParam ) ) { - MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ") --> " << toNode->Name() << "(" - << anInPort->PortName() << ")" ) ; - MESSAGE( " IOR " << DataFlowEditor()->ObjectToString( anOutPort->InPortObjRef( anInPort ) ) ) ; - if ( anInPort->IsLoop() || anOutPort->IsLoop() || - ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , - anOutPort->NodeName() ) ) ) { - MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ") --> " << toNode->Name() << "(" - << anInPort->PortName() << ")" << " ignored" ) ; - } - else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { - if ( begin ) { - beginService( "Graph_Impl::StreamLinks" ); - begin = false ; - } - bool Success ; - StreamLink_Impl * myStreamLink = new StreamLink_Impl( - _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - DataFlowEditor() , - toNode , - anInPort->PortName() , - aNode , - anOutPort->PortName() , - false , Success ) ; - if ( Success ) { - PortableServer::ObjectId * id = myStreamLink->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::StreamLink_var iobject ; - iobject = SUPERV::StreamLink::_narrow(obj) ; + else { RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ; - anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ; + RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; MESSAGE( "Link" << countlink-1 << " " << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "(" << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> " << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "(" << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; - } + } } else { - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; - MESSAGE( "Link" << countlink-1 << " " - << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "(" - << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> " - << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "(" - << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ; + MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" + << anOutPort->PortName() << ") --> " << toNode->Name() << "(" + << anInPort->PortName() << ")" << " skipped" ) ; } } - else { - MESSAGE( "StreamLink " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ") --> " << toNode->Name() << "(" - << anInPort->PortName() << ")" << " skipped" ) ; - } } } - } + } } } - } //#if 0 - const char * NodeName = "" ; - const char * InputParamName = "" ; - if ( theNode ) { - NodeName = theNode->Name() ; - } - if ( anInputParam ) { - InputParamName = anInputParam ; - } - MESSAGE( RetVal->length() << " StreamLinks of Node " << NodeName << " and of InPort " << InputParamName ) ; - for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { - MESSAGE( "Link" << i << " " << RetVal[i]->OutStreamPort()->Node()->Name() << "(" - << RetVal[i]->OutStreamPort()->Name() << ") --> " - << RetVal[i]->InStreamPort()->Node()->Name() << "(" - << RetVal[i]->InStreamPort()->Name() << ")" ) ; - } + const char * NodeName = "" ; + const char * InputParamName = "" ; + if ( theNode ) { + NodeName = theNode->Name() ; + } + if ( anInputParam ) { + InputParamName = anInputParam ; + } + MESSAGE( RetVal->length() << " StreamLinks of Node " << NodeName << " and of InPort " << InputParamName ) ; + for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { + MESSAGE( "Link" << i << " " << RetVal[i]->OutStreamPort()->Node()->Name() << "(" + << RetVal[i]->OutStreamPort()->Name() << ") --> " + << RetVal[i]->InStreamPort()->Node()->Name() << "(" + << RetVal[i]->InStreamPort()->Name() << ")" ) ; + } //#endif - if ( !begin ) { - endService( "StreamGraph_Impl::StreamLinks" ); + if ( !begin ) { + endService( "StreamGraph_Impl::StreamLinks" ); + } } return ( RetVal._retn() ) ; } @@ -322,9 +424,12 @@ SUPERV::ListOfStreamLinks * StreamGraph_Impl::StreamLinks( GraphBase::ComputingN bool StreamGraph_Impl::SetStreamParams( const long Timeout , const SUPERV::KindOfDataStreamTrace DataStreamTrace , const double DeltaTime ) { - bool sts = DataFlowEditor()->StreamGraph()->SetStreamParams( Timeout , DataStreamTrace , DeltaTime ) ; - if ( sts ) { - DataFlowEditor()->UnValid() ; + bool sts = false ; + if ( !IsMacro() ) { + sts = DataFlowEditor()->StreamGraph()->SetStreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + if ( sts ) { + DataFlowEditor()->UnValid() ; + } } return sts ; } @@ -332,13 +437,15 @@ bool StreamGraph_Impl::SetStreamParams( const long Timeout , void StreamGraph_Impl::StreamParams( long & Timeout , SUPERV::KindOfDataStreamTrace & DataStreamTrace , double & DeltaTime ) { - DataFlowEditor()->StreamGraph()->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + if ( !IsMacro() ) { + DataFlowEditor()->StreamGraph()->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + } } long StreamGraph_Impl::SubStreamGraphsNumber() { // beginService( "StreamGraph_Impl::StreamGraphsNumber" ); long RetVal = 0 ; - if ( DataFlowEditor()->IsExecutable() ) { + if ( DataFlowEditor()->IsExecutable() && !IsMacro() ) { RetVal = DataFlowEditor()->SubStreamGraphsNumber() ; } // endService( "StreamGraph_Impl::SubStreamGraphsNumber" ); @@ -348,7 +455,7 @@ long StreamGraph_Impl::SubStreamGraphsNumber() { SUPERV::ListOfNodes * StreamGraph_Impl::SubStreamGraphsNodes( const long aSubStreamGraphNumber ) { beginService( "StreamGraph_Impl::SubStreamGraphsNodes" ); SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes ; - if ( DataFlowEditor()->IsEditing() ) { + if ( DataFlowEditor()->IsEditing() && !IsMacro() ) { SUPERV::ListOfNodes * aGraphNodes = Nodes() ; int i ; // ComputingNodes @@ -415,12 +522,14 @@ SUPERV::ListOfNodes * StreamGraph_Impl::SubStreamGraphsNodes( const long aSubStr SUPERV::Graph_ptr StreamGraph_Impl::ToFlowGraph() { SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; beginService( "StreamGraph_Impl::ToFlowGraph" ); -// Graph_Impl * myFlowGraph = new Graph_Impl( _Orb , _Poa , _ContId , -// instanceName() , interfaceName() ) ; -// PortableServer::ObjectId * id = myFlowGraph->getId() ; -// CORBA::Object_var obj = _poa->id_to_reference(*id); - if ( !CORBA::is_nil( DataFlowEditor()->StreamGraph()->ObjRef() ) ) { - iobject = SUPERV::Graph::_narrow( DataFlowEditor()->StreamGraph()->ObjRef() ) ; + if ( !IsMacro() ) { +// Graph_Impl * myFlowGraph = new Graph_Impl( _Orb , _Poa , _ContId , +// instanceName() , interfaceName() ) ; +// PortableServer::ObjectId * id = myFlowGraph->getId() ; +// CORBA::Object_var obj = _poa->id_to_reference(*id); + if ( !CORBA::is_nil( DataFlowEditor()->StreamGraph()->ObjRef() ) ) { + iobject = SUPERV::Graph::_narrow( DataFlowEditor()->StreamGraph()->ObjRef() ) ; + } } endService( "StreamGraph_Impl::ToFlowGraph" ); return SUPERV::Graph::_duplicate( iobject ) ; @@ -428,74 +537,78 @@ SUPERV::Graph_ptr StreamGraph_Impl::ToFlowGraph() { bool StreamGraph_Impl::StreamMerge(const SUPERV::StreamGraph_ptr aStreamGraph ) { beginService( "StreamGraph_Impl::StreamMerge" ); - map< string , int > aMapOfNodes ; - bool RetVal = Merge( aStreamGraph , aMapOfNodes ) ; - if ( RetVal ) { - SUPERV::ListOfStreamLinks * aGraphLinks = aStreamGraph->GStreamLinks() ; - SUPERV::ListOfStreamPorts * aGraphPorts = aStreamGraph->StreamPorts() ; - cout << "Graph_Impl::Merge " << aGraphLinks->length() << " links " << aGraphPorts->length() << " GraphPorts" - << endl ; - int i ; - for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) { - SUPERV::StreamLink_var aLink = (*aGraphLinks)[ i ] ; - SUPERV::StreamPort_var OutPort = aLink->OutStreamPort() ; - SUPERV::StreamPort_var InPort = aLink->InStreamPort() ; - string * aLinkFromNodeName = new string( OutPort->Node()->Name() ) ; - string * aLinkToNodeName = new string( InPort->Node()->Name() ) ; - cout << "Graph_Impl::Merge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> " - << aLinkToNodeName << "(" << InPort->Name() << ")" << endl ; - RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - OutPort->Name() , - DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - InPort->Name() ) ; - cout << "Graph_Impl::Merge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> " - << aLinkToNodeName << "(" << InPort->Name() << ") RetVal" << RetVal << endl ; - if ( RetVal ) { - int j ; - for ( j = 1 ; j <= aLink->CoordsSize() ; j++ ) { - long X , Y ; - RetVal = aLink->Coords( j , X , Y ) ; - if ( !RetVal ) - break ; - RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - OutPort->Name() , - DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - InPort->Name() , - j , X , Y ) ; - if ( !RetVal ) { - break ; - } - } - } - delete aLinkFromNodeName ; - delete aLinkToNodeName ; - if ( !RetVal ) { - break ; - } - } + bool RetVal = false ; + if ( !IsMacro() ) { + map< string , int > aMapOfNodes ; + RetVal = Merge( aStreamGraph , aMapOfNodes ) ; if ( RetVal ) { - for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) { - SUPERV::StreamPort_var aPort = (*aGraphPorts)[ i ] ; - if ( !aPort->IsGate() ) { - MESSAGE( "Graph_Impl::Merge " << i << ". " << aPort->Node()->Name() << " " << aPort->Name() ) ; - char * aPortName = aPort->Name() ; - char * aNodeName = new char[ strlen( aPortName ) + 1 ] ; - strcpy( aNodeName , aPortName ) ; - char * thePortName = strchr( aNodeName , '\\' ) ; - thePortName[ 0 ] = '\0' ; - bool hasinput = aStreamGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ; -// cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1 -// << " HasInput " << hasinput << endl ; - if ( hasinput ) { - RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->StreamGraph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() , - thePortName + 1 , - *(aPort->ToAny()) ) ; - } - delete [] aNodeName ; - if ( !RetVal ) { - break ; + SUPERV::ListOfStreamLinks * aGraphLinks = aStreamGraph->GStreamLinks() ; + SUPERV::ListOfStreamPorts * aGraphPorts = aStreamGraph->StreamPorts() ; + //cout << "Graph_Impl::StreamMerge " << aGraphLinks->length() << " links " << aGraphPorts->length() +// << " GraphPorts" << endl ; + int i ; + for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) { + SUPERV::StreamLink_var aLink = (*aGraphLinks)[ i ] ; + SUPERV::StreamPort_var OutPort = aLink->OutStreamPort() ; + SUPERV::StreamPort_var InPort = aLink->InStreamPort() ; + string * aLinkFromNodeName = new string( OutPort->Node()->Name() ) ; + string * aLinkToNodeName = new string( InPort->Node()->Name() ) ; + //cout << "Graph_Impl::StreamMerge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> " +// << aLinkToNodeName << "(" << InPort->Name() << ")" << endl ; + RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + OutPort->Name() , + DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + InPort->Name() ) ; + //cout << "Graph_Impl::StreamMerge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> " +// << aLinkToNodeName << "(" << InPort->Name() << ") RetVal" << RetVal << endl ; + if ( RetVal ) { + int j ; + for ( j = 1 ; j <= aLink->CoordsSize() ; j++ ) { + long X , Y ; + RetVal = aLink->Coords( j , X , Y ) ; + if ( !RetVal ) + break ; + RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + OutPort->Name() , + DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + InPort->Name() , + j , X , Y ) ; + if ( !RetVal ) { + break ; + } } - } + } + delete aLinkFromNodeName ; + delete aLinkToNodeName ; + if ( !RetVal ) { + break ; + } + } + if ( RetVal ) { + for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) { + SUPERV::StreamPort_var aPort = (*aGraphPorts)[ i ] ; + if ( !aPort->IsGate() ) { + MESSAGE( "Graph_Impl::StreamMerge " << i << ". " << aPort->Node()->Name() << " " << aPort->Name() ) ; + char * aPortName = aPort->Name() ; + char * aNodeName = new char[ strlen( aPortName ) + 1 ] ; + strcpy( aNodeName , aPortName ) ; +// char * thePortName = strchr( aNodeName , '\\' ) ; + char * thePortName = strchr( aNodeName , '_' ) ; + thePortName[ 0 ] = '\0' ; + bool hasinput = aStreamGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ; +// cout << "Graph_Impl::StreamMerge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1 +// << " HasInput " << hasinput << endl ; + if ( hasinput ) { + RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->StreamGraph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() , + thePortName + 1 , + *(aPort->ToAny()) ) ; + } + delete [] aNodeName ; + if ( !RetVal ) { + break ; + } + } + } } } } diff --git a/src/Supervision/StreamGraph_Impl.hxx b/src/Supervision/StreamGraph_Impl.hxx index c3ea3bd..58bca48 100644 --- a/src/Supervision/StreamGraph_Impl.hxx +++ b/src/Supervision/StreamGraph_Impl.hxx @@ -39,8 +39,8 @@ #include "Graph_Impl.hxx" -class StreamGraph_Impl : public Graph_Impl , - public POA_SUPERV::StreamGraph { +class StreamGraph_Impl : public POA_SUPERV::StreamGraph , + public Graph_Impl { private: CORBA::ORB_ptr _Orb ; @@ -54,34 +54,45 @@ class StreamGraph_Impl : public Graph_Impl , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) ; + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfGraphNode = SUPERV::DataStreamGraph ) ; + StreamGraph_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + GraphEditor::DataFlow * DataFlowEditor , + GraphEditor::InNode * DataFlowNode ) ; + + virtual ~StreamGraph_Impl() ; + virtual void destroy() ; - virtual ~StreamGraph_Impl() ; - virtual void destroy() ; + virtual SUPERV::StreamGraph_ptr StreamCopy() ; - virtual SUPERV::StreamGraph_ptr StreamCopy() ; + virtual SUPERV::StreamGraph_ptr StreamMNode( const char * aXmlFileName ) ; + virtual SUPERV::StreamGraph_ptr StreamGraphMNode( SUPERV::StreamGraph_ptr aStreamGraph ) ; - virtual SUPERV::StreamLink_ptr StreamLink( SUPERV::StreamPort_ptr OutStreamPort , - SUPERV::StreamPort_ptr InStreamPort ) ; + virtual SUPERV::StreamLink_ptr StreamLink( SUPERV::StreamPort_ptr OutStreamPort , + SUPERV::StreamPort_ptr InStreamPort ) ; - virtual SUPERV::ListOfStreamLinks * GStreamLinks() ; + virtual SUPERV::ListOfStreamLinks * GStreamLinks() ; - virtual SUPERV::ListOfStreamLinks * StreamLinks( GraphBase::ComputingNode * aNode , - const char * anInputParam ) ; + virtual SUPERV::ListOfStreamLinks * StreamLinks( GraphBase::ComputingNode * aNode , + const char * anInputParam ) ; - virtual bool SetStreamParams( const long Timeout , - const SUPERV::KindOfDataStreamTrace DataStreamTrace , - const double DeltaTime ) ; - virtual void StreamParams( long & Timeout , - SUPERV::KindOfDataStreamTrace & DataStreamTrace , - double & DeltaTime ) ; + virtual bool SetStreamParams( const long Timeout , + const SUPERV::KindOfDataStreamTrace DataStreamTrace , + const double DeltaTime ) ; + virtual void StreamParams( long & Timeout , + SUPERV::KindOfDataStreamTrace & DataStreamTrace , + double & DeltaTime ) ; - virtual long SubStreamGraphsNumber() ; - virtual SUPERV::ListOfNodes * SubStreamGraphsNodes( const long aSubStreamGraphNumber ) ; + virtual long SubStreamGraphsNumber() ; + virtual SUPERV::ListOfNodes * SubStreamGraphsNodes( const long aSubStreamGraphNumber ) ; - virtual SUPERV::Graph_ptr ToFlowGraph() ; + virtual SUPERV::Graph_ptr ToFlowGraph() ; - bool StreamMerge( const SUPERV::StreamGraph_ptr aStreamGraph ) ; + bool StreamMerge( const SUPERV::StreamGraph_ptr aStreamGraph ) ; }; diff --git a/src/Supervision/SuperV.py b/src/Supervision/SuperV.py index 76e33d7..7055d82 100644 --- a/src/Supervision/SuperV.py +++ b/src/Supervision/SuperV.py @@ -448,6 +448,12 @@ class CNode: return self.N.IsStreamGraph() def IsGraph( self ): return self.N.IsGraph() + def IsMacro( self ): + return self.N.IsMacro() + def IsFlowMacro( self ): + return self.N.IsFlowMacro() + def IsStreamMacro( self ): + return self.N.IsStreamMacro() def IsComputing( self ): return self.N.IsComputing() def IsFactory( self ): @@ -464,6 +470,8 @@ class CNode: return self.N.IsSwitch() def IsEndSwitch( self ): return self.N.IsEndSwitch() + def GraphLevel( self ) : + return self.N.GraphLevel() def SubGraph( self ): return self.N.SubGraph() def SubStreamGraph( self ): @@ -484,8 +492,6 @@ class CNode: return self.N.Control() def ControlClear( self ): return self.N.ControlClear() - def AutoState( self ): - return self.N.AutoState() def ReadyW( self ): return self.N.ReadyW() def RunningW( self ): @@ -708,7 +714,7 @@ class ESNode(GNode): # self.Parametername = aServicesParameter.Parametername ########################################################## -class Graph(INode): +class Graph(GNode): ########################################################## def __init__( self , aName ): try: @@ -717,7 +723,7 @@ class Graph(INode): try: graph = aName.G.Copy() except: - graph = None + graph = aName if graph != None : if graph.IsStreamGraph() : aGraph = graph.ToStreamGraph() @@ -803,6 +809,36 @@ class Graph(INode): if self.G.Verbose : print ErrMsg return aNode + def MNode( self , aGraphXml ): + aMNode = self.G.MNode( aGraphXml ) + if aMNode != None : + myMNode = MNode( aMNode , self.G.Verbose ) + return myMNode + ErrMsg = "Failed to create a MNode" + if self.G.Verbose : + print ErrMsg + return aMNode + def GraphMNode( self , aGraph ): + aGraphMNode = self.G.GraphMNode( aGraph.G ) + if aGraphMNode != None : + myMNode = MNode( aGraphMNode , self.G.Verbose ) + return myMNode + ErrMsg = "Failed to create a MNode" + if self.G.Verbose : + print ErrMsg + return aGraphMNode + def FlowObjRef( self ) : + aGraph = self.G.FlowObjRef() + if aGraph != None : + myGraph = Graph( aGraph ) + return myGraph + return aGraph + def StreamObjRef( self ) : + aGraph = self.G.StreamObjRef() + if aGraph != None : + myGraph = StreamGraph( aGraph ) + return myGraph + return aGraph def PrintService( self , aComponent , anInterface , aService ): NodeComponent = modulecatalog.GetComponent( aComponent ) aService = NodeComponent.GetService( anInterface , aService ) @@ -957,6 +993,12 @@ class Graph(INode): pynodes.append( GNode( nodes.ESNodes[i] , self.G.Verbose ) ) i = i + 1 j = j + 1 + n = len( nodes.Graphs ) + i = 0 + while i < n : + pynodes.append( MNode( nodes.Graphs[i] , self.G.Verbose ) ) + i = i + 1 + j = j + 1 return pynodes def ListNodes( self , *args ): nodes = self.Nodes() @@ -989,7 +1031,7 @@ class Graph(INode): nodes = self.Nodes() i = 0 while i < len( nodes ) : - print nodes[i].Name(),nodes[i].Thread(),nodes[i].State(),nodes[i].Control(),nodes[i].AutoState() + print nodes[i].Name(),nodes[i].Thread(),nodes[i].State(),nodes[i].Control(),nodes[i] i = i + 1 def GLinks( self ): links = self.G.GLinks() @@ -1051,8 +1093,8 @@ class Graph(INode): while i < len( links ) : links[ i ].Print() i = i + 1 - def Graphs( self ): - graphs = self.G.Graphs() + def SubGraphsNodes( self , ): + graphs = self.G.SubGraphsNodes() outgraphs = graphs i = 0 while i < len( graphs ) : @@ -1097,6 +1139,15 @@ class GraphE(Graph): return StreamGraphE( aGraph ) return None +########################################################## +class MNode(Graph): +########################################################## + def __init__( self , aMNode , Verbose ): + self.G = aMNode + self.G.Verbose = Verbose + self.N = aMNode + self.N.Verbose = Verbose + ########################################################## class StreamGraph(Graph): ########################################################## diff --git a/src/Supervision/Value_Impl.cxx b/src/Supervision/Value_Impl.cxx index 95a89a1..28ea393 100644 --- a/src/Supervision/Value_Impl.cxx +++ b/src/Supervision/Value_Impl.cxx @@ -63,9 +63,17 @@ Value_Impl::Value_Impl( CORBA::ORB_ptr orb , if ( ParameterName != NULL ) { _ParameterName = new char[ strlen( ParameterName ) + 1 ] ; strcpy( _ParameterName , ParameterName ) ; + if ( DataFlowNode ) { + _NodeName = new char[ strlen( DataFlowNode->Name() ) + 1 ] ; + strcpy( _NodeName , DataFlowNode->Name() ) ; + } + else { + _NodeName = NULL ; + } } else { _ParameterName = NULL ; + _NodeName = NULL ; } _InputValue = false ; _Any = new CORBA::Any( *anAny ) ; @@ -96,9 +104,17 @@ Value_Impl::Value_Impl( CORBA::ORB_ptr orb , if ( ParameterName != NULL ) { _ParameterName = new char[ strlen( ParameterName ) + 1 ] ; strcpy( _ParameterName , ParameterName ) ; + if ( DataFlowNode ) { + _NodeName = new char[ strlen( DataFlowNode->Name() ) + 1 ] ; + strcpy( _NodeName , DataFlowNode->Name() ) ; + } + else { + _NodeName = NULL ; + } } else { _ParameterName = NULL ; + _NodeName = NULL ; } _InputValue = false ; _Any = new CORBA::Any() ; diff --git a/src/Supervision/Value_Impl.hxx b/src/Supervision/Value_Impl.hxx index da02747..0e55ee5 100644 --- a/src/Supervision/Value_Impl.hxx +++ b/src/Supervision/Value_Impl.hxx @@ -50,6 +50,7 @@ class Value_Impl : public POA_SUPERV::Value , GraphEditor::DataFlow * _DataFlowEditor ; GraphEditor::InNode * _DataFlowNode ; + char * _NodeName ; char * _ParameterName ; bool _InputPort ; bool _InputValue ; diff --git a/src/SyrComponent/SyrComponent_Impl.cxx b/src/SyrComponent/SyrComponent_Impl.cxx deleted file mode 100755 index 3c93ed7..0000000 --- a/src/SyrComponent/SyrComponent_Impl.cxx +++ /dev/null @@ -1,398 +0,0 @@ -// SuperVisionTest SyrComponent : example of component performing some mathinatical operations -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SyrComponent_Impl.cxx -// Author : Jean Rahuel, CEA -// Module : SuperVisionTest - -using namespace std; -#include -#include -#include -#include -#include - -//#include "utilities.h" - -#include "SyrComponent_Impl.hxx" -#include "Adder_Impl.hxx" - -SyrComponent_Impl::SyrComponent_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char *instanceName , - const char *interfaceName , - const bool kactivate ) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { - MESSAGE("SyrComponent_Impl::SyrComponent_Impl this " << hex << this << dec - << "activate object instanceName(" - << instanceName << ") interfaceName(" << interfaceName << ")" ) - if ( kactivate ) { - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - } -} - -SyrComponent_Impl::SyrComponent_Impl() { -} - -SyrComponent_Impl::~SyrComponent_Impl() { -} - -long SyrComponent_Impl::C_ISEVEN( const long anInteger ) { - bool RetVal ; - beginService( " SyrComponent_Impl::C_ISEVEN" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISEVEN is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - RetVal = ( anInteger & 1 ) == 0 ; - endService( " SyrComponent_Impl::C_ISEVEN" ); - return RetVal ; -} - -long SyrComponent_Impl::C_ISONE( const long anOddInteger ) { - bool RetVal ; - beginService( " SyrComponent_Impl::C_ISONE" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISONE is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - RetVal = ( anOddInteger == 1 ) ; - endService( " SyrComponent_Impl::C_ISONE" ); - return RetVal ; -} - -long SyrComponent_Impl::C_M3( const long anOddInteger ) { - beginService( " SyrComponent_Impl::C_M3" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3 is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " SyrComponent_Impl::C_M3" ); - if ( C_ISEVEN( anOddInteger ) ) - return 0 ; - return ( 3*anOddInteger ) ; -} - -long SyrComponent_Impl::C_M3P1( const long anOddInteger ) { - beginService( " SyrComponent_Impl::C_M3P1" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3P1 is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " SyrComponent_Impl::C_M3P1" ); - if ( C_ISEVEN( anOddInteger ) ) - return 0 ; - return ( 3*anOddInteger + 1 ) ; -} - -long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) { - beginService( " SyrComponent_Impl::C_DIV2" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_DIV2 is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " SyrComponent_Impl::C_DIV2" ); - if ( !C_ISEVEN( anEvenInteger ) ) - return 0 ; - return ( anEvenInteger >> 1 ) ; -} - -long SyrComponent_Impl::C_INCR( const long aCount ) { - beginService( " SyrComponent_Impl::C_INCR" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_INCR is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " SyrComponent_Impl::C_INCR" ); - return ( aCount + 1 ) ; -} - -long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) { - beginService( " SyrComponent_Impl::C_MIN" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MIN is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - int min = aMinVal ; - if ( anInteger < min || aMinVal == 0 ) { - min = anInteger ; - } - string trace = "SyrComponent_Impl::C_MIN : " ; - char cmin[ 30 ] ; - sprintf( cmin , "%d" , min ) ; - trace += cmin ; - sendMessage(NOTIF_TRACE, trace.c_str() ); - endService( " SyrComponent_Impl::C_MIN" ); - return min ; -} - -long SyrComponent_Impl::C_MAX( const long aMaxVal , const long anInteger ) { - beginService( " SyrComponent_Impl::C_MAX" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MAX is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - int max = aMaxVal ; - if ( anInteger > max ) { - max = anInteger ; - } - string trace = "SyrComponent_Impl::C_MAX : " ; - char cmax[ 30 ] ; - sprintf( cmax , "%d" , max ) ; - trace += cmax ; - sendMessage(NOTIF_TRACE, trace.c_str() ); - endService( " SyrComponent_Impl::C_MAX" ); - return max ; -} - -SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_LISTOFSYR() { - beginService( " SyrComponent_Impl::C_LISTOFSYR" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_LISTOFSYR is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId, - instanceName() , interfaceName() , - graphName() , nodeName() ) ; - SuperVisionTest::ListOfSyr_var iobject = (SuperVisionTest::ListOfSyr_var ) NULL ; - PortableServer::ObjectId * id = aNewListOfSyr->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - iobject = SuperVisionTest::ListOfSyr::_narrow(obj) ; - endService( " SyrComponent_Impl::C_LISTOFSYR" ); - return SuperVisionTest::ListOfSyr::_duplicate( iobject ) ; -// return ( aNewListOfSyr._retn() ) ; -} - -SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE( - const SuperVisionTest::ListOfSyr_ptr aListOfSyr , - const long anInteger , - const long aCount , - double & anAverage ) { - beginService( " SyrComponent_Impl::C_AVERAGE" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_AVERAGE is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ; - int len = aSeqOfSyr->length() ; - aSeqOfSyr->length( len + 1 ) ; - (*aSeqOfSyr)[ len ] = anInteger ; - aListOfSyr->SetSeqOfSyr( *aSeqOfSyr ) ; - anAverage = 0 ; - int i ; - for ( i = 0 ; i < len + 1 ; i++ ) { - anAverage += (*aSeqOfSyr)[ i ] ; - } - anAverage = anAverage / ( len + 1 ) ; - string end = " SyrComponent_Impl::C_AVERAGE " ; - char caverage[ 30 ] ; - sprintf( caverage , "%fd" , anAverage ) ; - end += caverage ; - endService( end.c_str() ); - return SuperVisionTest::ListOfSyr::_duplicate( aListOfSyr ) ; -} - -SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( const long anOddInteger ) { - beginService( "SyrComponent_Impl::Init" ); - sendMessage(NOTIF_STEP, "SyrComponent_Impl creates Syr_Impl"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - Syr_Impl * mySyr ; - mySyr = new Syr_Impl( _orb , _poa, _contId, - instanceName() , interfaceName() , - graphName() , nodeName() , anOddInteger ) ; - SuperVisionTest::Syr_var iobject = (SuperVisionTest::Syr_var ) NULL ; - PortableServer::ObjectId * id = mySyr->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - iobject = SuperVisionTest::Syr::_narrow(obj) ; - endService( "SyrComponent_Impl::Init" ); - return SuperVisionTest::Syr::_duplicate(iobject) ; -} - -ListOfSyr_Impl::ListOfSyr_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char * instanceName , - const char * interfaceName , - const char * graphName , - const char * nodeName ) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { - Names( graphName , nodeName ) ; - MESSAGE("ListOfSyr_Impl::ListOfSyr_Impl activate object instanceName(" - << instanceName << ") interfaceName(" << interfaceName << ") --> " - << hex << (void *) this << dec ) - beginService( "ListOfSyr_Impl::ListOfSyr_Impl" ); - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - sendMessage(NOTIF_STEP, "ListOfSyr_Impl is Created"); - endService( "ListOfSyr_Impl::ListOfSyr_Impl" ); -} - -ListOfSyr_Impl::ListOfSyr_Impl() { -} - -ListOfSyr_Impl::~ListOfSyr_Impl() { - beginService( "ListOfSyr_Impl::~ListOfSyr_Impl" ); - endService( "ListOfSyr_Impl::~ListOfSyr_Impl" ); -} - -SuperVisionTest::SeqOfSyr * ListOfSyr_Impl::GetSeqOfSyr() { - SuperVisionTest::SeqOfSyr_var aSeqOfSyr = new SuperVisionTest::SeqOfSyr( _SeqOfSyr ) ; - return ( aSeqOfSyr._retn() ) ; -} - -void ListOfSyr_Impl::SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & aSeqOfSyr ) { - _SeqOfSyr = aSeqOfSyr ; - return ; -} - -extern "C" -{ - PortableServer::ObjectId * SyrComponentEngine_factory - (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) - { - MESSAGE("SyrComponentEngine_factory SyrComponentEngine (" - << instanceName << "," << interfaceName << "," << getpid() << ")"); - SyrComponent_Impl * mySyrComponent - = new SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName); - return mySyrComponent->getId() ; - } -} - -Syr_Impl::Syr_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char * instanceName , - const char * interfaceName , - const char * graphName , - const char * nodeName , - const long anOddInteger ) : - SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false) { - Names( graphName , nodeName ) ; - MESSAGE("Syr_Impl::Syr_Impl activate object instanceName(" - << instanceName << ") interfaceName(" << interfaceName << ") --> " - << hex << (void *) this << dec ) - beginService( "Syr_Impl::Syr_Impl" ); - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - _InitialInteger = anOddInteger ; - _CurrentInteger = anOddInteger ; - _Count = 0 ; - sendMessage(NOTIF_STEP, "Syr_Impl is Created"); - endService( "Syr_Impl::Syr_Impl" ); -} - -Syr_Impl::Syr_Impl() { -} - -Syr_Impl::~Syr_Impl() { - beginService( "Syr_Impl::~Syr_Impl" ); - endService( "Syr_Impl::~Syr_Impl" ); -} - -long Syr_Impl::Initial() { - beginService( " Syr_Impl::Initial" ); - sendMessage(NOTIF_STEP, "Syr_Impl::Initial is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " Syr_Impl::Initial" ); - return _InitialInteger ; -} - -long Syr_Impl::Current() { - beginService( " Syr_Impl::Current" ); - sendMessage(NOTIF_STEP, "Syr_Impl::Current is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - endService( " Syr_Impl::Current" ); - return _CurrentInteger ; -} - -long Syr_Impl::IsEven() { - bool RetVal ; - beginService( " Syr_Impl::IsEven" ); - sendMessage(NOTIF_STEP, "Syr_Impl::IsEven is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - RetVal = ( _CurrentInteger & 1 ) == 0 ; - MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal ); - endService( " Syr_Impl::IsEven" ); - return RetVal ; -} - -long Syr_Impl::IsOne() { - bool RetVal ; - beginService( " Syr_Impl::IsOne" ); - sendMessage(NOTIF_STEP, "Syr_Impl::IsOne is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - RetVal = ( _CurrentInteger == 1 ) ; - MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal ); - endService( " Syr_Impl::IsOne" ); - return RetVal ; -} - -long Syr_Impl::Count() { - beginService( " Syr_Impl::Count" ); - sendMessage(NOTIF_STEP, "Syr_Impl::Count is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - MESSAGE( " Syr_Impl::Count " << _Count ); - endService( " Syr_Impl::Count" ); - return _Count ; -} - -void Syr_Impl::M3p1() { - beginService( " Syr_Impl::M3p1" ); - sendMessage(NOTIF_STEP, "Syr_Impl::M3p1 is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - if ( IsEven() ) - _CurrentInteger = 0 ; - else - _CurrentInteger = 3*_CurrentInteger + 1 ; - MESSAGE( " Syr_Impl::M3p1 " << _CurrentInteger ); - endService( " Syr_Impl::M3p1" ); -} - -void Syr_Impl::Div2() { - beginService( " Syr_Impl::Div2" ); - sendMessage(NOTIF_STEP, "Syr_Impl::Div2 is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - if ( !IsEven() ) - _CurrentInteger = 0 ; - else - _CurrentInteger = ( _CurrentInteger >> 1 ) ; - MESSAGE( " Syr_Impl::Div2 " << _CurrentInteger ); - endService( " Syr_Impl::Div2" ); -} - -void Syr_Impl::Incr() { - beginService( " Syr_Impl::Incr" ); - sendMessage(NOTIF_STEP, "Syr_Impl::Incr is Computing"); - int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); - _Count = _Count + 1 ; - MESSAGE( " Syr_Impl::Incr " << _Count ); - endService( " Syr_Impl::Incr" ); -} - - -