Salome HOME
CCAR: remove debug prints from the standard trace and put these prints
authorcaremoli <caremoli>
Tue, 8 Sep 2009 17:13:17 +0000 (17:13 +0000)
committercaremoli <caremoli>
Tue, 8 Sep 2009 17:13:17 +0000 (17:13 +0000)
in a developer trace activated with #define MYDEBUG to put manually in sources

19 files changed:
src/DSC/DSC_Basic/DSC_i.cxx
src/DSC/DSC_Basic/DSC_interface.cxx
src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx
src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx
src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx
src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx
src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx
src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx
src/DSC/DSC_User/Datastream/Calcium/Copy2CorbaSpace.hxx
src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx
src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx
src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx
src/DSC/DSC_User/Datastream/GenericPort.hxx
src/DSC/DSC_User/Datastream/GenericUsesPort.hxx
src/DSC/DSC_User/Superv_Component_i.cxx
src/DSC/DSC_User/Superv_Component_i.hxx

index 75f3f05c7b95c7ff2c503fd5fb461ff8ce82b2d8..b4a98493fb4ad4ec8220102a3144d78937c8e433 100644 (file)
@@ -25,6 +25,8 @@
 //
 #include "DSC_i.hxx"
 
+//#define MYDEBUG
+
 Engines_DSC_i::
 Engines_DSC_i(CORBA::ORB_ptr orb,
                        PortableServer::POA_ptr poa,
@@ -37,7 +39,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb,
                                                          instanceName, 
                                                          interfaceName) 
 {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
 #endif
 }
@@ -52,7 +54,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb,
               bool regist) : 
     Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist) 
 {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
 #endif
 }
index eb6db311ced1705bcf4a9acf03d096ed17719c71..fcfd8edf408d6fd4229b68522aaa595d788c0ed7 100644 (file)
@@ -26,6 +26,8 @@
 #include <string>
 #include "DSC_interface.hxx"
 
+//#define MYDEBUG
+
 Engines_DSC_interface::Engines_DSC_interface() {}
 
 Engines_DSC_interface::~Engines_DSC_interface() 
@@ -154,7 +156,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name)
     Engines::DSC::BadPortType BPT;
     BPT.expected = CORBA::string_dup("Expected a uses port");
     BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str());
+#ifdef MYDEBUG
    std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
     throw BPT;
   }
 
@@ -164,7 +168,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name)
   }
   else
     {
+#ifdef MYDEBUG
    std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
     throw Engines::DSC::PortNotConnected();
     }
   
index f53198c76d7ddfc4bc3e2537352c579b7931df30..7f909cc199540248ac4552fb4a9840300cfcacd3 100644 (file)
@@ -34,6 +34,8 @@
 #include "DisplayPair.hxx"
 //
 
+//#define MYDEBUG
+
 // Suppose que le container est trié
 template < typename T > struct AdjacentFunctor {
 
@@ -50,14 +52,14 @@ template < typename T > struct AdjacentFunctor {
 
   // Suppose que les valeurs passées en paramètres sont triées par ordre croissant
   bool operator()(const T &v1) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
     std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
 #endif
     if ( v1 <= _minValue && v1 >= _maxValue)    
     {
       _equal= true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;   
 #endif
       return true; 
@@ -65,14 +67,14 @@ template < typename T > struct AdjacentFunctor {
     if ( v1 < _minValue )    
     {
       _min=v1;_minFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
 #endif
     }
     else if ( v1 > _maxValue )
     {
       _max=v1;_maxFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
 #endif
     }
@@ -101,7 +103,7 @@ template < typename T > struct AdjacentFunctor {
   bool isEqual()   const { return _equal;}
   bool isBounded() const { return _minFound && _maxFound;}
   bool getBounds(TNoConst & min, TNoConst & max) const {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
 #endif
     if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
index eec2ea22fc15bc20b74afd454f06ebf25cc6e59a..ef9dab545c10c8b90d041da4150126dd4a0ff195 100644 (file)
@@ -26,8 +26,6 @@
 #include <string>
 #include <exception>
 
-//#define _DEBUG_
-
 PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb,
                               PortableServer::POA_ptr poa,
                               Engines::Container_ptr contain,
@@ -45,6 +43,9 @@ PySupervCompo::~PySupervCompo()
 
 extern "C" 
 {
+  void cp_exit(int);
+  void setDependency(provides_port*, char*, CalciumTypes::DependencyType);
+
   void cp_exit(int err)
     {
       throw CalciumException(err,LOC("Abort coupling"));
@@ -84,9 +85,7 @@ extern "C"
 
   void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend)
   {
-#ifdef _DEBUG_
-    std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl;
-#endif
+    MESSAGE( "create_calcium_port: " << name << " " << type << " " << mode << " " << depend );
 
     if(std::string(mode) == "IN")
       {
index 8b860d7770a43b935b912779c33441c1236d55fb..8c9dd313c1576338b493c49f2119783417d73eb9 100644 (file)
@@ -4,7 +4,8 @@
 #include <stdio.h>
 
 
-#ifdef _DEBUG_
+//#define MYDEBUG
+#ifdef MYDEBUG
 #define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
 #else
 #define DEBTRACE(msg)
index cd8dc62ec1afc1deb94426ff20259203d002d1e0..16f85bbd4e4eb8bb365abfb8f877fd565abccbb8 100644 (file)
@@ -38,18 +38,14 @@ void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType depe
 CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const              { return _dependencyType;}
  
 void   CalciumCouplingPolicy::setStorageLevel   (size_t         storageLevel)   {
-#ifdef _DEBUG_
-  std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl;
-#endif
+  MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel );
   if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL)  )
     throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé"));
   _storageLevel = storageLevel;
 }
 size_t CalciumCouplingPolicy::getStorageLevel   () const                        {return _storageLevel;}
 void   CalciumCouplingPolicy::setDateCalSchem   (CalciumTypes::DateCalSchem   dateCalSchem)   {
-#ifdef _DEBUG_
-  std::cerr << "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem << std::endl;
-#endif
+  MESSAGE( "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem );
   if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
     throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle"));
   _dateCalSchem = dateCalSchem;
@@ -58,13 +54,11 @@ void   CalciumCouplingPolicy::setDateCalSchem   (CalciumTypes::DateCalSchem   da
 CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const   { return _dateCalSchem; }
 
 void CalciumCouplingPolicy::setAlpha(double alpha) {
-#ifdef _DEBUG_
-  std::cerr << "CalciumCouplingPolicy::setAlpha: " << alpha << std::endl;
-#endif
+  MESSAGE( "CalciumCouplingPolicy::setAlpha: " << alpha );
   if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
     throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle"));
   
-  if ( 0 <= alpha <= 1 ) _alpha = alpha; 
+  if ( 0 <= alpha && alpha <= 1 ) _alpha = alpha; 
   else 
     throw CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre alpha doit être compris entre [0,1]"));
 }
@@ -74,16 +68,14 @@ double CalciumCouplingPolicy::getAlpha() const   { return _alpha; }
 void CalciumCouplingPolicy::setDeltaT(double deltaT ) {
   if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
     throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre deltaT sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
-  if ( 0 <= deltaT <= 1 ) _deltaT = deltaT; 
+  if ( 0 <= deltaT && deltaT <= 1 ) _deltaT = deltaT; 
   else 
     throw(CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre deltaT doit être compris entre [0,1]")));
 }
 double CalciumCouplingPolicy::getDeltaT() const  {return _deltaT;}
 
 void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) {
-#ifdef _DEBUG_
-  std::cerr << "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem << std::endl;
-#endif
+  MESSAGE( "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem );
   if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
     throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
   _interpolationSchem=interpolationSchem;
index 383f7a69857bfd8c26830087e86edf1d612432c7..ab4448cef0ac79f418ec7f38de51262fc5f9ef7c 100644 (file)
@@ -39,6 +39,8 @@
 #include "CalciumTypes.hxx"
 #include "CalciumException.hxx"
 
+//#define MYDEBUG
+
 class CalciumCouplingPolicy : public CouplingPolicy  {
 
 
@@ -196,14 +198,14 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor<
 
     MapIterator it2=it1; ++it2;
     size_t   dataSize1 = DataManipulator::size(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
 #endif
  
     // Gérer dans calcium la limite de la taille du buffer donnée par
     // l'utilisateur.
     size_t   dataSize2 = DataManipulator::size(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
 #endif
 
@@ -212,31 +214,31 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor<
     DataId   dataId1 = it1->first;
     TimeType t2      = dataId2.first;
     TimeType t1      = dataId1.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
 #endif
     TimeType t       = dataId.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
 #endif
     TimeType timeDiff  = t2-t1;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
 #endif
     TimeType coeff   = (t2-t)/timeDiff;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
 #endif
 
     InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
     std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
     std::cout << std::endl;
 #endif
     InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
     std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
     std::cout << std::endl;
@@ -244,7 +246,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor<
     Type              dataOut = DataManipulator::create(dataSize);
     InnerType * const OutIt   = DataManipulator::getPointer(dataOut);
  
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl;
     std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl;
     std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl;
@@ -265,7 +267,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor<
 //       }
 
     }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
     std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
     std::cout << std::endl;
@@ -290,7 +292,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co
   AdjacentFunctor< key_type > af(expectedDataId);
   if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
   {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
     std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
 #endif
@@ -317,8 +319,8 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co
   typename AssocContainer::iterator current = prev;
   while ( (current != storedDatas.end()) && !af(current->first)  ) 
   {
-#ifdef _DEBUG_
-    std::cout << "------- stored time : " << current->first << std::endl;
+#ifdef MYDEBUG
+    std::cerr << "------- stored time : " << current->first << std::endl;
 #endif
     //  if ( af(current->first) ) break;
     prev = current++;
@@ -336,7 +338,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co
     else
       wDataIt1 = storedDatas.end();
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
 #endif
 
@@ -366,7 +368,7 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor {
     typedef typename Container::value_type value_type;
     typedef typename Container::iterator iterator;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
 #endif
  
@@ -388,7 +390,7 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor {
                                            " vient d'entraîner la suppression de la donnée à renvoyer")));
       }
     }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
 #endif
     return;
@@ -422,12 +424,12 @@ struct CalciumCouplingPolicy::DisconnectProcessor {
     typedef typename Container::iterator   iterator;
 
     // Pas de traitement particulier a effectuer
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
 #endif
     if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false;
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
 #endif
 
@@ -435,7 +437,7 @@ struct CalciumCouplingPolicy::DisconnectProcessor {
     if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET )
       throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "La directive CP_ARRET" 
                                           << " provoque l'interruption de toute lecture de données")));
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
 #endif
 
@@ -450,13 +452,13 @@ struct CalciumCouplingPolicy::DisconnectProcessor {
     // qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel
     // cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais
     // fournir de données pour ce dataId.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4  " << expectedDataId <<" --------" << std::endl;
 #endif
 
     // >= expectedDataId
     iterator it1 = storedDatas.lower_bound(expectedDataId);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5  " << std::endl;
     for (iterator it=storedDatas.begin();it!=storedDatas.end();++it)
       std::cout <<" "<<(*it).first ;
@@ -468,13 +470,13 @@ struct CalciumCouplingPolicy::DisconnectProcessor {
       throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT" 
                                          << " est active mais le dataId demandé est inférieur ou égal au dernier reçu.")));
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
 #endif
 
     wDataIt1 = storedDatas.end();
     --wDataIt1;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
 #endif
 
index db1fa90159b5b8918484159a48faff7f0756f21a..3d3ba931acf87a1a38ad15809760523426b6af12 100644 (file)
@@ -53,6 +53,7 @@ struct IsSameType<T1,T1> {
   static const bool value = true;
 };
 
+//#define MYDEBUG
 
 #include <boost/type_traits/remove_all_extents.hpp>
 
@@ -91,7 +92,7 @@ namespace CalciumInterface {
 //     calcium_uses_port* myCalciumUsesPort=
 //       dynamic_cast<calcium_uses_port*>(myUsesPort);
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<< 
          //      typeid(myUsesPort).name() <<"-------------" <<
          typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
@@ -104,14 +105,10 @@ namespace CalciumInterface {
        myCalciumUsesPort->disconnect(provideLastGivenValue);
 
       } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
-       std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
        throw (CalciumException(CalciumTypes::CPTPVR,ex));
       } catch ( const DSC_Exception & ex) {
-#ifdef _DEBUG_
-       std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
        // Exception venant de SupervComponent :
        //   PortNotDefined(CPNMVR), PortNotConnected(CPLIEN)  
        // ou du port uses : Dsc_Exception
@@ -180,7 +177,7 @@ namespace CalciumInterface {
     
     CorbaDataType     corbaData;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
 #endif
 
@@ -188,7 +185,7 @@ namespace CalciumInterface {
       throw CalciumException(CalciumTypes::CPNMVR,
                                LOC("Le nom de la variable est <nul>"));
     PortType * port;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
     T1 t1;
     T2 t2;
@@ -198,24 +195,18 @@ namespace CalciumInterface {
 
     try {
       port  = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
 #endif
     } catch ( const Superv_Component_i::PortNotDefined & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPNMVR,ex));
     } catch ( const Superv_Component_i::PortNotConnected & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPLIEN,ex)); 
       // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
     } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPTPVR,ex));
     }
   
@@ -237,28 +228,28 @@ namespace CalciumInterface {
   
     if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
       corbaData = port->get(ti,tf, 0);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
 #endif
     } 
     else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
       corbaData = port->get(0, i);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
 #endif
     } else {
       // Lecture en séquence
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
 #endif
       corbaData = port->next(ti,i);
     }
  
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
 #endif
     size_t corbaDataSize = DataManipulator::size(corbaData);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
 #endif
    
@@ -270,7 +261,7 @@ namespace CalciumInterface {
       nRead = corbaDataSize;
       // Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie
       if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
 #endif
       // On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
@@ -282,7 +273,7 @@ namespace CalciumInterface {
       // En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation
       // avec la compatibilité des types sera compilée 
       Copy2UserSpace< IsSameType<T1,InnerType>::value, DataManipulator >::apply(data,corbaData,nRead);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
 #endif
       // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
@@ -297,18 +288,18 @@ namespace CalciumInterface {
       //  de désallouer un buffer intermédiaire ( types différents) ou de rendre la propriété
    } else {
       nRead = std::min < size_t > (corbaDataSize,bufferLength);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
 #endif
       Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
       //Déjà fait ci-dessus : 
       //DataManipulator::copy(corbaData,data,nRead);
     
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
 #endif
    }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
     std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
     std::cout << "Ptr :" << data << std::endl;
@@ -369,13 +360,13 @@ namespace CalciumInterface {
     CalciumTypes::DependencyType _dependencyType=              
       static_cast<CalciumTypes::DependencyType>(dependencyType);
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
 #endif
     if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR,
                                                    LOC("Le nom de la variable est <nul>"));
     UsesPortType * port;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
     T1 t1;
     T2 t2;
@@ -385,24 +376,18 @@ namespace CalciumInterface {
 
     try {
       port  = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
 #endif
     } catch ( const Superv_Component_i::PortNotDefined & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPNMVR,ex));
     } catch ( const Superv_Component_i::PortNotConnected & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPLIEN,ex)); 
       // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
     } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
-      std::cerr << ex.what() << std::endl;
-#endif
+      MESSAGE(ex.what());
       throw (CalciumException(CalciumTypes::CPTPVR,ex));
     }
  
@@ -446,7 +431,7 @@ namespace CalciumInterface {
 
 
     CorbaDataType corbaData;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
 #endif
 
@@ -471,10 +456,12 @@ namespace CalciumInterface {
     //   OLD : Il faut effectuer une copie dans le port provides.
     //   OLD : Cette copie est effectuée dans GenericPortUses::put 
     //   OLD : en fonction de la collocalisation ou non.
+#ifdef MYDEBUG
     T1_without_extent t1b;
     InnerType         t2b;
     std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
     std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
+#endif
 
     Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
  
@@ -490,7 +477,7 @@ namespace CalciumInterface {
       }
       //Le -1 peut être traité par le cst DataIdContainer et transformé en 0 
       //Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
 #endif
     } 
@@ -503,13 +490,13 @@ namespace CalciumInterface {
       {
         throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
       }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
 #endif
     } 
 
     
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
     for (int i = 0; i < corbaData->length(); ++i)
       std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
@@ -519,7 +506,7 @@ namespace CalciumInterface {
     // Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie)
     delete corbaData;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
 #endif
    
index 50ae4bd53b24b3df74913b52a0ef5d6d365e9524..bfd6b3fdc41a17dcfd6a31ba2803d10f84da267b 100644 (file)
     try {                                                              \
                                                                        \
       if (key == "StorageLevel" )                                      \
-       {if ( ok=(value >>= sl)    ) Port::setStorageLevel(sl);}        \
+       {if ( ( ok=(value >>= sl) )   ) Port::setStorageLevel(sl);}     \
       else if (key == "Alpha"      )                                   \
-       {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);}            \
+       {if ( ( ok=(value >>= alpha) ) ) Port::setAlpha(alpha);}                \
       else if (key == "DeltaT"     )                                   \
-       {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);}           \
+       {if ( ( ok=(value >>= delta) ) ) Port::setDeltaT(delta);}               \
       else if (key == "DependencyType" )                               \
-       {if ( ok=( value >>= dt)   ) Port::setDependencyType(dependencyType[dt]);} \
+       {if ( ( ok=( value >>= dt)  )  ) Port::setDependencyType(dependencyType[dt]);} \
       else if (key == "DateCalSchem" )                                 \
-       {if ( ok=(value >>= dcs) )                                      \
+       {if ( ( ok=(value >>= dcs) ) )                                  \
            Port::setDateCalSchem(dateCalSchem[dcs]);}                  \
       else if (key == "InterpolationSchem")                            \
-       {if ( ok=(value >>= is) )                                       \
+       {if ( ( ok=(value >>= is) ) )                                   \
            Port::setInterpolationSchem(interpolationSchem[is]);}       \
       else if (key == "ExtrapolationSchem")                            \
-       {if ( ok=(value >>= es) )                                       \
+       {if ( ( ok=(value >>= es) ) )                                   \
            Port::setExtrapolationSchem(extrapolationSchem[es]);}       \
       else                                                             \
        throw Ports::NotDefined();                                      \
index 2c22269f491fdb3454214ffdac1c8d20a4735daa..d819f95dac583da5866cfc18995ed709bdf57ff8 100644 (file)
@@ -82,7 +82,7 @@ Id          : $Id$
       DEBTRACE( ex.what() );                                           \
       return ex.getInfo();                                             \
     } catch ( ... ) {                                                  \
-      std::cerr << "Unexpected exception " << std::endl;               \
+      DEBTRACE( "Unexpected exception ") ;             \
       return CalciumTypes::CPATAL;                                     \
     }                                                                  \
     if ( IsSameType< _porttype , cplx >::value ) { *nRead=_nRead/2;            \
@@ -122,10 +122,10 @@ Id          : $Id$
                                                        dependencyType, \
                                                        _t,i,nomvar,_bufferLength,*data); \
     } catch ( const CalciumException & ex) {                           \
-      std::cerr << ex.what() << std::endl;                             \
+      DEBTRACE( ex.what() );                           \
       return ex.getInfo();                                             \
     } catch ( ... ) {                          \
-      std::cerr << "Unexpected exception " << std::endl; \
+      DEBTRACE("Unexpected exception " ); \
       return CalciumTypes::CPATAL;                                             \
     }                                                                  \
     fprintf(stderr,"End of ecp_ecriture_" #_name " : %s %ld %e\n",nomvar,i,_t); \
index e99de9a6a24c55c16a7dda3b926d593eeca8bff4..b94d092f7516162fb59d55cfe060a6e09df749a9 100644 (file)
@@ -24,6 +24,7 @@
 // Id          : $Id$
 //
 #include "CalciumTypes2CorbaTypes.hxx"
+#include "utilities.h"
 #include <iostream>
 
 using namespace std;
@@ -61,21 +62,16 @@ CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map<CalciumTypes::DependencyTyp
   map<CalciumTypes::DependencyType,
     Ports::Calcium_Ports::DependencyType > &
     table  = ( map<CalciumTypes::DependencyType,
-              Ports::Calcium_Ports::DependencyType > & ) *this ;
+               Ports::Calcium_Ports::DependencyType > & ) *this ;
 
-table[CalciumTypes::TIME_DEPENDENCY ]      = Ports::Calcium_Ports::TIME_DEPENDENCY ;
-table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
-table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
+  table[CalciumTypes::TIME_DEPENDENCY ]      = Ports::Calcium_Ports::TIME_DEPENDENCY ;
+  table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
+  table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
 
 
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< 
-  table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< 
-  table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< 
-  table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+  MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< table[CalciumTypes::TIME_DEPENDENCY]);
+  MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< table[CalciumTypes::ITERATION_DEPENDENCY]);
+  MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< table[CalciumTypes::UNDEFINED_DEPENDENCY]);
 }
 
 
@@ -84,11 +80,9 @@ Ports::Calcium_Ports::DependencyType CORBA_DEPENDENCY_TYPE::operator[]( const Ca
   map<CalciumTypes::DependencyType,
     Ports::Calcium_Ports::DependencyType > &
     table = (map<CalciumTypes::DependencyType,
-            Ports::Calcium_Ports::DependencyType >& ) *this ;
+             Ports::Calcium_Ports::DependencyType >& ) *this ;
 
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+  MESSAGE("CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
 
   assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
   return table[ (CalciumTypes::DependencyType)c ] ;
index 429fe723a0194af6ff3c82e63a25ea9fe4557a8f..18518eb8038308bcbbab948377eae75f661f5fb7 100644 (file)
@@ -34,6 +34,8 @@
 #include <iostream>
 #include "CalciumPortTraits.hxx"
 
+//#define MYDEBUG
+
 template <bool zerocopy, typename DataManipulator> 
 struct Copy2CorbaSpace  {
 
@@ -45,7 +47,7 @@ struct Copy2CorbaSpace  {
     //ESSAI:     typedef typename PortType::DataManipulator         DataManipulator;
     typedef typename DataManipulator::InnerType        InnerType;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
 #endif
     // Crée le type corba à partir du data sans lui en donner la propriété.
@@ -53,7 +55,7 @@ struct Copy2CorbaSpace  {
     // DataManipulator::create n'a pas le caractère const sur son paramètre data pour le
     // cas de figure où  la propriété de la donnée lui est donnée.
     corbaData = DataManipulator::create(nRead,const_cast<T2 * > (&data),false);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : " 
              << DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
 #endif
@@ -76,14 +78,14 @@ Copy2CorbaSpace<false, DataManipulator>  {
     corbaData = DataManipulator::create(nRead);
     InnerType * dataPtr  = DataManipulator::getPointer(corbaData,false);
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
       dataPtr<<")----------------" << std::endl;
 #endif
     // Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde !   
     std::copy(&data,&data+nRead,dataPtr);
  
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
  
     std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
index 6d508e8d3bdcaa5e81b476d2d3afbacfbc83a7bd..c97876d51d924ea4072805888872a21c57886002 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <cstdio>
 
+//#define MYDEBUG
+
 //Les demandes de copies vers l'espace utilisateur
 //proviennent d'une procédure de lecture  
 
@@ -106,7 +108,7 @@ struct Copy2UserSpace<false, DataManipulator> {
     typedef typename DataManipulator::InnerType        InnerType;
     
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     InnerType * dataPtr = NULL;
     // Affiche la valeur du pointeur de la structure corba
     //  et les pointeurs contenus le cas échéant
@@ -139,7 +141,7 @@ struct Copy2UserSpace<false, DataManipulator> {
     //std::copy(dataPtr,dataPtr+nRead,data);
     DataManipulator::copy(corbaData,data,nRead);
       
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     tmpData = data;
     std::cerr << "-------- Copy2UserSpace<false> MARK 1c --data("<<tmpData<<")[0.."<<
       DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
index ed8373ceed48d022d131fcd2923b26c98bd14701..74d238f3c2fe8d66afa0d4430b728d2399f0d73b 100644 (file)
@@ -24,6 +24,7 @@
 // Id          : $Id$
 //
 #include "CorbaTypes2CalciumTypes.hxx"
+#include "utilities.h"
 #include <iostream>
 
 using namespace std;
@@ -61,21 +62,15 @@ DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map<Ports::Calcium_Ports::DependencyType,
   map<Ports::Calcium_Ports::DependencyType,
     CalciumTypes::DependencyType > &
     table  = ( map<Ports::Calcium_Ports::DependencyType,
-              CalciumTypes::DependencyType > & ) *this ;
+               CalciumTypes::DependencyType > & ) *this ;
 
-table[Ports::Calcium_Ports::TIME_DEPENDENCY ]      = CalciumTypes::TIME_DEPENDENCY ;
-table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
-table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
+  table[Ports::Calcium_Ports::TIME_DEPENDENCY ]      = CalciumTypes::TIME_DEPENDENCY ;
+  table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
+  table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
 
-
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< 
-  table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< 
-  table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< 
-  table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+  MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::TIME_DEPENDENCY]);
+  MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::ITERATION_DEPENDENCY]);
+  MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY]);
 }
 
 
@@ -85,9 +80,7 @@ CalciumTypes::DependencyType DEPENDENCY_TYPE::operator[]( const Ports::Calcium_P
     CalciumTypes::DependencyType> &table = (map<Ports::Calcium_Ports::DependencyType,
                                            CalciumTypes::DependencyType>&)*this ;
 
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+  MESSAGE("DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
 
   assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
   return table[ (Ports::Calcium_Ports::DependencyType)c ] ;
index 7cf7501c28c9b6a1ccf29fc4c7172519fb0565fc..ada58a3c7f78d8baca40edd696e35284f085e9a6 100644 (file)
@@ -33,6 +33,7 @@
 #include <cstring>
 #include <CORBA.h>
 
+//#define MYDEBUG
 
 // Classes manipulation
 // -------------------
@@ -227,7 +228,7 @@ public:
     // En non collocalisé on recrée une séquence avec le buffer de la première dont on
     // a demandé la propriété.
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
 #endif
     if ( data.release() ) {
@@ -236,13 +237,13 @@ public:
     // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie)
     // Les données de la nouvelle séquence seront automatiquement désallouées 
     // par appel à la méthode freebuf dans le destructeur de la séquence (cf  delete_data).
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<<  p_data <<"------------" << std::endl;
 #endif
     
       return  new seq_T (max, len, p_data, true);
     }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<<  &data <<"------------" << std::endl;
 #endif
     // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)    
@@ -397,12 +398,12 @@ public:
     // Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie)
     // Les données seront automatiquement désallouées par appel interne à la méthode freebuf
     // lors de la destruction de l'objet par appel à delete_data.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication  -----------" << std::endl;
 #endif
        return new seq_T (len, p_data, true);
      }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl;
 #endif
     // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)    
index ac7e29411598e89af27d4261d2abb96893d1f2e4..4372c9dfb301998725f46fe8004b8eb6fb12c021 100644 (file)
@@ -35,6 +35,7 @@
 #include "Utils_CorbaException.hxx"
 // SALOME C++   Exception
 #include "Utils_SALOME_Exception.hxx"
+#include "utilities.h"
 
 #include <iostream>
 #include <map>
@@ -43,6 +44,8 @@
 #include <algorithm>
 #include <iterator>
 
+//#define MYDEBUG
+
 // Classe GenericPort
 // --------------------------------
 //
@@ -104,7 +107,7 @@ template < typename DataManipulator, typename COUPLING_POLICY>
 GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
   typename DataTable::iterator it;
   for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<<  (*it).first << std::endl;
 #endif
     DataManipulator::delete_data( (*it).second );
@@ -122,12 +125,12 @@ GenericPort<DataManipulator, COUPLING_POLICY>::close (PortableServer::POA_var po
 template < typename DataManipulator, typename COUPLING_POLICY> void
 GenericPort<DataManipulator, COUPLING_POLICY>::wakeupWaiting()
 {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- wakeupWaiting ------------------" << std::endl;
 #endif
   storedDatas_mutex.lock();
   if (waitingForAnyDataId || waitingForConvenientDataId) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
     std::cout << std::flush;
 #endif
@@ -150,7 +153,7 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
   fflush(stdout);
   fflush(stderr);
   try {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     // Affichage des donnees pour DEBUGging
     std::cerr << "parametres emis: " << time << ", " << tag << std::endl;
     DataManipulator::dump(dataParam);
@@ -173,11 +176,11 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
 
     bool expectedDataReceived = false;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
 #endif
     if ( dataIds.empty() ) return;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
 #endif
 
@@ -188,7 +191,7 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
 
     int nbOfIter = 0;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
     std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
 #endif
@@ -196,18 +199,18 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
 
     for (;dataIdIt != dataIds.end();++dataIdIt) {
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
 #endif
       // Duplique l'instance de donnée pour les autres dataIds 
       if (nbOfIter > 0) data = DataManipulator::clone(data);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
 #endif
     
       DataId currentDataId=*dataIdIt;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cerr << "processing dataId : "<< currentDataId << std::endl;
 
       std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
@@ -221,14 +224,14 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
       // <=> premier emplacement où l'on pourrait insérer notre DataId
       // <=> en général équivaux à (*wDataIt).first >= currentDataId
       typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
 #endif
 
       // On n'a pas trouvé de dataId supérieur au notre ou 
       // on a trouvé une clé >  à cet Id         
       if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
 #endif
        // Ajoute la donnee dans la table
@@ -236,7 +239,7 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
       } else  {
        // Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict
        // entre notre dataId et le DataId pointé c'est qu'ils sont identiques
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
 #endif
        // Les données sont remplacées par les nouvelles valeurs
@@ -247,13 +250,13 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
        DataManipulator::delete_data (old_data);
       }
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
 #endif
       // Compte le nombre de dataIds à traiter
       ++nbOfIter;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl;
       std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl;
       std::cout << "-------- Put : currentDataId  : " << currentDataId <<"---" << std::endl;
@@ -278,7 +281,7 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
           ( waitingForConvenientDataId && 
             isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) ) 
           ) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
 #endif
        //Doit pouvoir réveiller le get ici (a vérifier)
@@ -287,7 +290,7 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
     }
    
     if (expectedDataReceived) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
 #endif
       // si waitingForAnyDataId était positionné, c'est forcément lui qui a activer
@@ -305,20 +308,18 @@ void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataPara
       // Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un !
       // Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue
       // des lectures simultanées sur le même port !
-#ifdef _DEBUG_
-      std::cout << "-------- Put : new datas available ------------------" << std::endl;
-#endif
+      MESSAGE("-------- Put : new datas available ------------------");
       fflush(stdout);fflush(stderr);
       cond_instance.signal();
     }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
 #endif
 
     // Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected...
     storedDatas_mutex.unlock();
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
 #endif
     fflush(stdout);
@@ -357,11 +358,11 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
   bool     isEqual, isBounded;
   typedef typename DataManipulator::InnerType InnerType;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
 #endif
   expectedDataId   = DataId(time,tag);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
 #endif
  
@@ -379,14 +380,14 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
       //   - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
       // Méthode provenant de la COUPLING_POLICY
       isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
 #endif
 
       // L'ordre des différents tests est important
       if ( isEqual ) {
  
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
 #endif
        // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
@@ -395,7 +396,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
        // Du coup interaction potentielle entre le 0 copy et gestion de l'historique
        dataToTransmit = (*wDataIt1).second; 
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Get : MARK 5 ------------------" << std::endl;
        std::cout << "-------- Get : Données trouvées à t : " << std::endl;
        typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
@@ -410,13 +411,13 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
        // Méthode provenant de la COUPLING_POLICY 
        typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
        processEraseDataId.apply(storedDatas,wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
 #endif
        break;
 
       }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
 #endif
 
@@ -430,7 +431,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
        // Cependant  comme les données sont censées être produites
        // par ordre croissant de DataId, de nouvelles données ne devrait pas améliorer
        // l'interpolation.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
 #endif
 
@@ -448,7 +449,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
        // A déplacer en paramètre de la méthode précédente ? ou déléguer ce choix au mode de couplage ?
        storedDatas[expectedDataId]=dataToTransmit;
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Get : Données calculées à t : " << std::endl;
        typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
        size_t   N = DataManipulator::size(dataToTransmit);
@@ -472,12 +473,12 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
     
       // Réception bloquante sur le dataId demandé
       // Si l'instance de donnée n'est pas trouvee
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
 #endif
       //Positionné à faux dans la méthode put
       waitingForConvenientDataId = true; 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
      
       // Ici on attend que la méthode put recoive la donnée 
@@ -486,7 +487,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
       fflush(stdout);fflush(stderr);
       cond_instance.wait();
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
 #endif
     }
@@ -499,7 +500,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
 
   // Deverouille l'acces a la table
   storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
 #endif
 
@@ -538,7 +539,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
   try {
     storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
 #endif
 
@@ -571,12 +572,12 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
        waitingForAnyDataId = false; break;
       }
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
 #endif
       //Positionné à faux dans la méthode put
       waitingForAnyDataId   = true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
       std::cout << "-------- Next : MARK 3 ------------------" << std::endl;
       // Ici on attend que la méthode put recoive la donnée 
       std::cout << "-------- Next : waiting datas ------------------" << std::endl;
@@ -585,12 +586,12 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
       cond_instance.wait();
 
       if (lastDataIdSet) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
 #endif
        wDataIt1 = storedDatas.upper_bound(lastDataId);
       } else  {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
        std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
 #endif
        lastDataIdSet = true;
@@ -598,7 +599,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
       }
     }
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
 #endif
 
@@ -606,7 +607,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
     tag = getTag ( (*wDataIt1).first );
     dataToTransmit = (*wDataIt1).second;
  
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
 #endif
     lastDataId    = (*wDataIt1).first;
@@ -614,11 +615,11 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
     typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
     processEraseDataId.apply(storedDatas, wDataIt1);
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Next : MARK 8 ------------------" << std::endl;   
 #endif
   } catch (...) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
 #endif
     waitingForAnyDataId = false;
@@ -627,7 +628,7 @@ GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
   }
   storedDatas_mutex.unlock();
   
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
 #endif
 
index 0d397e1728f01d089d69ed0c62a3b3f64b333153..25cd00348463d08fe932cc164c4952bc0dfff5f6 100644 (file)
@@ -107,16 +107,14 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort  >::put
     CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]);
     //if (i) { PB1
     //OLD :   copyOfData = DataManipulator::clone(data);
-#ifdef _DEBUG_
-    std::cout << "-------- GenericUsesPort::put -------- " << std::endl;
-#endif
+    MESSAGE("-------- GenericUsesPort::put -------- " );
     //} PB1
     try {
       port->put(data,time,tag);
       // OLD : port->put(*copyOfData,time,tag);
     } catch(const CORBA::SystemException& ex) {
       //OLD : DataManipulator::delete_data(copyOfData);
-      throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode put sur le port n°"
+      throw DSC_Exception(LOC(OSS() << "Can't invoke put method on port number "
                              << i << "( i>=  0)"));
 
     }
@@ -137,9 +135,7 @@ GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort
 {
   if (_my_ports) delete _my_ports;
 
-#ifdef _DEBUG_
-  std::cerr << "GenericUsesPort::uses_port_changed" << std::endl;
-#endif
+  MESSAGE("GenericUsesPort::uses_port_changed");
   _my_ports = new_uses_port;
 }
 
index 15bb1894fafbf26043d40e2b81d6a10c200f3b59..acbd47875cb41e54fb0536802fe98761a18512be 100644 (file)
@@ -45,7 +45,7 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
                                       bool notif) : 
   Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) 
 {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cerr << "--Superv_Component_i : MARK 1 ----  " << instanceName << "----" << std::endl;
 #endif
 }
@@ -58,7 +58,7 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
                                        bool regist) : 
   Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist) 
 {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cerr << "--Superv_Component_i : MARK 1 ----  " << instanceName << "----" << std::endl;
 #endif
 }
@@ -163,11 +163,11 @@ Superv_Component_i::add_port(const char * port_fab_type,
     add_port(port, port_name);
   }
   else if (s_port_type == "uses") {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "---- Superv_Component_i::add_port : MARK 1 ---- "  << std::endl;
 #endif
     uses_port * port = create_uses_data_port(port_fab_type);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cerr << "---- Superv_Component_i::add_port : MARK 2 ---- "  << std::endl;
 #endif
     add_port(port, port_name);
index ec6d8abcbec2f6320858129a3178bfde6b3e0ad2..29f8483f3d465aa011865cbd7383ec4161ca703e 100644 (file)
@@ -35,6 +35,7 @@
 #include "DSC_Exception.hxx"
 #include <vector>
 
+//#define MYDEBUG
 
 /*! \class Superv_Component_i
  *  \brief This class implements DSC_User component.
@@ -297,7 +298,7 @@ Superv_Component_i::add_port(const char * port_fab_type,
   assert(port_name);
   SpecificPortType * retPort; 
 
-#ifdef _DEBUG_
+#ifdef MYDEBUG
   std::cout << "---- Superv_Component_i::add_port :  Mark 0 ----  " << port_name << "----" << std::endl;
 #endif
     
@@ -313,12 +314,12 @@ Superv_Component_i::add_port(const char * port_fab_type,
   else if (s_port_type == "uses") {
     uses_port * port = create_uses_data_port(port_fab_type);
     add_port(port, port_name);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "---- Superv_Component_i::add_port :  Mark 1 ----  " << port << "----" << std::endl;
     std::cout << "---- Superv_Component_i::add_port :  Mark 1 ----   get_repository_id()" << port->get_repository_id() << std::endl;
 #endif
     retPort = dynamic_cast<SpecificPortType *>(port);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
     std::cout << "---- Superv_Component_i::add_port :  Mark 2 ----  " << retPort << "----" << std::endl;
 #endif
     if ( retPort == NULL ) { delete port;