//
#include "DSC_i.hxx"
-//#define MYDEBUG
Engines_DSC_i::
Engines_DSC_i(CORBA::ORB_ptr orb,
false
)
{
-#ifdef MYDEBUG
- std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
}
Engines_DSC_i::
bool regist) :
Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
-#ifdef MYDEBUG
- std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
}
Engines_DSC_i::~Engines_DSC_i() {}
#include <sstream>
#include <stdlib.h>
-//#define MYDEBUG
+#include "utilities.h"
Engines_DSC_interface::Engines_DSC_interface() {}
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
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl;
+
throw BPT;
}
rtn_port = new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs);
}
else
- {
-#ifdef MYDEBUG
- std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
-#endif
+ {
+ if (SALOME::VerbosityActivated())
+ std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
+
throw Engines::DSC::PortNotConnected();
- }
+ }
return rtn_port;
}
// Pour affichage
#include "DisplayPair.hxx"
//
-
-//#define MYDEBUG
+#include "utilities.h"
// Suppose que le container est trié
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 MYDEBUG
- std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
- std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
+ std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
+ }
+
if ( v1 <= _minValue && v1 >= _maxValue)
{
_equal= true;
-#ifdef MYDEBUG
- std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
+
return true;
}
if ( v1 < _minValue )
{
_min=v1;_minFound=true;
-#ifdef MYDEBUG
- std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
}
else if ( v1 > _maxValue )
{
_max=v1;_maxFound=true;
-#ifdef MYDEBUG
- std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
}
bool isEqual() const { return _equal;}
bool isBounded() const { return _minFound && _maxFound;}
bool getBounds(TNoConst & min, TNoConst & max) const {
-#ifdef MYDEBUG
- std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
+
if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
return false;
}
#include <stdio.h>
-//#define MYDEBUG
-#ifdef MYDEBUG
-#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
-#else
-#define DEBTRACE(msg)
-#endif
-
+#define DEBTRACE(msg) \
+ if (SALOME::VerbosityActivated()) \
+ { std::cerr << std::flush << __FILE__ << " [" << __LINE__ << "] : " << msg << std::endl << std::flush; } \
+ else (void)0
/* Définition de l'Interface entre l'API C et l'API C++
L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) {
if (provideLastGivenValue) {
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl;
+
_disconnectDirective = CalciumTypes::CONTINUE;
} else {
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl;
+
_disconnectDirective = CalciumTypes::STOP;
}
#include "CalciumTypes.hxx"
#include "CalciumException.hxx"
-//#define MYDEBUG
class CalciumCouplingPolicy : public CouplingPolicy {
const DataId & /*dataId*/,
const Iterator & /*it1*/) const {
typedef typename iterator_t<Iterator>::value_type value_type;
-#ifdef MYDEBUG
- std::cout << "-------- Calcium Generic BoundedDataIdProcessor.apply() called " << std::endl;
-#endif
-
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Calcium Generic BoundedDataIdProcessor.apply() called " << std::endl;
}
};
MapIterator it2=it1; ++it2;
size_t dataSize1 = DataManipulator::size(it1->second);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
// Gérer dans calcium la limite de la taille du buffer donnée par
// l'utilisateur.
size_t dataSize2 = DataManipulator::size(it2->second);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
size_t dataSize = std::min< size_t >( dataSize1, dataSize2 );
DataId dataId2 = it2->first;
DataId dataId1 = it1->first;
TimeType t2 = dataId2.first;
TimeType t1 = dataId1.first;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
+ }
+
TimeType t = dataId.first;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
+
TimeType timeDiff = t2-t1;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
+
TimeType coeff = (t2-t)/timeDiff;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
-#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
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
+ std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ }
+
InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
-#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;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
+ std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ }
Type dataOut = DataManipulator::create(dataSize);
InnerType * const OutIt = DataManipulator::getPointer(dataOut);
-#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;
- std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : storageLevel : " << _couplingPolicy._storageLevel << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : storageLevel : " << _couplingPolicy._storageLevel << std::endl;
+ }
+
if ( timeDiff == 0.0 || _couplingPolicy._interpolationSchem == CalciumTypes::L0_SCHEM ) {
std::copy(InIt1,InIt1+dataSize,OutIt);
} else {
// }
}
-#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;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ }
data = dataOut;
}
AdjacentFunctor< key_type > af(expectedDataId);
if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
{
-#ifdef MYDEBUG
- std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
- std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
+ std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
+ }
+
af.setMaxValue(key_type(expectedDataId.first*(1.0-_deltaT),0));
}
isBounded = false;
typename AssocContainer::iterator current = prev;
while ( (current != storedDatas.end()) && !af(current->first) )
{
-#ifdef MYDEBUG
- std::cerr << "------- stored time : " << current->first << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cerr << "------- stored time : " << current->first << std::endl;
+ }
+
// if ( af(current->first) ) break;
prev = current++;
}
else
wDataIt1 = storedDatas.end();
-#ifdef MYDEBUG
- std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
return isEqual || isBounded;
}
typedef typename Container::value_type value_type;
typedef typename Container::iterator iterator;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
if ( _couplingPolicy._storageLevel == (size_t)CalciumTypes::UNLIMITED_STORAGE_LEVEL ) return;
" has just removed the data to send")));
}
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
+
return;
}
typedef typename Container::iterator iterator;
// Pas de traitement particulier a effectuer
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
+
if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
// TODO : Ds GenericPort::next il faut convertir en CPSTOPSEQ
if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET )
throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "CP_ARRET directive"
<< " interrupts all further data reading")));
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
-#endif
-
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
// S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement
// TODO : Dans la gestion des niveaux il faut peut être interdire un niveau == 0
// 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 MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl;
// >= expectedDataId
iterator it1 = storedDatas.lower_bound(expectedDataId);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl;
- for (iterator it=storedDatas.begin();it!=storedDatas.end();++it)
- std::cout <<" "<<(*it).first ;
- std::cout <<std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl;
+ for (iterator it=storedDatas.begin(); it!=storedDatas.end(); ++it)
+ std::cout << " " << (*it).first;
+
+ std::cout << std::endl;
+ }
// TODO : Il faut en fait renvoyer le plus proche cf IT ou DT
if (it1 == storedDatas.end())
throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive"
<< " is active but the requested dataId is less or equal to the last one received.")));
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
wDataIt1 = storedDatas.end();
--wDataIt1;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
return true;
}
extern const char * CPMESSAGE[];
-//#define MYDEBUG
#include <boost/type_traits/remove_all_extents.hpp>
// calcium_uses_port* myCalciumUsesPort=
// dynamic_cast<calcium_uses_port*>(myUsesPort);
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
- // typeid(myUsesPort).name() <<"-------------" <<
- typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|" << *it << "|----" <<
+ //typeid(myUsesPort).name() <<"-------------" <<
+ typeid(myCalciumUsesPort).name() << "-------------" << std::endl;
+ }
// if ( !myCalciumUsesPort )
// throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
CorbaDataType corbaData;
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
if (nomVar.empty())
{
throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
}
PortType * port;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
- T1 t1;
- T2 t2;
- std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
- std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
+ }
try
{
port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
}
catch ( const Superv_Component_i::PortNotDefined & ex)
{
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
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
}
catch ( const DSC_Exception & ex)
{
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
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
}
catch ( const DSC_Exception & ex)
{
// Sequential read
try
{
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
+
Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"","Sequential read");
corbaData = port->next(ti,i);
msgout << "read ";
}
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
+
size_t corbaDataSize = DataManipulator::size(corbaData);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
// Vérifie si l'utilisateur demande du 0 copie
if ( data == NULL )
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 MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
+
// On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
// Copy2UserSpace :
// La raison d'être du foncteur Copy2UserSpace est qu'il n'est pas possible de compiler
// 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 MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
+
// Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
// la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
// DataManipulator::delete_data(corbaData);
// 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 MYDEBUG
+ {
+ nRead = std::min < size_t > (corbaDataSize,bufferLength);
+
+ if (SALOME::VerbosityActivated())
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 MYDEBUG
+
+ Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
+ //Déjà fait ci-dessus :
+ //DataManipulator::copy(corbaData,data,nRead);
+
+ if (SALOME::VerbosityActivated())
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
-#endif
- }
-#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;
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
-#endif
+ }
+
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
+ }
+
Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msgout.str().c_str());
return;
}
CalciumTypes::DependencyType _dependencyType=
static_cast<CalciumTypes::DependencyType>(dependencyType);
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
+
if ( nomVar.empty() )
{
Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
}
UsesPortType * port;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
- T1 t1;
- T2 t2;
- std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
- std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
+ }
try
{
port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
}
catch ( const Superv_Component_i::PortNotDefined & ex)
{
}
CorbaDataType corbaData;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
// Si les types Utilisateurs et CORBA sont différents
// il faut effectuer une recopie sinon on utilise directement le
// 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
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ }
Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
}
//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 MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
}
else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY )
{
Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
}
-#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;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ }
// if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
// Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie)
delete corbaData;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
return;
}
for(int i = 0; i < (int)this->_my_ports->length(); i++) {
CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]);
try {
-#ifdef MYDEBUG
+ if (SALOME::VerbosityActivated())
std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl;
-#endif
port->disconnect(provideLastGivenValue);
} catch(const CORBA::SystemException& ex){
size_t _bufferLength=bufferLength; \
\
if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ); \
try \
{ \
CalciumInterface::ecp_lecture< _type,_porttype >( *_component, dependencyType, _ti, _tf, *i, nomvar, \
} \
catch ( ... ) \
{ \
- DEBTRACE( "Unexpected exception ") ; \
+ DEBTRACE( "Unexpected exception "); \
return CalciumTypes::CPATAL; \
} \
if ( IsSameType< _porttype , cplx >::value ) \
{ \
*nRead=_nRead/2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ); \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ); \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ); \
} \
else \
*nRead = _nRead; \
if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
*ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ); \
return CalciumTypes::CPOK; \
} \
\
const char * const nomvar, size_t bufferLength, \
_type _qual * data ) \
{ \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ); \
Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
/* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
double _t=0.; \
_t=*t; \
size_t _bufferLength=bufferLength; \
if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ); \
try \
{ \
/*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
- DEBTRACE( "----------->-" << nomvar ) \
+ DEBTRACE( "----------->-" << nomvar ); \
CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, dependencyType, \
_t,i,nomvar,_bufferLength,*data); \
} \
DEBTRACE("Unexpected exception " ); \
return CalciumTypes::CPATAL; \
} \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ); \
return CalciumTypes::CPOK; \
} \
#include <iostream>
#include "CalciumPortTraits.hxx"
-//#define MYDEBUG
template <bool zerocopy, typename DataManipulator>
struct Copy2CorbaSpace {
//ESSAI: typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef MYDEBUG
- std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
+
// Crée le type corba à partir du data sans lui en donner la propriété.
// Le const_cast supprime le caractère const du type T2 const & de data car
// 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 MYDEBUG
- std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
<< DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
-#endif
-
}
};
corbaData = DataManipulator::create(nRead);
InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
-#ifdef MYDEBUG
- std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
- dataPtr<<")----------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
+ dataPtr<<")----------------" << std::endl;
+
// Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde !
std::copy(&data,&data+nRead,dataPtr);
-#ifdef MYDEBUG
- std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
-
- std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
- std::copy(dataPtr,dataPtr+nRead,std::ostream_iterator<InnerType>(std::cout," "));
- std::cout << std::endl;
- std::cerr << "-------- Copy2CorbaSpace<false> MARK 4 --(data : " <<data<<") :" ;
- for (int i=0; i<nRead; ++i)
- std::cerr << (*corbaData)[i] << " ";
- std::cout << std::endl;
-#endif
-
+ if (SALOME::VerbosityActivated())
+ {
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
+
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
+ std::copy(dataPtr,dataPtr+nRead,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 4 --(data : " <<data<<") :" ;
+ for (int i=0; i<nRead; ++i)
+ std::cerr << (*corbaData)[i] << " ";
+ std::cout << std::endl;
+ }
}
};
#include <cstdio>
-//#define MYDEBUG
-
//Les demandes de copies vers l'espace utilisateur
//proviennent d'une procédure de lecture
//Recopie le contenu de la donnée CORBA dans le buffer utilisateur de longueur nRead
template <class T1, class T2>
static void apply( T1 * &data, T2 & corbaData, size_t nRead){
-
- typedef typename DataManipulator::InnerType InnerType;
+ typedef typename DataManipulator::InnerType InnerType;
-
-#ifdef MYDEBUG
- InnerType * dataPtr = NULL;
- // Affiche la valeur du pointeur de la structure corba
- // et les pointeurs contenus le cas échéant
- dataPtr = DataManipulator::getPointer(corbaData,false);
- std::cerr << "-------- Copy2UserSpace<false> MARK 1a --dataPtr("<<dataPtr<<")[0.."<<
- DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
- std::copy(dataPtr,dataPtr+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
- for (int i=0; i< DataManipulator::size(corbaData); ++i)
- fprintf(stderr,"pointer[%d]=%p ",i, dataPtr[i]);
- std::cerr << std::endl;
-
- T1 * tmpData = data;
- //Cette affichage peut provoquer la détection d'écriture d'un espace non initailisé.
- std::cerr << "-------- Copy2UserSpace<false> MARK 1b --data("<<tmpData<<")[0.."<<
- DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
- std::copy(tmpData,tmpData+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
- for (int i=0; i< DataManipulator::size(corbaData); ++i)
- fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]);
- std::cerr << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ InnerType * dataPtr = NULL;
+ // Affiche la valeur du pointeur de la structure corba
+ // et les pointeurs contenus le cas échéant
+ dataPtr = DataManipulator::getPointer(corbaData,false);
+ std::cerr << "-------- Copy2UserSpace<false> MARK 1a --dataPtr("<<dataPtr<<")[0.."<<
+ DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
+ std::copy(dataPtr,dataPtr+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
+ for (int i=0; i< DataManipulator::size(corbaData); ++i)
+ fprintf(stderr,"pointer[%d]=%p ",i, dataPtr[i]);
+ std::cerr << std::endl;
+
+ T1 * tmpData = data;
+ //Cette affichage peut provoquer la détection d'écriture d'un espace non initailisé.
+ std::cerr << "-------- Copy2UserSpace<false> MARK 1b --data("<<tmpData<<")[0.."<<
+ DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
+ std::copy(tmpData,tmpData+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
+ for (int i=0; i< DataManipulator::size(corbaData); ++i)
+ fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]);
+ std::cerr << std::endl;
+ }
// Pour les types pointeurs et ref il faut effectuer une recopie profonde.
// On la délègue au manipulateur de données.
//std::copy(dataPtr,dataPtr+nRead,data);
DataManipulator::copy(corbaData,data,nRead);
-#ifdef MYDEBUG
- tmpData = data;
- std::cerr << "-------- Copy2UserSpace<false> MARK 1c --data("<<tmpData<<")[0.."<<
- DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
- std::copy(tmpData,tmpData+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
- for (int i=0; i< DataManipulator::size(corbaData); ++i)
- fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]);
- std::cerr << std::endl;
-#endif
-
+ if (SALOME::VerbosityActivated())
+ {
+ T1 * tmpData = data;
+ std::cerr << "-------- Copy2UserSpace<false> MARK 1c --data("<<tmpData<<")[0.."<<
+ DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
+ std::copy(tmpData,tmpData+DataManipulator::size(corbaData),std::ostream_iterator<T1>(std::cerr," "));
+ for (int i=0; i< DataManipulator::size(corbaData); ++i)
+ fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]);
+ std::cerr << std::endl;
+ }
}
-
};
#ifndef _CORBA_TYPE_MANIPULATION_HXX_
#define _CORBA_TYPE_MANIPULATION_HXX_
+#include "utilities.h"
+
#include <iostream>
#include <cstring>
#include <omniORB4/CORBA.h>
-//#define MYDEBUG
-
// Classes manipulation
// -------------------
//
// En non collocalisé on recrée une séquence avec le buffer de la première dont on
// a demandé la propriété.
-#ifdef MYDEBUG
- std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
+
if ( data.release() ) {
InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
// 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 MYDEBUG
- std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<< p_data <<"------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------" << p_data << "------------" << std::endl;
return new seq_T (max, len, p_data, true);
}
-#ifdef MYDEBUG
- std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<< &data <<"------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------" << &data << "------------" << std::endl;
+
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
return new seq_T(data);
// Récupère et devient propriétaire des données reçues dans la séquence
// la séquence sera désalloué (mais pas le buffer)
// au retour de la méthode put (car mapping de type IN : const seq & )
- if ( data.release() ) {
- InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
-
- // 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 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 MYDEBUG
- std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl;
-#endif
+ if ( data.release() ) {
+ InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
+
+ // 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.
+ if (SALOME::VerbosityActivated())
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication -----------" << std::endl;
+
+ return new seq_T (len, p_data, true);
+ }
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl;
+
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
return new seq_T(data);
-
}
static inline size_t size(Type data) {
#include <algorithm>
#include <iterator>
-//#define MYDEBUG
-
// Classe GenericPort
// --------------------------------
//
GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
typename DataTable::iterator it;
for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
-#ifdef MYDEBUG
- std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :" << (*it).first << std::endl;
+
DataManipulator::delete_data( (*it).second );
}
}
template < typename DataManipulator, typename COUPLING_POLICY> void
GenericPort<DataManipulator, COUPLING_POLICY>::wakeupWaiting()
{
-#ifdef MYDEBUG
- std::cout << "-------- wakeupWaiting ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- wakeupWaiting ------------------" << std::endl;
+
storedDatas_mutex.lock();
if (waitingForAnyDataId || waitingForConvenientDataId) {
-#ifdef MYDEBUG
- std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
- std::cout << std::flush;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
+ std::cout << std::flush;
+ }
+
cond_instance.signal();
- }
- storedDatas_mutex.unlock();
+ }
+ storedDatas_mutex.unlock();
}
/* Methode put_generique
fflush(stdout);
fflush(stderr);
try {
-#ifdef MYDEBUG
- // Affichage des donnees pour DEBUGging
- std::cerr << "parametres emis: " << time << ", " << tag << std::endl;
- DataManipulator::dump(dataParam);
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ // Affichage des donnees pour DEBUGging
+ std::cerr << "parametres emis: " << time << ", " << tag << std::endl;
+ DataManipulator::dump(dataParam);
+ }
// L'intérêt des paramètres time et tag pour ce port est décidé dans la politique de couplage
// Il est possible de filtrer en prenant en compte uniquement un paramètre time/tag ou les deux
bool expectedDataReceived = false;
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
+
if ( dataIds.empty() ) return;
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
// Recupere les donnees venant de l'ORB et relâche les structures CORBA
// qui n'auraient plus cours en sortie de méthode put
DataType data = DataManipulator::get_data(dataParam);
-
int nbOfIter = 0;
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
- std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
+ std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
+ }
storedDatas_mutex.lock();
for (;dataIdIt != dataIds.end();++dataIdIt) {
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
-#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 MYDEBUG
- std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
DataId currentDataId=*dataIdIt;
-#ifdef MYDEBUG
+ if (SALOME::VerbosityActivated())
+ {
std::cerr << "processing dataId : "<< currentDataId << std::endl;
-
std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
-#endif
+ }
// Ajoute l'instance de la donnee a sa place dans la table de données
// ou remplace une instance précédente si elle existe
// <=> 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 MYDEBUG
- std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
// 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 MYDEBUG
- std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
+
// Ajoute la donnee dans la table
wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data));
} 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 MYDEBUG
- std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
+
// Les données sont remplacées par les nouvelles valeurs
// lorsque que le dataId existe déjà
DataType old_data = (*wDataIt).second;
DataManipulator::delete_data (old_data);
}
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
+
// Compte le nombre de dataIds à traiter
++nbOfIter;
-#ifdef MYDEBUG
- std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl;
- std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl;
- std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl;
- std::cout << "-------- Put : expectedDataId : " << expectedDataId <<"---" << std::endl;
- std::cout << "-------- Put : MARK 9 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId << "---" << std::endl;
+ std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId << "---" << std::endl;
+ std::cout << "-------- Put : currentDataId : " << currentDataId << "---" << std::endl;
+ std::cout << "-------- Put : expectedDataId : " << expectedDataId << "---" << std::endl;
+ std::cout << "-------- Put : MARK 9 ------------------" << std::endl;
+ }
// A simplifier mais :
// - pas possible de mettre des arguments optionnels à cause
if ( waitingForAnyDataId ||
( waitingForConvenientDataId &&
this->isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) )
- ) {
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
-#endif
+ )
+ {
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
+
//Doit pouvoir réveiller le get ici (a vérifier)
expectedDataReceived = true;
}
}
if (expectedDataReceived) {
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
+
// si waitingForAnyDataId était positionné, c'est forcément lui qui a activer
// expectedDataReceived à true
if (waitingForAnyDataId)
// 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 MYDEBUG
- std::cerr << "-------- Put : new datas available ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- Put : new datas available ------------------" << std::endl;
+
fflush(stdout);fflush(stderr);
cond_instance.signal();
}
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
// Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected...
storedDatas_mutex.unlock();
-#ifdef MYDEBUG
- std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
+
fflush(stdout);
fflush(stderr);
bool isEqual, isBounded;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
+
expectedDataId = DataId(time,tag);
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
typename DataTable::iterator wDataIt1;
// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
// Méthode provenant de la COUPLING_POLICY
this->isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
// L'ordre des différents tests est important
if ( isEqual ) {
-
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
+
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
// C'est EraseDataId qui choisi ou non de supprimer la donnée
// Du coup interaction potentielle entre le 0 copy et gestion de l'historique
dataToTransmit = (*wDataIt1).second;
-#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);
- size_t N = DataManipulator::size(dataToTransmit);
- std::copy(InIt1, InIt1 + N,
- std::ostream_iterator< InnerType > (std::cout," "));
- std::cout << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ 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);
+ size_t N = DataManipulator::size(dataToTransmit);
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+ }
// Décide de la suppression de certaines instances de données
// La donnée contenu dans la structure CORBA et son dataId sont désallouées
// Méthode provenant de la COUPLING_POLICY
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas,wDataIt1);
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
-#endif
- break;
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
+ break;
}
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
//if ( isBounded() && COUPLING_POLICY::template needToProcessBoundedDataId() ) {
// Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage
// 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 MYDEBUG
+ if (SALOME::VerbosityActivated())
std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
-#endif
typedef typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> BDI;
BDI processBoundedDataId(*this);
// 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 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);
-
- std::copy(InIt1, InIt1 + N,
- std::ostream_iterator< InnerType > (std::cout," "));
- std::cout << std::endl;
- std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ 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);
+
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+ std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
+ }
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas,wDataIt1);
// Réception bloquante sur le dataId demandé
// Si l'instance de donnée n'est pas trouvee
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
+
//Positionné à faux dans la méthode put
waitingForConvenientDataId = true;
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
-
- // Ici on attend que la méthode put recoive la donnée
- std::cout << "-------- Get : waiting datas ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
+
+ // Ici on attend que la méthode put recoive la donnée
+ std::cout << "-------- Get : waiting datas ------------------" << std::endl;
+ }
+
fflush(stdout);fflush(stderr);
unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut;
if(rs==0)
}
}
-
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
}
-
} catch (...) {
waitingForConvenientDataId = true;
storedDatas_mutex.unlock();
// Deverouille l'acces a la table
storedDatas_mutex.unlock();
-#ifdef MYDEBUG
- std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
try {
storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
typename DataTable::iterator wDataIt1;
wDataIt1 = storedDatas.end();
waitingForAnyDataId = false; break;
}
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
+
//Positionné à faux dans la méthode put
waitingForAnyDataId = true;
-#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;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ }
+
fflush(stdout);fflush(stderr);
unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut;
if(rs==0)
}
if (lastDataIdSet) {
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
+
wDataIt1 = storedDatas.upper_bound(lastDataId);
} else {
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
+
lastDataIdSet = true;
wDataIt1 = storedDatas.begin();
}
}
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
t = this->getTime( (*wDataIt1).first );
tag = this->getTag ( (*wDataIt1).first );
dataToTransmit = (*wDataIt1).second;
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
+
lastDataId = (*wDataIt1).first;
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas, wDataIt1);
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
} catch (...) {
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
+
waitingForAnyDataId = false;
storedDatas_mutex.unlock();
throw;
}
storedDatas_mutex.unlock();
-#ifdef MYDEBUG
- std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]);
//if (i) { PB1
//OLD : copyOfData = DataManipulator::clone(data);
-#ifdef MYDEBUG
- std::cerr << "-------- GenericUsesPort::put -------- " << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- GenericUsesPort::put -------- " << std::endl;
//} PB1
try {
port->put(data,time,tag);
{
if (_my_ports) delete _my_ports;
-#ifdef MYDEBUG
- std::cerr << "GenericUsesPort::uses_port_changed" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "GenericUsesPort::uses_port_changed" << std::endl;
+
_my_ports = new_uses_port;
}
bool /*notif*/) :
Engines_DSC_i(orb, poa, contId, instanceName, interfaceName)
{
-#ifdef MYDEBUG
- std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
+
setTimeOut();
}
Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
bool regist) :
Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
-#ifdef MYDEBUG
- std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
+
setTimeOut();
}
add_port(port, port_name);
}
else if (s_port_type == "uses") {
-#ifdef MYDEBUG
+ if (SALOME::VerbosityActivated())
std::cerr << "---- Superv_Component_i::add_port : MARK 1 ---- " << std::endl;
-#endif
+
uses_port * port = create_uses_data_port(port_fab_type);
-#ifdef MYDEBUG
- std::cerr << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl;
+
add_port(port, port_name);
}
else
#include "DSC_Exception.hxx"
#include <vector>
-//#define MYDEBUG
-
/*! \class Superv_Component_i
* \brief This class implements DSC_User component.
*
assert(port_name);
SpecificPortType * retPort;
-#ifdef MYDEBUG
- std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
std::string s_port_type(port_type);
if (s_port_type == "provides") {
else if (s_port_type == "uses") {
uses_port * port = create_uses_data_port(port_fab_type);
add_port(port, port_name);
-#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
+ if (SALOME::VerbosityActivated())
+ {
+ 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;
+ }
retPort = dynamic_cast<SpecificPortType *>(port);
-#ifdef MYDEBUG
- std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
+
if ( retPort == NULL ) { delete port;
throw BadCast( LOC("Can't cast to asked port type " ));
}
#include <iostream>
#include <typeinfo>
-// note: in KERNEL _DEBUG_ is not defined by default
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
//#define IS_OBJ_IN_QUESTION(where) is_obj_in_question(this, myRefCounter, where)
#define IS_OBJ_IN_QUESTION(where)
*/
GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1)
{
- if(MYDEBUG)
- MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
- "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
+ MESSAGE("GenericObj_i::GenericObj_i() - this = " << this <<
+ "; CORBA::is_nil(thePOA) = " << CORBA::is_nil(thePOA));
+
if(CORBA::is_nil(thePOA)) {
#ifndef WIN32
myPOA = PortableServer::ServantBase::_default_POA();
else {
myPOA = PortableServer::POA::_duplicate(thePOA);
}
- if(MYDEBUG)
- MESSAGE("GenericObj_i::GenericObj_i thePOA: " << thePOA << " myPOA: " << myPOA);
+
+ MESSAGE("GenericObj_i::GenericObj_i thePOA: " << thePOA << " myPOA: " << myPOA);
}
/*!
*/
void GenericObj_i::Register()
{
- if(MYDEBUG)
- MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter);
+ MESSAGE("GenericObj_i::Register " << this << "; myRefCounter = " << myRefCounter);
++myRefCounter;
IS_OBJ_IN_QUESTION( "Register" );
}
*/
void GenericObj_i::UnRegister()
{
- if(MYDEBUG)
- MESSAGE("GenericObj_i::UnRegister "<<this<<"; myRefCounter = "<<myRefCounter);
+ MESSAGE("GenericObj_i::UnRegister " << this << "; myRefCounter = " << myRefCounter);
--myRefCounter;
IS_OBJ_IN_QUESTION( "UnRegister" );
if(myRefCounter <= 0){
void SALOME_Launcher_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
{
-// if (MYDEBUG) cout << "Begin parse document" << endl;
+ // cout << "Begin parse document" << endl;
// Empty private elements
_launch.Clear();
#include "utilities.h"
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
//----------------------------------------------------------------------
// Function : SALOME_ModuleCatalog_AcomponentImpl
SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C)
{
- if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
+ BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
- if(MYDEBUG) END_OF("SALOME_ModuleCatalog_AcomponentImpl");
+ END_OF("SALOME_ModuleCatalog_AcomponentImpl");
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl()
{
- if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+ BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
-
- if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+ END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
}
//----------------------------------------------------------------------
SALOME_ModuleCatalog::ListOfInterfaces*
SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList()
{
- if(MYDEBUG) BEGIN_OF("GetInterfaceList");
+ BEGIN_OF("GetInterfaceList");
SALOME_ModuleCatalog::ListOfInterfaces_var _list
= new SALOME_ModuleCatalog::ListOfInterfaces;
for (unsigned int ind = 0; ind < _length_interfaces; ind++)
{
_list[ind] = CORBA::string_dup(_Component.interfaces[ind].interfacename);
- if(MYDEBUG) MESSAGE("The component " << _Component.name
+ MESSAGE("The component " << _Component.name
<< " contains " << _list[ind] << " as interface");
}
- if(MYDEBUG) END_OF("GetInterfaceList");
+ END_OF("GetInterfaceList");
return _list._retn();
}
SALOME_ModuleCatalog::DefinitionInterface*
SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
{
- if(MYDEBUG) BEGIN_OF("GetInterface");
- if(MYDEBUG) SCRUTE(interfacename);
+ BEGIN_OF("GetInterface");
+ SCRUTE(interfacename);
SALOME_ModuleCatalog::DefinitionInterface *_interface =
new SALOME_ModuleCatalog::DefinitionInterface;
}
}
- if(MYDEBUG) SCRUTE(_find);
+ SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
message += " of the component ";
message += _Component.name;
message += " was not found";
- if(MYDEBUG) MESSAGE(message);
+ MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- if(MYDEBUG) END_OF("GetInterface");
+ END_OF("GetInterface");
return _interface;
}
SALOME_ModuleCatalog::ListOfServices*
SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
{
- if(MYDEBUG) BEGIN_OF("GetServiceList");
- if(MYDEBUG) SCRUTE(interfacename);
+ BEGIN_OF("GetServiceList");
+ SCRUTE(interfacename);
SALOME_ModuleCatalog::ListOfServices_var _list
= new SALOME_ModuleCatalog::ListOfServices;
for (unsigned int ind1 = 0; ind1 < _length_services ; ind1++)
{
_list[ind1] = CORBA::string_dup(I.interfaceservicelist[ind1].ServiceName);
- if(MYDEBUG) MESSAGE("The interface " << interfacename << " of the component "
- << _Component.name << " contains " << _list[ind1] << " as a service")
+ MESSAGE("The interface " << interfacename << " of the component "
+ << _Component.name << " contains " << _list[ind1] << " as a service");
}
}
}
message += " of the component ";
message += _Component.name;
message += " was not found";
- if(MYDEBUG) MESSAGE(message);
+ MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- if(MYDEBUG) END_OF("GetServiceList");
+ END_OF("GetServiceList");
return _list._retn();
}
SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
const char* servicename)
{
- if(MYDEBUG) BEGIN_OF("GetService");
- if(MYDEBUG) SCRUTE(interfacename);
- if(MYDEBUG) SCRUTE(servicename);
+ BEGIN_OF("GetService");
+ SCRUTE(interfacename);
+ SCRUTE(servicename);
Unexpect aCatch( MC_NotFound );
SALOME_ModuleCatalog::Service *service = new SALOME_ModuleCatalog::Service;
// looking for the specified interface
for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++)
{
- if(MYDEBUG) SCRUTE(ind);
- if(MYDEBUG) SCRUTE(_Component.interfaces[ind].interfacename);
+ SCRUTE(ind);
+ SCRUTE(_Component.interfaces[ind].interfacename);
SALOME_ModuleCatalog::DefinitionInterface &I = _Component.interfaces[ind];
if (strcmp(interfacename, I.interfacename) == 0)
for (unsigned int ind1 = 0; ind1 < I.interfaceservicelist.length() ; ind1++)
{
SALOME_ModuleCatalog::Service &S = I.interfaceservicelist[ind1];
- if(MYDEBUG) SCRUTE(ind1);
- if(MYDEBUG) SCRUTE(S.ServiceName);
+ SCRUTE(ind1);
+ SCRUTE(S.ServiceName);
if (strcmp(servicename, S.ServiceName) == 0)
{
}
}
- if(MYDEBUG) SCRUTE(_find);
+ SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
message += " of the component ";
message += _Component.name;
message += " was not found";
- if(MYDEBUG) MESSAGE(message);
+ MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- if(MYDEBUG) END_OF("GetService");
+ END_OF("GetService");
return service;
}
SALOME_ModuleCatalog::Service*
SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename)
{
- if(MYDEBUG) BEGIN_OF("GetDefaultService");
- if(MYDEBUG) SCRUTE(interfacename);
+ BEGIN_OF("GetDefaultService");
+ SCRUTE(interfacename);
Unexpect aCatch( MC_NotFound );
SALOME_ModuleCatalog::Service *_service = new SALOME_ModuleCatalog::Service;
message += " of the component ";
message += _Component.name;
message += " was not found";
- if(MYDEBUG) MESSAGE(message);
+ MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- if(MYDEBUG) END_OF("GetDefaultService");
+ END_OF("GetDefaultService");
return _service;
}
char*
SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename)
{
- if(MYDEBUG) BEGIN_OF("GetPathPrefix");
- if(MYDEBUG) SCRUTE(machinename);
+ BEGIN_OF("GetPathPrefix");
+ SCRUTE(machinename);
Unexpect aCatch( MC_NotFound );
// Variables initialisation
}
}
- if(MYDEBUG) SCRUTE(_find);
+ SCRUTE(_find);
if (!_find)
{
// The computer was not found, the exception should be thrown
message += machinename;
message += " was not found in the catalog associated to the component ";
message += _Component.name;
- if(MYDEBUG) MESSAGE(message);
+ MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- if(MYDEBUG) END_OF("GetPathPrefix");
+ END_OF("GetPathPrefix");
return _path;
}
// duplicate out DataStreamParameters
_length = S_in.ServiceoutDataStreamParameter.length();
- if(MYDEBUG) SCRUTE(_length);
+ SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
// duplicate service list
unsigned int _length = I_in.interfaceservicelist.length();
- if(MYDEBUG) SCRUTE(_length);
+ SCRUTE(_length);
I_out.interfaceservicelist.length(_length);
for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
SALOME_ModuleCatalog::ModuleCatalog_var Catalogue
= SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
- MESSAGE("Distant catalog of component found")
+ MESSAGE("Distant catalog of component found");
// Get component list
SALOME_ModuleCatalog::ListOfComponents_var list_composants
#include <sstream>
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
//----------------------------------------------------------------------
// Function : SALOME_ModuleCatalog_Handler
_typeMap(typeMap),_typeList(typeList)
{
- if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
+ BEGIN_OF("SALOME_ModuleCatalog_Handler");
// XML Tags initialisation
// Used in the function endElement
test_component_list = "component-list";
test_component="component";
- if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
+ END_OF("SALOME_ModuleCatalog_Handler");
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
{
- if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
- if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
+ BEGIN_OF("~SALOME_ModuleCatalog_Handler()");
+ END_OF("~SALOME_ModuleCatalog_Handler()");
}
void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
{
- if(MYDEBUG) MESSAGE("Begin parse document");
+ MESSAGE("Begin parse document");
// Empty the private elements
_pathList.resize(0);
_pathPrefix.listOfComputer.resize(0);
# include <unistd.h>
#endif
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
static const char* SEPARATOR = "::";
static const char* OLD_SEPARATOR = ":";
SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb)
{
myPrivate = new Private;
- if(MYDEBUG) MESSAGE("Catalog creation");
+ MESSAGE("Catalog creation");
/* Init libxml */
xmlInitParser();
// Parse the arguments given at server run
if (!_parseArguments(argc, argv,&myPrivate->_general_path,&myPrivate->_personal_path))
- if(MYDEBUG) MESSAGE( "Error while argument parsing" );
+ MESSAGE( "Error while argument parsing" );
// Test existency of files
if (myPrivate->_general_path == NULL)
{
- if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" );
+ MESSAGE( "Error the general catalog should be indicated" );
}
else
{
// Verification of _general_path_list content
if (!myPrivate->_verify_path_prefix(myPrivate->_general_path_list)) {
- if(MYDEBUG) MESSAGE( "Error while parsing the general path list, "
+ MESSAGE( "Error while parsing the general path list, "
"different paths are associated to the same computer,"
"the first one will be chosen");
} else {
- if(MYDEBUG) MESSAGE("General path list OK");
+ MESSAGE("General path list OK");
}
if (myPrivate->_personal_path != NULL) {
// Verification of _general_path_list content
if(!myPrivate->_verify_path_prefix(myPrivate->_personal_path_list)){
- if(MYDEBUG) MESSAGE("Error while parsing the personal path list, "
+ MESSAGE("Error while parsing the personal path list, "
"different paths are associated to the same computer, "
"the first one will be chosen" );
}else {
- if(MYDEBUG) MESSAGE("Personal path list OK");
+ MESSAGE("Personal path list OK");
}
}else
- if(MYDEBUG) MESSAGE("No personal catalog indicated or error while "
+ MESSAGE("No personal catalog indicated or error while "
"opening the personal catalog");
}
}
//----------------------------------------------------------------------
SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
{
- if(MYDEBUG) MESSAGE("Catalog Destruction");
+ MESSAGE("Catalog Destruction");
delete myPrivate;
}
//----------------------------------------------------------------------
char*
SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
- if(MYDEBUG) MESSAGE("Begin of GetPathPrefix");
+ MESSAGE("Begin of GetPathPrefix");
// Variables initialisation
std::string _path;
bool _find = false;
SALOME_ModuleCatalog::ListOfComponents*
SALOME_ModuleCatalogImpl::GetComponentList()
{
- if(MYDEBUG) MESSAGE("Begin of GetComponentList");
+ MESSAGE("Begin of GetComponentList");
SALOME_ModuleCatalog::ListOfComponents_var _list_components =
new SALOME_ModuleCatalog::ListOfComponents;
// All the components defined in the personal catalog are taken
for(unsigned int ind=0; ind < myPrivate->_personal_module_list.size();ind++){
_list_components[ind]=(myPrivate->_personal_module_list[ind].name).c_str();
- if(MYDEBUG) SCRUTE(_list_components[ind]) ;
+ SCRUTE(_list_components[ind]) ;
}
size_t indice = myPrivate->_personal_module_list.size();
_find = true;
}
if(!_find){
- if(MYDEBUG) MESSAGE("A new component " << myPrivate->_general_module_list[ind].name
+ MESSAGE("A new component " << myPrivate->_general_module_list[ind].name
<< " has to be to added in the list");
_list_components->length((CORBA::ULong)indice+1);
// The component is not already defined => has to be taken
_list_components[(CORBA::ULong)indice]=(myPrivate->_general_module_list[ind].name).c_str();
- if(MYDEBUG) SCRUTE(_list_components[(CORBA::ULong)indice]) ;
+ SCRUTE(_list_components[(CORBA::ULong)indice]) ;
indice++;
}else{
- if(MYDEBUG) MESSAGE("The component " <<myPrivate->_general_module_list[ind].name
+ MESSAGE("The component " <<myPrivate->_general_module_list[ind].name
<< " was already defined in the personal catalog") ;
}
}
- if(MYDEBUG) MESSAGE ( "End of GetComponentList" );
+ MESSAGE("End of GetComponentList");
return _list_components._retn();
}
SALOME_ModuleCatalog::ListOfIAPP_Affich*
SALOME_ModuleCatalogImpl::GetComponentIconeList()
{
- if(MYDEBUG) MESSAGE("Begin of GetComponentIconeList");
+ MESSAGE("Begin of GetComponentIconeList");
SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone =
new SALOME_ModuleCatalog::ListOfIAPP_Affich;
_list_components_icone[ind].moduleicone=(myPrivate->_personal_module_list[ind].icon).c_str();
_list_components_icone[ind].moduleversion=(myPrivate->_personal_module_list[ind].version).c_str();
_list_components_icone[ind].modulecomment=(myPrivate->_personal_module_list[ind].comment).c_str();
- //if(MYDEBUG) SCRUTE(_list_components_icone[ind].modulename);
- //if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
+ //SCRUTE(_list_components_icone[ind].modulename);
+ //SCRUTE(_list_components_icone[ind].moduleicone);
}
size_t indice = myPrivate->_personal_module_list.size();
_find = true;
}
if(!_find){
- // if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
_list_components_icone->length((CORBA::ULong)indice+1);
// The component is not already defined => has to be taken
_list_components_icone[(CORBA::ULong)indice].modulename=myPrivate->_general_module_list[ind].name.c_str();
_list_components_icone[(CORBA::ULong)indice].moduleicone=myPrivate->_general_module_list[ind].icon.c_str();
_list_components_icone[(CORBA::ULong)indice].moduleversion=myPrivate->_general_module_list[ind].version.c_str();
_list_components_icone[(CORBA::ULong)indice].modulecomment=myPrivate->_general_module_list[ind].comment.c_str();
- //if(MYDEBUG) SCRUTE(_list_components_icone[(CORBA::ULong)indice].modulename) ;
- //if(MYDEBUG) SCRUTE(_list_components_icone[(CORBA::ULong)indice].moduleicone);
+ //SCRUTE(_list_components_icone[(CORBA::ULong)indice].modulename) ;
+ //SCRUTE(_list_components_icone[(CORBA::ULong)indice].moduleicone);
indice++;
}
// else
- //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
+ //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
}
return _list_components_icone._retn() ;
SALOME_ModuleCatalog::ListOfComponents*
SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type)
{
- if(MYDEBUG) MESSAGE("Begin of GetTypedComponentList");
+ MESSAGE("Begin of GetTypedComponentList");
SALOME_ModuleCatalog::ListOfComponents_var _list_typed_component =
new SALOME_ModuleCatalog::ListOfComponents;
int _j = 0;
{
_list_typed_component->length(_j + 1);
_list_typed_component[_j] = myPrivate->_personal_module_list[ind].name.c_str();
- //if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
+ //SCRUTE(_list_typed_component[_j]);
_j++;
}
}
}
if (!_find)
{
- //if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
_list_typed_component->length(indice+1);
// The component is not already defined => has to be taken
_list_typed_component[indice]=(myPrivate->_general_module_list[ind].name).c_str();
- //if(MYDEBUG) SCRUTE(_list_typed_component[indice]) ;
+ //SCRUTE(_list_typed_component[indice]) ;
indice++;
}
//else
- //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
+ //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
}
}
else {
// Not found in the personal catalog and in the general catalog
// return NULL object
- if(MYDEBUG) MESSAGE("Component with name " << name
+ MESSAGE("Component with name " << name
<< " not found in catalog");
}
{
if (name.compare(_personal_module_list[ind].name) == 0)
{
- if(MYDEBUG) MESSAGE("Component named " << name
+ MESSAGE("Component named " << name
<< " found in the personal catalog");
C_parser = &(_personal_module_list[ind]);
break;
{
if (name.compare(_general_module_list[ind].name) == 0)
{
- // if(MYDEBUG) MESSAGE("Component named " << name
+ //MESSAGE("Component named " << name
// << " found in the general catalog");
C_parser = &(_general_module_list[ind]);
break;
ParserTypes& typeMap,
TypeList& typeList)
{
- if(MYDEBUG) BEGIN_OF("_parse_xml_file");
- if(MYDEBUG) SCRUTE(file);
+ BEGIN_OF("_parse_xml_file");
+ SCRUTE(file);
//Local path and module list for the file to parse
ParserPathPrefixes _pathList;
// duplicate service list
size_t _length = I_parser.services.size();
- // if(MYDEBUG) SCRUTE(_length);
+ // SCRUTE(_length);
// I_corba.interfaceservicelist
// = new SALOME_ModuleCatalog::ListOfInterfaceService;
I_corba.interfaceservicelist.length((CORBA::ULong)_length);
// duplicate out DataStreamParameters
_length = S_parser.outDataStreamParameters.size();
- // if(MYDEBUG) SCRUTE(_length);
+ // SCRUTE(_length);
S_corba.ServiceoutDataStreamParameter.length((CORBA::ULong)_length);
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
// duplicate parameter dependency
- if(MYDEBUG) SCRUTE(P_parser.dependency);
+ SCRUTE(P_parser.dependency);
P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
for (it_dep = DataStreamDepConvert.begin();
it_dep != DataStreamDepConvert.end();
break;
}
- if(MYDEBUG) SCRUTE(P_corba.Parameterdependency);
+ SCRUTE(P_corba.Parameterdependency);
}
//----------------------------------------------------------------------
{
if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
{
- if(MYDEBUG) MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list");
+ MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list");
_return_value = false;
}
}
path += splitPath[k];
}
- SCRUTE(path)
+ SCRUTE(path);
_current_context = ref_context ;
return strdup(path.c_str());
ASSERT(_SessionName) ;
ASSERT(strlen(_SessionName)>0) ;
- ASSERT(_reg.find(id)!=_reg.end())
+ ASSERT(_reg.find(id)!=_reg.end());
_reg[id]->_status=TERMINATED;
_reg[id]->_ts_end = (long)time(NULL) ; //!< TODO: conversation from time_t to long
ASSERT(_SessionName) ;
ASSERT(strlen(_SessionName)>0) ;
- ASSERT(_reg.find(id)!=_reg.end())
+ ASSERT(_reg.find(id)!=_reg.end());
_reg[id]->_ts_hello = (long)time(NULL) ; //!< TODO: conversation from time_t to long
END_OF("RegistryService::hello") ;
SetArgcArgv( argc, argv );
CORBA::ORB_var orb = KERNEL::GetRefToORB();
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- BEGIN_OF( argv[0] )
- INFOS_COMPILATION
- SCRUTE(argc)
+ BEGIN_OF( argv[0] );
+ INFOS_COMPILATION;
+ SCRUTE(argc);
if( argc<3 )
{
MESSAGE("you must provide the Salome session name when you call SALOME_Registry_Server") ;
}
catch( const SALOME_Exception &ex )
{
- MESSAGE( "Communication Error : " << ex.what() )
+ MESSAGE( "Communication Error : " << ex.what() );
return EXIT_FAILURE ;
}
SALOMEDSImpl_AttributeTreeNode* aResult = NULL;
DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label());
if (aLabel.IsNull()) {
- MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
- MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label");
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label");
return aResult;
}
if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) {
- MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
- MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute");
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute");
}
return aResult;
}
}
catch(HDFexception)
{
- MESSAGE( "HDFexception ! " )
+ MESSAGE("HDFexception ! ");
}
}
orb->destroy();
}
catch(CORBA::SystemException&) {
- MESSAGE("Caught CORBA::SystemException." )
+ MESSAGE("Caught CORBA::SystemException.");
}
catch(CORBA::Exception&) {
- MESSAGE( "Caught CORBA::Exception." )
+ MESSAGE("Caught CORBA::Exception.");
}
catch(omniORB::fatalException& fe) { //!< TODO: unused variable
- MESSAGE( "Caught omniORB::fatalException:" )
- MESSAGE( " file: " << fe.file() )
- MESSAGE( " line: " << fe.line() )
- MESSAGE( " mesg: " << fe.errmsg() )
+ MESSAGE("Caught omniORB::fatalException:");
+ MESSAGE(" file: " << fe.file());
+ MESSAGE(" line: " << fe.line());
+ MESSAGE(" mesg: " << fe.errmsg());
}
catch(...) {
- MESSAGE( "Caught unknown exception." )
+ MESSAGE("Caught unknown exception.");
}
return 0;
}
LocalTraceBufferPool.hxx
BaseTraceCollector.hxx
SALOME_LocalTrace.hxx
+ libSALOMELog.hxx
)
SET(SALOMELocalTrace_SOURCES
LocalTraceBufferPool.cxx
LocalTraceBufferPool.hxx
SALOME_LocalTrace.hxx
+ libSALOMELog.hxx
+ libSALOMELog.cxx
)
ADD_LIBRARY(SALOMELocalTrace ${SALOMELocalTrace_SOURCES})
--- /dev/null
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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, or (at your option) any later version.
+//
+// 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
+//
+
+// Author : Konstantin Leontev (OpenCascade)
+// Module : KERNEL
+// $Header$
+//
+
+#include "libSALOMELog.hxx"
+
+#include <string>
+#include <iostream>
+
+namespace SALOME
+{
+
+// ============================================================================
+/*!
+ * Called by any log message macros to decide about log output in Release and
+ * Debug mode dynamically rely on SALOME_VERBOSE environment variable.
+ * Checks SALOME_VERBOSE only on the very first call and returns cached result
+ * for all followed calls.
+ * Returns true if SALOME_VERBOSE is positioned and not empty and if its
+ * numeric value greater than 0.
+ */
+// ============================================================================
+
+ bool VerbosityActivated()
+ {
+ auto isEnvVarSet = []() -> bool
+ {
+ const char* envVar = std::getenv("SALOME_VERBOSE");
+
+ if (envVar && (envVar[0] != '\0'))
+ {
+ try
+ {
+ const long long numValue = std::stoll(envVar);
+ return numValue > 0;
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << e.what() << '\n';
+ }
+ }
+
+ return false;
+ };
+
+ static const bool isActivated = isEnvVarSet();
+ return isActivated;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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, or (at your option) any later version.
+//
+// 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 : libSALOMELog.hxx
+// Author : Konstantin Leontev (OpenCascade)
+// Module : KERNEL
+// $Header$
+//
+#ifndef _LIBSALOMELOG_HXX_
+#define _LIBSALOMELOG_HXX_
+
+#include "SALOME_LocalTrace.hxx"
+
+namespace SALOME
+{
+ bool SALOMELOCALTRACE_EXPORT VerbosityActivated();
+}
+
+#endif
#include "LocalTraceBufferPool.hxx"
+#include "libSALOMELog.hxx"
/*!
* For each message to put in the trace, a specific ostingstream object is
#error INFOS_COMPILATION already defined
#endif
-#if defined(_DEBUG_) || defined(_DEBUG)
+// --- the following MACROS can be enabled in debug and release versions
+// --- by SALOME_VERBOSE environment variable
-// --- the following MACROS are useful at debug time
-
-#define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
+#define INFOS_COMPILATION { if (SALOME::VerbosityActivated()) { MESS_BEGIN("COMPILED with ") << COMPILER \
<< ", " << __DATE__ \
- << " at " << __TIME__ << MESS_END }
+ << " at " << __TIME__ << MESS_END }}
+
-#define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
-#define SCRUTE(var) {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}
+#define MESSAGE(msg) { if (SALOME::VerbosityActivated()) {MESS_BEGIN("- Trace ") << msg << MESS_END}}
+#define SCRUTE(var) { if (SALOME::VerbosityActivated()) {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}}
#define REPERE ("------- ")
-#define BEGIN_OF(msg) {MESS_BEGIN(REPERE) << "Begin of: " << msg << MESS_END}
-#define END_OF(msg) {MESS_BEGIN(REPERE) << "Normal end of: " << msg << MESS_END}
+#define BEGIN_OF(msg) { if (SALOME::VerbosityActivated()) {MESS_BEGIN(REPERE) << "Begin of: " << msg << MESS_END}}
+#define END_OF(msg) { if (SALOME::VerbosityActivated()) {MESS_BEGIN(REPERE) << "Normal end of: " << msg << MESS_END}}
#ifndef ASSERT
#define ASSERT(condition) \
- if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")}
-#endif /* ASSERT */
-
-
-#else /* ifdef _DEBUG_*/
-
-#define INFOS_COMPILATION
-#define MESSAGE(msg) {}
-#define SCRUTE(var) {}
-#define REPERE
-#define BEGIN_OF(msg) {}
-#define END_OF(msg) {}
-
-#ifndef ASSERT
-#define ASSERT(condition) {}
+ { if (SALOME::VerbosityActivated()) { \
+ if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")} \
+ }}
#endif /* ASSERT */
-#endif /* ifdef _DEBUG_*/
-
#endif /* ifndef UTILITIES_H */
# include "LocalTraceBufferPool.hxx"
void Nettoyage();
-#ifdef _DEBUG_
-// static int MYDEBUG = 0;
-#else
-// static int MYDEBUG = 0;
-#endif
-
std::list<DESTRUCTEUR_GENERIQUE_*> *DESTRUCTEUR_GENERIQUE_::Destructeurs=0 ;
/*! \class ATEXIT_
void Nettoyage( void )
{
//cerr << "Nettoyage()" << endl;
- //if(MYDEBUG) BEGIN_OF("Nettoyage( void )") ;
+ //BEGIN_OF("Nettoyage( void )") ;
assert(DESTRUCTEUR_GENERIQUE_::Destructeurs) ;
- //if(MYDEBUG) SCRUTE( DESTRUCTEUR_GENERIQUE_::Destructeurs->size() ) ;
+ //SCRUTE( DESTRUCTEUR_GENERIQUE_::Destructeurs->size() ) ;
if( DESTRUCTEUR_GENERIQUE_::Destructeurs->size() )
{
std::list<DESTRUCTEUR_GENERIQUE_*>::iterator it = DESTRUCTEUR_GENERIQUE_::Destructeurs->end() ;
do
{
- //if(MYDEBUG) MESSAGE( "DESTRUCTION d'un SINGLETON");
+ //MESSAGE( "DESTRUCTION d'un SINGLETON");
it-- ;
DESTRUCTEUR_GENERIQUE_* ptr = *it ;
//DESTRUCTEUR_GENERIQUE_::Destructeurs->remove( *it ) ;
}while( it!= DESTRUCTEUR_GENERIQUE_::Destructeurs->begin() ) ;
DESTRUCTEUR_GENERIQUE_::Destructeurs->clear() ;
- //if(MYDEBUG) SCRUTE( DESTRUCTEUR_GENERIQUE_::Destructeurs->size() ) ;
+ //SCRUTE( DESTRUCTEUR_GENERIQUE_::Destructeurs->size() ) ;
assert( DESTRUCTEUR_GENERIQUE_::Destructeurs->size()==0 ) ;
assert( DESTRUCTEUR_GENERIQUE_::Destructeurs->empty() ) ;
}
delete DESTRUCTEUR_GENERIQUE_::Destructeurs;
DESTRUCTEUR_GENERIQUE_::Destructeurs=0;
- //if(MYDEBUG) END_OF("Nettoyage( void )") ;
+ //END_OF("Nettoyage( void )") ;
return ;
}