Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphBase / DataFlowBase_Base.hxx
index dafa25ac0c2b6445345ecad3609ee56785d90ee8..60cb36e660b913c567362d2f68eeb4de33bd6941 100644 (file)
@@ -1,17 +1,37 @@
-//=============================================================================
-// File      : DataFlowBase_Base.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
+//
+//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : DataFlowBase_Base.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
 
 #ifndef _DATAFLOW_BASE_HXX
 #define _DATAFLOW_BASE_HXX
 
+//#include <strstream>
 #include <iostream>
 #include <fstream>
-#include <strstream>
+#include <sstream>
 #include <iomanip>
 #include <string>
 #include <map>
 #include "utilities.h"
 #include "OpUtil.hxx"
 
-#include "SALOME_NamingService.hxx"
+#define ExitWhenNodeAborted 1
 
 extern char *SuperVision_Version ;
 
 extern char *NULLSTRING ;
 
 extern char *FACTORYSERVER ;
+extern char *FACTORYSERVERPY ;
 
 inline char * my_strdup( const char * s ) {
   if (s == NULL) return NULL;
@@ -45,8 +66,35 @@ inline char * my_strdup( const char * s ) {
   return t;
 }
 
-enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected ,
-                    DataConnected } ;
+inline char * my_strblkdup( const char * s ) {
+  if (s == NULL) return NULL ;
+
+  size_t l = strlen(s) + 1 ;
+  int i ;
+  for ( i = l - 2 ; i >= 0 ; i-- ) {
+    if ( s[i] != ' ' ) {
+      break ;
+    }
+    l = l - 1 ;
+  }
+  char * t = new char[l] ;
+  strncpy(t, s , l-1) ;
+  t[l-1] = '\0' ;
+  return t;
+}
+
+//string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ;
+int StringToDataStreamType( const char * aIdlType ) ;
+
+string KindOfDataStreamTraceToString( SUPERV::KindOfDataStreamTrace aDataStreamTrace ) ;
+
+string DataStreamDependencyToString( const SALOME_ModuleCatalog::DataStreamDependency aDataStreamDependency ) ;
+
+string DataStreamToString( const char* aDataStreamType ) ;
+
+//enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected ,
+enum StatusOfPort { NotConnected , PortConnected ,
+                    DataConnected , ExternConnected } ;
 
 namespace GraphBase {
 
@@ -63,21 +111,36 @@ namespace GraphBase {
 
   typedef vector<const SUPERV::ListOfStrings *> ListOfPythonFunctions ;
 
-  struct NodeParameter {
-    SALOME_ModuleCatalog::ServicesParameter theInParameter ;
-    SALOME_ModuleCatalog::ServicesParameter theOutParameter ;
-  };
+  typedef vector<SALOME_ModuleCatalog::ServicesParameter> ListOfParameters;
+
+  struct InDataStreamParameter {
+     SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ;
+     SUPERV::KindOfSchema                              theKindOfSchema ;
+     SUPERV::KindOfInterpolation                       theKindOfInterpolation ;
+     SUPERV::KindOfExtrapolation                       theKindOfExtrapolation ;
+   };
+  typedef vector<InDataStreamParameter> ListOfInDataStreamParameters;
 
-  typedef vector<NodeParameter> ListOfParameters;
+  struct OutDataStreamParameter {
+     SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ;
+     long                                              theNumberOfValues ;
+   };
+  typedef vector<OutDataStreamParameter> ListOfOutDataStreamParameters;
 
   struct SNode {
     string                        theComponentName ;
     string                        theInterfaceName ;
     string                        theName ;
     SUPERV::KindOfNode            theKind ;
+    long                          theTimeout ;
+    SUPERV::KindOfDataStreamTrace theDataStreamTrace ;
+    double                        theDeltaTime ;
     string                        theCoupledNode ;
+//    int                           theDataStreamInArgsNumber ;
+//    int                           theDataStreamOutArgsNumber ;
     SALOME_ModuleCatalog::Service theService ;
-    ListOfParameters              theListOfParameters ;
+    ListOfInDataStreamParameters  theListOfInDataStreams ;
+    ListOfOutDataStreamParameters theListOfOutDataStreams ;
     ListOfFuncName                theListOfFuncName ;
     ListOfPythonFunctions         theListOfPythonFunctions ;
     SUPERV::SDate                 theFirstCreation ;
@@ -89,7 +152,7 @@ namespace GraphBase {
     SCoord                        theCoords ;
   };
 
-  typedef vector<SNode> ListOfNodes;
+  typedef vector<SNode> ListOfSNodes;
 
   struct ServicesData {
     SALOME_ModuleCatalog::ServicesParameter aDataParameter ;
@@ -107,16 +170,16 @@ namespace GraphBase {
     ListOfCoords aListOfCoords ;
   };
 
-  typedef vector<SLink> ListOfLinks;
+  typedef vector<SLink> ListOfSLinks;
 
   struct SGraph {
     SNode        Info ;
-    ListOfNodes  Nodes ;
-    ListOfLinks  Links ;
-    ListOfLinks  Datas ;
+    ListOfSNodes  Nodes ;
+    ListOfSLinks  Links ;
+    ListOfSLinks  Datas ;
   };
 
-  typedef vector<SGraph> ListOfGraphs;
+  typedef vector<SGraph> ListOfSGraphs;
 
   class Base {
 
@@ -126,32 +189,28 @@ namespace GraphBase {
 
     public:   
 
-      int *     _prof_debug;
-      ostream * _fdebug;
+      int      * _prof_debug ;
+      ofstream * _fdebug ;
                      
       Base() ;
       virtual ~Base() {} ;
 
       void SetDebug( CORBA::ORB_ptr ORB ,
-                     int * prof_debug , ostream * fdebug ) ;
+                     int * prof_debug , ofstream * fdebug ) ;
 
       char * ObjectToString( CORBA::Object_ptr obj ) const ;
-      CORBA::Object_ptr StringToObject(char * obj ) const ;
+      CORBA::Object_ptr StringToObject(const char * obj ) const ;
+
+      ostream & AnyValue( const CORBA::Any & anAny );
 
   } ;
-# ifdef _DEBUG_
 
-#   define cdebug \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << "      " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
+# ifdef _DEBUG_
 
-#   define cdebug_in \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << endl << "-->" /*<< setw(3*((*GraphBase::Base::_prof_debug)++)) */<< " "
+#   define cdebug if ( GraphBase::Base::_fdebug )  *GraphBase::Base::_fdebug << "      "
+#   define cdebug_in if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "-->" << " "
+#   define cdebug_out if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "<--" << " "
 
-#   define cdebug_out \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << endl << "<--" /*<< setw(3*(--(*GraphBase::Base::_prof_debug)))*/ << " "
 # else
 
 #   define cdebug while (false) std::cerr
@@ -159,8 +218,10 @@ namespace GraphBase {
 #   define cdebug_out cdebug
 #   define debugFile(x) 
 
-# endif
+#endif
 
 } ;
 
+//ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamType &);
+
 #endif