]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: move DSC trace function from Calcium directory to DSC_Basic directory
authorcaremoli <caremoli>
Thu, 1 Oct 2009 16:23:10 +0000 (16:23 +0000)
committercaremoli <caremoli>
Thu, 1 Oct 2009 16:23:10 +0000 (16:23 +0000)
for more general use

src/DSC/DSC_Basic/DSC_interface.cxx
src/DSC/DSC_Basic/DSC_interface.hxx
src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx
src/DSC/DSC_User/Datastream/GenericPort.hxx

index fcfd8edf408d6fd4229b68522aaa595d788c0ed7..8cef59b0a0dd98a09b1280262ccf3083d3ea9268 100644 (file)
 //
 #include <string>
 #include "DSC_interface.hxx"
+#include <sys/time.h>
+#include <fstream>
+#include <sys/stat.h>
+#include <sstream>
+#include <stdlib.h>
 
 //#define MYDEBUG
 
@@ -385,3 +390,179 @@ Engines_DSC_interface::get_port_properties(const char* port_name)
   rtn_properties = Ports::PortProperties::_duplicate(my_ports[port_name]->port_prop);
   return rtn_properties;
 }
+
+//Trace functions for DSC operations: a local function (initTrace) and a class method (Engines_DSC_interface::writeEvent)
+static  int traceType=-1; // 0=stderr;1=file;
+static  int traceLevel=-1; // 0=no trace;1=normal trace;2=detailed trace
+static  std::ofstream traceFile;
+static  std::ostream *out;
+
+//! Initialize the trace file
+/*!
+ * The trace file depends on an environment variable (DSC_TRACE). If this variable
+ * is equal to 1, the trace file is a file with the name : <TMPDIR>/<container name>.tce.
+ * In all other cases, the trace file is stderr
+ * The environment variable DSC_TRACELEVEL can be used to suppress the trace (value 0)
+ *
+ * \param containerName the name of the container where the trace is built
+ */
+static void initTrace(const std::string& containerName)
+{
+  // if initialization has already been done do nothing
+  if(traceLevel >= 0)return;
+
+  std::string typeenv="0";
+  std::string levelenv="1";
+  char* valenv=0;
+  valenv=getenv("DSC_TRACE");
+  if(valenv)typeenv=valenv;
+  valenv=getenv("DSC_TRACELEVEL");
+  if(valenv)levelenv=valenv;
+
+  if(levelenv=="0")
+    traceLevel=0; // no trace
+  else if(levelenv=="2")
+    traceLevel=2; //detailed trace
+  else
+    traceLevel=1; // normal trace (default)
+
+  if(traceLevel==0)
+    return;
+
+  if(typeenv=="1")
+    {
+      //trace in file
+      traceType=1;
+#ifdef WNT
+      std::string logFilename=getenv("TEMP");
+      logFilename += "\\";
+#else
+      std::string logFilename="/tmp";
+      char* val = getenv("SALOME_TMP_DIR");
+      if(val)
+        {
+          struct stat file_info;
+          stat(val, &file_info);
+          bool is_dir = S_ISDIR(file_info.st_mode);
+          if (is_dir)logFilename=val;
+        }
+      logFilename += "/";
+#endif
+
+      logFilename=logFilename+containerName+".tce";
+      traceFile.open(logFilename.c_str(), std::ios::out | std::ios::app);
+      out=&traceFile;
+    }
+  else
+    {
+      //trace to stderr (default)
+      traceType=0;
+      out=&std::cerr;
+    }
+  //trace heading
+  out->width(17);
+  *out << "Elapsed time" ;
+  *out << " | " ;
+  out->width(16);
+  *out << "Request" ;
+  *out << " | " ;
+  out->width(16);
+  *out << "Container" ;
+  *out << " | " ;
+  out->width(16);
+  *out << "Instance" ;
+  *out << " | " ;
+  out->width(16);
+  *out << "Port" ;
+  *out << " | " ;
+  out->width(24);
+  *out << "Error";
+  *out << " | " ;
+  *out << "Infos" ;
+  *out << std::endl;
+}
+
+
+//! Write a record in the trace file
+/*!
+ * \param request the name of the request executed
+ * \param containerName the name of the container where the request is executed
+ * \param instance_name the name of the component where the request is executed
+ * \param port_name the name of the port that is concerned
+ * \param error if an error has occured, a string that identifies the error
+ * \param message informations about error or about the request
+ */
+void Engines_DSC_interface::writeEvent(const char* request,const std::string& containerName, const char* instance_name, 
+                                       const char* port_name, const char* error, const char* message)
+{
+  if(traceLevel < 0)
+    initTrace(containerName);
+  if(traceLevel == 0)return;
+
+  struct timeval tv;
+  gettimeofday(&tv,0);
+  long tt0=tv.tv_sec/3600; //hours
+
+  if(traceType == 2)
+    {
+      //notifier (not used: salome notifier is now obsolete)
+      std::ostringstream msg;
+      msg.width(7);
+      msg << tt0 ;
+      msg << ":" ;
+      long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
+      msg.width(2);
+      msg << tt1 ;
+      msg << ":" ;
+      long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
+      msg.width(2);
+      msg << tt2 ;
+      msg << ":" ;
+      long tt3=tv.tv_usec/1000; //milliseconds
+      msg.width(3);
+      msg << tt3 ;
+      msg << " | " ;
+      msg.width(24);
+      msg << error;
+      msg << " | " ;
+      msg << message ;
+      //send event to notifier (containerName.c_str(),instance_name, request, msg.str().c_str())
+    }
+  else
+    {
+      //cerr or file
+      out->width(7);
+      *out << tt0 ;
+      *out << ":" ;
+      long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
+      out->width(2);
+      *out << tt1 ;
+      *out << ":" ;
+      long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
+      out->width(2);
+      *out << tt2 ;
+      *out << ":" ;
+      long tt3=tv.tv_usec/1000; //milliseconds
+      out->width(3);
+      *out << tt3 ;
+      *out << " | " ;
+      out->width(16);
+      *out << request ;
+      *out << " | " ;
+      out->width(16);
+      *out << containerName ;
+      *out << " | " ;
+      out->width(16);
+      *out << instance_name ;
+      *out << " | " ;
+      out->width(16);
+      *out << port_name ;
+      *out << " | " ;
+      out->width(24);
+      *out << error;
+      *out << " | " ;
+      *out << message ;
+      *out << std::endl;
+    }
+}
+
index af7d7f5b2f993855a6350df43d34141b676bda7b..ad0eb353946ef59f4dedfaaa642bd1d927843dab 100644 (file)
@@ -148,6 +148,9 @@ public:
   virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
     throw (Engines::DSC::PortNotDefined);
 
+  static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
+                         const char* port_name, const char* error, const char* message);
+
 protected:
 
   /*-------------------------------------------------*/
index f98b1edb6484ff996a5452a25fa776c9bc40133c..2b6429f8a33441cd7bc2b969d7721d900425d2a0 100644 (file)
@@ -90,7 +90,7 @@ extern "C"
     msg << type << " " << mode << " " << depend;
     CORBA::String_var componentName=compo->instanceName();
     std::string containerName=compo->getContainerName();
-    CalciumInterface::writeEvent("create_calcium_port",containerName,componentName,name,0,msg.str().c_str());
+    Engines_DSC_interface::writeEvent("create_calcium_port",containerName,componentName,name,"",msg.str().c_str());
 
     if(std::string(mode) == "IN")
       {
index 5a25252526e32ae7f80f1ac7d1424cd6b8db3bf9..8b05780c48682ba56c557b5902d5ec5a0c0ecd15 100644 (file)
 #include "CalciumCxxInterface.hxx"
 #define PRG_MAIN
 #include "calciumP.h"
-#include <sys/time.h>
-#include <fstream>
-#include <sys/stat.h>
 
 using namespace std; 
 
 namespace CalciumInterface 
 {
-  
-  int traceType=-1; // 0=stderr;1=file;
-  int traceLevel=-1; // 0=no trace;1=normal trace;2=detailed trace
-  std::ofstream traceFile;
-  std::ostream *out;
-
-  void initTrace(const std::string& containerName)
-    {
-      // if initialization has already been done do nothing
-      if(traceLevel >= 0)return;
-
-      std::string typeenv="0";
-      std::string levelenv="1";
-      char* valenv=0;
-      valenv=getenv("DSC_TRACE");
-      if(valenv)typeenv=valenv;
-      valenv=getenv("DSC_TRACELEVEL");
-      if(valenv)levelenv=valenv;
-
-      if(levelenv=="0")
-        traceLevel=0; // no trace 
-      else if(levelenv=="2")
-        traceLevel=2; //detailed trace
-      else 
-        traceLevel=1; // normal trace (default)
-
-      if(traceLevel==0)
-       return;
-
-      if(typeenv=="1")
-        {
-          //trace in file
-          traceType=1;
-#ifdef WNT
-          std::string logFilename=getenv("TEMP");
-          logFilename += "\\";
-#else
-          std::string logFilename="/tmp";
-          char* val = getenv("SALOME_TMP_DIR");
-          if(val)
-            {
-              struct stat file_info;
-              stat(val, &file_info);
-              bool is_dir = S_ISDIR(file_info.st_mode);
-              if (is_dir)logFilename=val;
-            }
-          logFilename += "/";
-#endif
-
-          logFilename=logFilename+containerName+".tce";
-          traceFile.open(logFilename.c_str(), std::ios::out | std::ios::app);
-          out=&traceFile;
-        }
-      else
-        {
-          //trace to stderr (default)
-          traceType=0;
-          out=&std::cerr;
-        }
-      //trace heading
-      out->width(17);
-      *out << "Elapsed time" ;
-      *out << " | " ;
-      out->width(16);
-      *out << "Request" ;
-      *out << " | " ;
-      out->width(16);
-      *out << "Container" ;
-      *out << " | " ;
-      out->width(16);
-      *out << "Instance" ;
-      *out << " | " ;
-      out->width(16);
-      *out << "Port" ;
-      *out << " | " ;
-      out->width(24);
-      *out << "Error";
-      *out << " | " ;
-      *out << "Infos" ;
-      *out << std::endl;
-    }
-
-  void writeEvent(const char* request,const std::string& containerName, const char* instance_name, const char* port_name, 
-                  int error, const char* message)
-  {
-    if(traceLevel < 0)
-      initTrace(containerName);
-    if(traceLevel == 0)return;
-
-    struct timeval tv;
-    gettimeofday(&tv,0);
-    long tt0=tv.tv_sec/3600; //hours
-
-    if(traceType == 2)
-      {
-        //notifier (not used: salome notifier is now obsolete)
-        std::ostringstream msg;
-        msg.width(7);
-        msg << tt0 ;
-        msg << ":" ;
-        long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
-        msg.width(2);
-        msg << tt1 ;
-        msg << ":" ;
-        long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
-        msg.width(2);
-        msg << tt2 ;
-        msg << ":" ;
-        long tt3=tv.tv_usec/1000; //milliseconds
-        msg.width(3);
-        msg << tt3 ;
-        msg << " | " ;
-        msg.width(24);
-        msg << CPMESSAGE[error];
-        msg << " | " ;
-        msg << message ;
-        //send event to notifier (containerName.c_str(),instance_name, request, msg.str().c_str())
-      }
-    else
-      {
-        //cerr or file
-        out->width(7);
-        *out << tt0 ;
-        *out << ":" ;
-        long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
-        out->width(2);
-        *out << tt1 ;
-        *out << ":" ;
-        long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
-        out->width(2);
-        *out << tt2 ;
-        *out << ":" ;
-        long tt3=tv.tv_usec/1000; //milliseconds
-        out->width(3);
-        *out << tt3 ;
-        *out << " | " ;
-        out->width(16);
-        *out << request ;
-        *out << " | " ;
-        out->width(16);
-        *out << containerName ;
-        *out << " | " ;
-        out->width(16);
-        *out << instance_name ;
-        *out << " | " ;
-        out->width(16);
-        *out << port_name ;
-        *out << " | " ;
-        out->width(24);
-        *out << CPMESSAGE[error];
-        *out << " | " ;
-        *out << message ;
-        *out << std::endl;
-      }
-  }
 };
 
index 18738f46ad158d4ec9926f62598d83a47a28cb02..e1129154c01ae6f51ad249ed460601bbb1b380e2 100644 (file)
@@ -53,17 +53,14 @@ struct IsSameType<T1,T1> {
   static const bool value = true;
 };
 
+extern const char * CPMESSAGE[];
+
 //#define MYDEBUG
 
 #include <boost/type_traits/remove_all_extents.hpp>
 
 namespace CalciumInterface {
   
-  /********************* LOGGING INTERFACE *****************/
-
-  void initTrace(const std::string&);
-  void writeEvent(const char*, const std::string&, const char*, const char*, int, const char*);
-
   /********************* CONNECTION INTERFACE *****************/
 
   static inline void
@@ -73,7 +70,7 @@ namespace CalciumInterface {
     CORBA::String_var componentName=component.instanceName();
     std::string containerName=component.getContainerName();
     if (instanceName.empty()) instanceName=componentName;
-    writeEvent("CP_CD",containerName,componentName,"",0,"");
+    Engines_DSC_interface::writeEvent("CP_CD",containerName,componentName,"","","");
   }
 
   static void
@@ -81,7 +78,7 @@ namespace CalciumInterface {
   { 
     CORBA::String_var componentName=component.instanceName();
     std::string containerName=component.getContainerName();
-    writeEvent("CP_FIN",containerName,componentName,"",0,"");
+    Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"","","");
 
     std::vector<std::string> usesPortNames;
     std::vector<std::string>::const_iterator it;
@@ -117,12 +114,12 @@ namespace CalciumInterface {
           }
         catch ( const Superv_Component_i::BadCast & ex) 
           {
-            writeEvent("CP_FIN",containerName,componentName,"",CalciumTypes::CPTPVR,ex.what());
+            Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
             throw (CalciumException(CalciumTypes::CPTPVR,ex));
           }
         catch ( const DSC_Exception & ex) 
           {
-            writeEvent("CP_FIN",containerName,componentName,"",CalciumTypes::CPOK,ex.what());
+            Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPOK],ex.what());
             // Exception venant de SupervComponent :
             //   PortNotDefined(CPNMVR), PortNotConnected(CPLIEN)  
             // ou du port uses : Dsc_Exception
@@ -130,7 +127,7 @@ namespace CalciumInterface {
           }
         catch (...) 
           {
-            writeEvent("CP_FIN",containerName,componentName,"",CalciumTypes::CPATAL,"Unexpected exception");
+            Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPATAL],"Unexpected exception");
             throw (CalciumException(CalciumTypes::CPATAL,"Unexpected exception"));
             // En fonction du mode de gestion des erreurs throw;
           }
@@ -202,7 +199,7 @@ namespace CalciumInterface {
 
     if (nomVar.empty())
       {
-        writeEvent("BEGIN_READ",containerName,componentName,"",CalciumTypes::CPNMVR,"");
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
         throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
       }
     PortType * port;
@@ -223,18 +220,18 @@ namespace CalciumInterface {
       }
     catch ( const Superv_Component_i::PortNotDefined & ex) 
       {
-        writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPNMVR,ex.what());
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what());
         throw (CalciumException(CalciumTypes::CPNMVR,ex));
       }
     catch ( const Superv_Component_i::PortNotConnected & ex) 
       {
-        writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPLIEN,ex.what());
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what());
         throw (CalciumException(CalciumTypes::CPLIEN,ex)); 
         // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
       }
     catch ( const Superv_Component_i::BadCast & ex) 
       {
-        writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPTPVR,ex.what());
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
         throw (CalciumException(CalciumTypes::CPTPVR,ex));
       }
   
@@ -243,13 +240,13 @@ namespace CalciumInterface {
 
     if ( portDependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
       {
-        writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPIT,"Dependency mode is undefined");
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined");
         throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined."));
       }
 
     if ( ( portDependencyType != _dependencyType ) && ( _dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) ) 
       {
-        writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPIT,
+        Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],
                    "Dependency mode is not the same as the required one");
         throw CalciumException(CalciumTypes::CPITVR, LOC(OSS()<<"Dependency mode of variable " << nomVar << ": " 
                                 << portDependencyType << " is not the same as the required one."));
@@ -263,7 +260,7 @@ namespace CalciumInterface {
           {
             double   tt=ti;
             msg << "ti=" << ti << ", tf=" << tf ;
-            writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),0,msg.str().c_str());
+            Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
             corbaData = port->get(tt,tf, 0);
             msgout << "read t=" << tt ;
 #ifdef MYDEBUG
@@ -272,7 +269,7 @@ namespace CalciumInterface {
           }
         catch ( const DSC_Exception & ex)
           {
-            writeEvent("END_READ",containerName,componentName,nomVar.c_str(),0,ex.what());
+            Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
             throw;
           }
       } 
@@ -281,7 +278,7 @@ namespace CalciumInterface {
         try
           {
             msg << "i=" << i ;
-            writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),0,msg.str().c_str());
+            Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
             corbaData = port->get(0, i);
             msgout << "read i=" << i ;
 #ifdef MYDEBUG
@@ -290,7 +287,7 @@ namespace CalciumInterface {
           }
         catch ( const DSC_Exception & ex)
           {
-            writeEvent("END_READ",containerName,componentName,nomVar.c_str(),0,ex.what());
+            Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
             throw;
           }
       } 
@@ -302,7 +299,7 @@ namespace CalciumInterface {
 #ifdef MYDEBUG
             std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
 #endif
-            writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),0,"Sequential read");
+            Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"","Sequential read");
             corbaData = port->next(ti,i);
             msgout << "read ";
             if(i==0)msgout<< "t=" <<ti;
@@ -310,7 +307,7 @@ namespace CalciumInterface {
           }
         catch ( const DSC_Exception & ex)
           {
-            writeEvent("END_READ",containerName,componentName,nomVar.c_str(),0,ex.what());
+            Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
             throw;
           }
       }
@@ -378,7 +375,7 @@ namespace CalciumInterface {
     std::cout << "Ptr :" << data << std::endl;
     std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
 #endif
-    writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CalciumTypes::CPOK,msgout.str().c_str());
+    Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msgout.str().c_str());
     return;
   }
 
@@ -438,7 +435,7 @@ namespace CalciumInterface {
 #endif
     if ( nomVar.empty() )
       {
-        writeEvent("WRITE",containerName,componentName,"",CalciumTypes::CPNMVR,"");
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
         throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
       }
     UsesPortType * port;
@@ -459,18 +456,18 @@ namespace CalciumInterface {
       }
     catch ( const Superv_Component_i::PortNotDefined & ex) 
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPNMVR,ex.what());
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what());
         throw (CalciumException(CalciumTypes::CPNMVR,ex));
       }
     catch ( const Superv_Component_i::PortNotConnected & ex) 
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPLIEN,ex.what());
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what());
         throw (CalciumException(CalciumTypes::CPLIEN,ex)); 
         // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
       }
     catch ( const Superv_Component_i::BadCast & ex) 
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPTPVR,ex.what());
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
         throw (CalciumException(CalciumTypes::CPTPVR,ex));
       }
  
@@ -489,13 +486,13 @@ namespace CalciumInterface {
 
     if ( _dependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPIT,"Dependency mode is undefined");
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined");
         throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined."));
       }
 
     if ( _dependencyType == CalciumTypes::SEQUENCE_DEPENDENCY )
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPIT,
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],
                    "SEQUENCE_DEPENDENCY mode is not possible when writing");
         throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode SEQUENCE_DEPENDENCY for variable " << nomVar 
                                << " is not possible when writing."));
@@ -514,7 +511,7 @@ namespace CalciumInterface {
   
     if ( bufferLength < 1 )
       {
-        writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPNTNULL,"Buffer to send is empty");
+        Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNTNULL],"Buffer to send is empty");
         throw CalciumException(CalciumTypes::CPNTNULL, LOC(OSS()<<"Buffer to send is empty"));
       }
 
@@ -560,11 +557,11 @@ namespace CalciumInterface {
             port->put(*corbaData,t, -1); 
             std::stringstream msg;
             msg << "t=" << t ;
-            writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPOK,msg.str().c_str());
+            Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str());
           }
         catch ( const DSC_Exception & ex) 
           {
-            writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPATAL,ex.what());
+            Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
             throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
           }
         //Le -1 peut être traité par le cst DataIdContainer et transformé en 0 
@@ -580,11 +577,11 @@ namespace CalciumInterface {
             port->put(*corbaData,-1, i);
             std::stringstream msg;
             msg << "i=" << i ;
-            writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPOK,msg.str().c_str());
+            Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str());
           }
         catch ( const DSC_Exception & ex) 
           {
-            writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CalciumTypes::CPATAL,ex.what());
+            Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
             throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
           }
 #ifdef MYDEBUG
index ba046314e7d8da89a2803309e3a54029b4753064..a760ee0110c4d23d9c891f2311fd2709eec97b6f 100644 (file)
@@ -502,6 +502,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
               // Waiting too long probably blocking
               std::stringstream msg;
               msg<<"Timeout ("<<rs<<" s) exceeded";
+              Engines_DSC_interface::writeEvent("BLOCKING","","","","Probably blocking",msg.str().c_str());
               throw DSC_Exception(msg.str());
             }
         }
@@ -616,6 +617,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
               // Waiting too long probably blocking
               std::stringstream msg;
               msg<<"Timeout ("<<rs<<" s) exceeded";
+              Engines_DSC_interface::writeEvent("BLOCKING","","","","Probably blocking",msg.str().c_str());
               throw DSC_Exception(msg.str());
             }
         }