Salome HOME
*** empty log message ***
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_FiniteStateMachine.hxx
index aba11aea8523a2c6cba888eccdbc9ad437a32a76..2ce5d9d923fd9ab13bcc74af7f84575b61bc82f6 100644 (file)
@@ -1,10 +1,30 @@
-//=============================================================================
-// File      : DataFlowBase_FiniteStateMachine.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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   : DataFlowBase_FiniteStateMachine.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
 #ifndef _DATAFLOWEXECUTOR_FINITESTATEMACHINE
 #define _DATAFLOWEXECUTOR_FINITESTATEMACHINE
 #include <unistd.h>
 #include <stdio.h>
 
+#include <Python.h>
+
+#include <string>
+#include <map>
+
 #include "DataFlowBase_Base.hxx"
 
 #include <SALOMEconfig.h>
@@ -90,6 +115,12 @@ namespace GraphExecutor {
       GraphExecutor::StateEventAction _ActionTable[ SUPERV::NumberOfAutomatonStates ]
                                                   [ GraphExecutor::NumberOfEvents ] ;
 
+      pthread_mutex_t            _MutexPythonWait ;
+      map< string , PyObject * > _MapOfPyFunctions ;
+      bool                       _PyInitModule ;
+      int                        _ExecNumber ;
+      int                        _GraphExecutingNumber ;
+
       bool              _JoinThread ;
       pthread_t         _JoinThreadNo ;
       pthread_mutex_t   _MutexJoinWait ;
@@ -101,33 +132,34 @@ namespace GraphExecutor {
       FiniteStateMachine() ;
       virtual ~FiniteStateMachine() {} ;
 
+      int ExecNumber() ;
+      void Executed() ;
+      bool PyInitModule() ;
+      void PyLock() ;
+      void PyUnLock() ;
+      bool PyFunction( const char * aPyFuncName , PyObject * aPyFunction ) ;
+      PyObject * PyFunction( const char * aPyFuncName ) ;
+
       void JoinThread() ;
       void JoinThread( pthread_t aThread ) ;
 
-      const char * ControlStateName(
-            const SUPERV::ControlState & aState ) const {
+      const char * ControlStateName( const SUPERV::ControlState & aState ) const {
             return _ControlStateName[ aState ] ; } ;
-      const char * StateName(
-            const SUPERV::AutomatonState & aState ) const {
+      const char * StateName( const SUPERV::AutomatonState & aState ) const {
             return _StateName[ aState ] ; } ;
-      const char * StateName(
-            const SUPERV::GraphState & aState ) const {
+      const char * StateName( const SUPERV::GraphState & aState ) const {
             return _GraphStateName[ aState ] ; } ;
-      const char * EventName(
-            const GraphExecutor::NodeEvent & anEvent ) const {
+      const char * EventName( const GraphExecutor::NodeEvent & anEvent ) const {
             return _EventName[ anEvent ] ; } ;
-      const char * ActionName(
-            const GraphExecutor::StateEventAction & anAction ) const {
+      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 SUPERV::AutomatonState NextState( const SUPERV::AutomatonState & aState ,
+                                               const GraphExecutor::NodeEvent & anEvent ) const {
             return _TransitionTable[ aState ][ anEvent ] ; } ;
 
-      const GraphExecutor::StateEventAction NextAction(
-            const SUPERV::AutomatonState & aState ,
-            const GraphExecutor::NodeEvent & anEvent ) const {
+      const GraphExecutor::StateEventAction NextAction( const SUPERV::AutomatonState & aState ,
+                                                        const GraphExecutor::NodeEvent & anEvent ) const {
             return _ActionTable[ aState ][ anEvent ] ; } ;
   };