From 832cc15e0ce6f2db6477850f9f076bfad6d3753b Mon Sep 17 00:00:00 2001 From: fayolle Date: Thu, 22 Mar 2007 14:24:04 +0000 Subject: [PATCH] =?utf8?q?Ajout=20des=20properties=20Cr=C3=A9ation=20de=20?= =?utf8?q?la=20classe=20calcium=5Fprovides=5Fport=20(pour=20appeler=20dire?= =?utf8?q?ctement=20les=20m=C3=A9thodes=20de=20param=C3=A9trage=20des=20po?= =?utf8?q?rts=20calcium)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../Calcium/CalciumCouplingPolicy.cxx | 45 +++-- .../Calcium/CalciumCouplingPolicy.hxx | 6 +- .../Calcium/CalciumGenericProvidesPort.hxx | 165 ++++++++++++++++-- .../Calcium/CalciumProvidesPort.cxx | 14 ++ .../Calcium/CalciumProvidesPort.hxx | 38 ++++ .../Datastream/Calcium/CalciumTypes.hxx | 4 +- .../Calcium/CalciumTypes2CorbaTypes.cxx | 131 ++++++++++++++ .../Calcium/CalciumTypes2CorbaTypes.hxx | 62 +++++++ .../Calcium/CorbaTypes2CalciumTypes.cxx | 130 ++++++++++++++ .../Calcium/CorbaTypes2CalciumTypes.hxx | 62 +++++++ .../DSC_User/Datastream/Calcium/Makefile.am | 10 +- .../calcium_destructors_port_provides.cxx | 32 ---- .../Calcium/calcium_port_factory.hxx | 2 +- .../Calcium/calcium_port_provides.hxx | 61 ------- .../Calcium/calcium_provides_port.cxx | 10 ++ .../Calcium/calcium_provides_port.hxx | 48 +++++ .../Calcium/test_DataIdContainer.cxx | 2 +- src/DSC/DSC_User/Datastream/GenericPort.hxx | 8 +- .../Datastream/GenericProvidesPort.hxx | 26 +++ .../DSC_User/Datastream/GenericUsesPort.hxx | 5 +- src/DSC/DSC_User/Datastream/Makefile.am | 1 + src/DSC/DSC_User/Makefile.am | 3 +- src/DSC/DSC_User/Superv_Component_i.hxx | 2 +- src/DSC/DSC_User/base_port.cxx | 18 ++ src/DSC/DSC_User/base_port.hxx | 21 ++- src/DSC/DSC_User/provides_port.cxx | 14 +- src/DSC/DSC_User/provides_port.hxx | 11 -- src/DSC/DSC_User/uses_port.cxx | 18 +- src/DSC/DSC_User/uses_port.hxx | 13 +- 29 files changed, 768 insertions(+), 194 deletions(-) create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx delete mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_provides.cxx delete mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_port_provides.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx create mode 100644 src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx create mode 100644 src/DSC/DSC_User/base_port.cxx diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx index 1cd068ca1..616936534 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx @@ -35,50 +35,56 @@ CalciumCouplingPolicy::CalciumCouplingPolicy():_dependencyType(CalciumTypes::UND _disconnectDirective(CalciumTypes::UNDEFINED_DIRECTIVE){}; void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType dependencyType) {_dependencyType=dependencyType;} -CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} +CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) { - if ( storageLevel < 1 ) + if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) ) throw DATASTREAM_EXCEPTION(LOC("Un niveau < 1 n'est pas autorisé")); _storageLevel = storageLevel; } size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;} void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) - throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner un schéma temporel sur un port en dépendance itérative")); + throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle")); _dateCalSchem = dateCalSchem; } -CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { - if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) - throw DATASTREAM_EXCEPTION(LOC("Un schéma temporel sur un port en dépendance itérative n'a pas de sens")); - return _dateCalSchem; -} +CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; } void CalciumCouplingPolicy::setAlpha(double alpha) { if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) - throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner alpha sur un port en dépendance itérative")); + throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle")); if ( 0 <= alpha <= 1 ) _alpha = alpha; else throw DATASTREAM_EXCEPTION(LOC("Le paramètre alpha doit être compris entre [0,1]")); } -double CalciumCouplingPolicy::getAlpha() const { - if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) - throw DATASTREAM_EXCEPTION(LOC("Le paramètre alpha sur un port en dépendance itérative n'a pas de sens")); - return _alpha; -} +double CalciumCouplingPolicy::getAlpha() const { return _alpha; } void CalciumCouplingPolicy::setDeltaT(double deltaT ) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw DATASTREAM_EXCEPTION(LOC("Le paramètre deltaT sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); if ( 0 <= deltaT <= 1 ) _deltaT = deltaT; else throw(DATASTREAM_EXCEPTION(LOC("Le paramètre deltaT doit être compris entre [0,1]"))); } -double CalciumCouplingPolicy::getdeltaT() const {return _deltaT;} +double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;} + +void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw DATASTREAM_EXCEPTION(LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); + _interpolationSchem=interpolationSchem; +} + +void CalciumCouplingPolicy::setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw DATASTREAM_EXCEPTION(LOC("Le paramètre ExtrapolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); +_extrapolationSchem=extrapolationSchem; +} -void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) {_interpolationSchem=interpolationSchem;} -void CalciumCouplingPolicy::setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) {_extrapolationSchem=extrapolationSchem;} +CalciumTypes::InterpolationSchem CalciumCouplingPolicy::getInterpolationSchem () const { return _interpolationSchem; }; +CalciumTypes::ExtrapolationSchem CalciumCouplingPolicy::getExtrapolationSchem () const { return _extrapolationSchem; }; CalciumCouplingPolicy::TimeType @@ -92,6 +98,7 @@ CalciumCouplingPolicy::getEffectiveTime(CalciumCouplingPolicy::TimeType ti, } void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) { + // TODO Réveiller les ports en attente ! OU timeout ? if (provideLastGivenValue) { std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl; _disconnectDirective = CalciumTypes::CONTINUE; @@ -99,4 +106,8 @@ void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) { std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl; _disconnectDirective = CalciumTypes::STOP; } + +// if (waitingForAnyDataId || waitingForConvenientDataId); +// cond_instance.signal(); + } diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index 3dd41f4dd..f1f15d118 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -79,10 +79,12 @@ public: double getAlpha() const ; void setDeltaT(double deltaT ); - double getdeltaT() const ; + double getDeltaT() const ; void setInterpolationSchem (InterpolationSchem interpolationSchem); void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem); + InterpolationSchem getInterpolationSchem () const ; + ExtrapolationSchem getExtrapolationSchem () const ; // Classe DataId rassemblant les paramètres de la méthode PORT::put // qui identifient l'instance d'une donnée pour Calcium @@ -284,7 +286,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co return isEqual || isBounded; } - +// PAS ENCORE TESTE AVEC UN NIVEAU POSITIONNE // Supprime les DataId et les données associées // du container associative quand le nombre // de données stockées dépasse le niveau CALCIUM. diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx index f39310e70..e10e1dac3 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx @@ -27,37 +27,86 @@ #ifndef _CALCIUM_GENERIC_PROVIDES_PORT_HXX_ #define _CALCIUM_GENERIC_PROVIDES_PORT_HXX_ -//include utile ? : -#include "Calcium_Ports.hh" +#include "PortProperties_i.hxx" -#include "provides_port.hxx" +#include "calcium_provides_port.hxx" -#include "GenericPort.hxx" +#include "GenericProvidesPort.hxx" #include "CalciumCouplingPolicy.hxx" -// TODO: Creer un trait qui à partir de CorbaInterface déduit CorbaDataManipulator +#include "CorbaTypes2CalciumTypes.hxx" +#include "CalciumTypes2CorbaTypes.hxx" + +#include "DSC_Exception.hxx" +#include + +// +// Cette macro CPP remplace une déclaration : template +// mais permet surtout de générer différentes classes (dont le nom est spécifié par specificPortName ) +// +// Variante: Creer un trait qui à partir de CorbaInterface déduit CorbaDataManipulator // et simplifier la classe - // -// Avant d'utiliser la macro : template -// -// utilisation de __VA_ARGS__ au lieu de CorbaDataManipulator car à l'appel de la -// macro le token du troisième argument contient une virgule qui est considéré comme -// séparateur d'argument par le PP -#define CALCIUM_GENERIC_PROVIDES_PORT(specificPortName,CorbaInterface,...) \ +// L'utilisation conjointe du paramètre ... et de __VA_ARGS__ au lieu d'un 'CorbaDataManipulator' permet +// d'invoquer la macro avec un troisième token contenant une virgule +// (qui est considéré comme un séparateur d'argument par le PP ) + +#define CALCIUM_GENERIC_PROVIDES_PORT_HXX(specificPortName,CorbaInterface,...) \ class specificPortName : public virtual CorbaInterface , \ - public virtual provides_port, \ - public GenericPort< __VA_ARGS__ , CalciumCouplingPolicy > { \ + public virtual POA_Ports::PortProperties, \ + public GenericProvidesPort< __VA_ARGS__ , CalciumCouplingPolicy, calcium_provides_port > { \ public : \ typedef __VA_ARGS__ DataManipulator; \ typedef DataManipulator::Type CorbaDataType; \ typedef GenericPort< DataManipulator , \ - CalciumCouplingPolicy > Port; \ + CalciumCouplingPolicy > Port; \ \ virtual ~ specificPortName (); \ \ inline void disconnect(bool provideLastGivenValue) { \ Port::disconnect(provideLastGivenValue); \ + } \ + inline void setDependencyType(CalciumTypes::DependencyType dependencyType) { \ + Port::setDependencyType(dependencyType); \ + } \ + inline CalciumTypes::DependencyType getDependencyType () const { \ + return Port::getDependencyType(); \ + } \ + inline void setStorageLevel (size_t storageLevel) { \ + Port::setStorageLevel(storageLevel); \ + } \ + inline size_t getStorageLevel () const { \ + return Port::getStorageLevel(); \ + } \ + inline void setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { \ + Port::setDateCalSchem (dateCalSchem); \ + } \ + inline CalciumTypes::DateCalSchem getDateCalSchem () const { \ + return Port::getDateCalSchem (); \ + } \ + inline void setAlpha(double alpha) { \ + Port::setAlpha(alpha); \ + } \ + inline double getAlpha() const { \ + return Port::getAlpha(); \ + } \ + inline void setDeltaT(double deltaT ) { \ + Port::setDeltaT(deltaT); \ + } \ + inline double getDeltaT() const { \ + return Port::getDeltaT(); \ + } \ + inline void setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { \ + Port::setInterpolationSchem(interpolationSchem); \ + } \ + inline void setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) { \ + Port::setExtrapolationSchem(extrapolationSchem); \ + } \ + inline CalciumTypes::InterpolationSchem getInterpolationSchem() const { \ + return Port::getInterpolationSchem(); \ + } \ + inline CalciumTypes::ExtrapolationSchem getExtrapolationSchem() const { \ + return Port::getExtrapolationSchem(); \ } \ \ inline void put( DataManipulator::CorbaInType data, \ @@ -68,7 +117,93 @@ inline Ports::Port_ptr get_port_ref() { \ return _this(); \ } \ + \ + Ports::PortProperties_ptr get_port_properties() { \ + return POA_Ports::PortProperties::_this(); \ + } \ + \ + virtual void set_property(const char * name, const CORBA::Any& value) \ + throw (Ports::NotDefined, Ports::BadType, Ports::BadValue); \ + \ + virtual CORBA::Any* get_property(const char* name) \ + throw (Ports::NotDefined); \ + \ }; \ + + +#define CALCIUM_GENERIC_PROVIDES_PORT_CXX(specificPortName) \ + \ + specificPortName::~specificPortName(void) {}; \ + \ + void specificPortName::set_property(const char * name, const CORBA::Any& value) \ + throw (Ports::NotDefined, Ports::BadType, Ports::BadValue) { \ + \ + const std::string key(name); \ + CORBA::Long sl; \ + CORBA::Double alpha,delta; \ + Ports::Calcium_Ports::DependencyType dt; \ + Ports::Calcium_Ports::DateCalSchem dcs; \ + Ports::Calcium_Ports::InterpolationSchem is; \ + Ports::Calcium_Ports::ExtrapolationSchem es; \ + bool ok=false; \ + \ + try { \ + \ + if (key == "StorageLevel" ) \ + {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \ + else if (key == "Alpha" ) \ + {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \ + else if (key == "DeltaT" ) \ + {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \ + else if (key == "DependencyType" ) \ + {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \ + else if (key == "DateCalSchem" ) \ + {if ( ok=(value >>= dcs) ) \ + Port::setDateCalSchem(dateCalSchem[dcs]);} \ + else if (key == "InterpolationSchem") \ + {if ( ok=(value >>= is) ) \ + Port::setInterpolationSchem(interpolationSchem[is]);} \ + else if (key == "ExtrapolationSchem") \ + {if ( ok=(value >>= es) ) \ + Port::setExtrapolationSchem(extrapolationSchem[es]);} \ + else \ + throw Ports::NotDefined(); \ + if (!ok) throw Ports::BadType(); \ + \ + } catch ( const DSC_Exception & ex ) { \ + \ + std::cerr << ex.what() << std::endl; \ + throw Ports::BadValue(); \ + } \ + } \ + \ + \ + CORBA::Any* specificPortName::get_property(const char* name) \ + throw (Ports::NotDefined) { \ + const std::string key(name); \ + CORBA::Any* value=new CORBA::Any; \ + if (key == "StorageLevel" ) \ + { (*value) <<= static_cast(Port::getStorageLevel()); } \ + else if (key == "Alpha" ) \ + { *value <<= (CORBA::Double) Port::getAlpha();} \ + else if (key == "DeltaT" ) \ + { *value <<= (CORBA::Double) Port::getDeltaT();} \ + else if (key == "DependencyType" ) \ + { *value <<= corbaDependencyType[Port::getDependencyType()];} \ + else if (key == "DateCalSchem" ) \ + { *value <<= corbaDateCalSchem[Port::getDateCalSchem()];} \ + else if (key == "InterpolationSchem") \ + { *value <<= corbaInterpolationSchem[Port::getInterpolationSchem()];} \ + else if (key == "ExtrapolationSchem") \ + { *value <<= corbaExtrapolationSchem[Port::getExtrapolationSchem()];} \ + else { \ + delete value; \ + throw Ports::NotDefined(); \ + } \ + return value; \ + }; + + #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx new file mode 100644 index 000000000..6ada79b9a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx @@ -0,0 +1,14 @@ +#include "CalciumProvidesPort.hxx" + + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_complex_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_logical_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_string_port_provides) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx new file mode 100644 index 000000000..075132663 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx @@ -0,0 +1,38 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_PORT_PROVIDES_HXX_ +#define _CALCIUM_PORT_PROVIDES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumGenericProvidesPort.hxx" +#include "CalciumCouplingPolicy.hxx" + + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Integer_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Real_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Double_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Complex_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Logical_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_String_Port, \ + seq_u_manipulation ) \ + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx index 4e0c8dfef..62fdd86d6 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx @@ -66,7 +66,9 @@ namespace CalciumTypes { const int UNLIMITED_STORAGE_LEVEL = CP_ILLIMITE; typedef enum {UNDEFINED_DEPENDENCY=CPIT,TIME_DEPENDENCY=CP_TEMPS, ITERATION_DEPENDENCY=CP_ITERATION, - SEQUENCE_DEPENDENCY =CP_SEQUENTIEL } DependencyType; + // TYPE uniquement utilisé ds CalciumInterface + SEQUENCE_DEPENDENCY =CP_SEQUENTIEL + } DependencyType; typedef enum {TI_SCHEM=TI,TF_SCHEM=TF,ALPHA_SCHEM} DateCalSchem; typedef enum {L0_SCHEM=CP_ESCALIER,L1_SCHEM=CP_LINEAIRE} InterpolationSchem; typedef enum {UNDEFINED_EXTRA_SCHEM,E0_SCHEM,E1_SCHEM} ExtrapolationSchem; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx new file mode 100644 index 000000000..0425a6baf --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx @@ -0,0 +1,131 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#include "CalciumTypes2CorbaTypes.hxx" +#include + +using namespace std; + +CORBA_DATE_CAL_SCHEM::CORBA_DATE_CAL_SCHEM() : map() +{ + map & + table = ( map & ) *this ; + +table[CalciumTypes::TI_SCHEM ] = Ports::Calcium_Ports::TI_SCHEM ; +table[CalciumTypes::TF_SCHEM ] = Ports::Calcium_Ports::TF_SCHEM ; +table[CalciumTypes::ALPHA_SCHEM ] = Ports::Calcium_Ports::ALPHA_SCHEM ; +} + + +Ports::Calcium_Ports::DateCalSchem CORBA_DATE_CAL_SCHEM::operator[]( const CalciumTypes::DateCalSchem &c ) const +{ + map &table = (map&)*this ; + assert( table.find( (CalciumTypes::DateCalSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::DateCalSchem)c ] ; +} + +const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ; + + + +CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map() +{ + map & + table = ( map & ) *this ; + +table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ; +table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ; +table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ; + + +std::cout << "CORBA_DEPENDENCY_TYPE() : table["< & + table = (map& ) *this ; + +std::cout << "CORBA_DEPENDENCY_TYPE() : ::operator["< () +{ + map & + table = ( map & ) *this ; + + table[CalciumTypes::L0_SCHEM ] = Ports::Calcium_Ports::L0_SCHEM ; + table[CalciumTypes::L1_SCHEM ] = Ports::Calcium_Ports::L1_SCHEM ; +} + + +Ports::Calcium_Ports::InterpolationSchem CORBA_INTERPOLATION_SCHEM::operator[]( const CalciumTypes::InterpolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (CalciumTypes::InterpolationSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::InterpolationSchem)c ] ; +} + +const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ; + + + +CORBA_EXTRAPOLATION_SCHEM::CORBA_EXTRAPOLATION_SCHEM() : map () +{ + map & + table = ( map & ) *this ; + + table[CalciumTypes::E0_SCHEM ] = Ports::Calcium_Ports::E0_SCHEM ; + table[CalciumTypes::E1_SCHEM ] = Ports::Calcium_Ports::E1_SCHEM ; + table[CalciumTypes::UNDEFINED_EXTRA_SCHEM ] = Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ; +} + + +Ports::Calcium_Ports::ExtrapolationSchem CORBA_EXTRAPOLATION_SCHEM::operator[]( const CalciumTypes::ExtrapolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (CalciumTypes::ExtrapolationSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::ExtrapolationSchem)c ] ; +} + +const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx new file mode 100644 index 000000000..9f1d1f5b6 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx @@ -0,0 +1,62 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CALCIUMTYPES_TO_CORBATYPES_HXX_ +#define _CALCIUMTYPES_TO_CORBATYPES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumTypes.hxx" + +#include +#include + + +class CORBA_DATE_CAL_SCHEM : public std::map +{ +public : + + CORBA_DATE_CAL_SCHEM(); + Ports::Calcium_Ports::DateCalSchem operator[]( const CalciumTypes::DateCalSchem &c ) const; +}; + + +extern const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ; + +class CORBA_DEPENDENCY_TYPE : public std::map +{ +public : + + CORBA_DEPENDENCY_TYPE(); + Ports::Calcium_Ports::DependencyType operator[]( const CalciumTypes::DependencyType &c ) const; +}; + +extern const CORBA_DEPENDENCY_TYPE corbaDependencyType ; + +class CORBA_INTERPOLATION_SCHEM : public std::map +{ +public : + + CORBA_INTERPOLATION_SCHEM(); + Ports::Calcium_Ports::InterpolationSchem operator[]( const CalciumTypes::InterpolationSchem &c ) const; +} ; + +extern const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ; + +class CORBA_EXTRAPOLATION_SCHEM : public std::map +{ +public : + + CORBA_EXTRAPOLATION_SCHEM(); + Ports::Calcium_Ports::ExtrapolationSchem operator[]( const CalciumTypes::ExtrapolationSchem &c ) const; +} ; + +extern const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx new file mode 100644 index 000000000..1789bcf63 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx @@ -0,0 +1,130 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#include "CorbaTypes2CalciumTypes.hxx" +#include + +using namespace std; + +DATE_CAL_SCHEM::DATE_CAL_SCHEM() : map() +{ + map & + table = ( map & ) *this ; + +table[Ports::Calcium_Ports::TI_SCHEM ] = CalciumTypes::TI_SCHEM ; +table[Ports::Calcium_Ports::TF_SCHEM ] = CalciumTypes::TF_SCHEM ; +table[Ports::Calcium_Ports::ALPHA_SCHEM ] = CalciumTypes::ALPHA_SCHEM ; +} + + +CalciumTypes::DateCalSchem DATE_CAL_SCHEM::operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const +{ + map &table = (map&)*this ; + assert( table.find( (Ports::Calcium_Ports::DateCalSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::DateCalSchem)c ] ; +} + +const DATE_CAL_SCHEM dateCalSchem ; + + + +DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map() +{ + map & + table = ( map & ) *this ; + +table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ; +table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ; +table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ; + + +std::cout << "DEPENDENCY_TYPE() : table["< &table = (map&)*this ; + +std::cout << "DEPENDENCY_TYPE() : ::operator["< () +{ + map & + table = ( map & ) *this ; + + table[Ports::Calcium_Ports::L0_SCHEM ] = CalciumTypes::L0_SCHEM ; + table[Ports::Calcium_Ports::L1_SCHEM ] = CalciumTypes::L1_SCHEM ; +} + + +CalciumTypes::InterpolationSchem INTERPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (Ports::Calcium_Ports::InterpolationSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::InterpolationSchem)c ] ; +} + +const INTERPOLATION_SCHEM interpolationSchem ; + + + +EXTRAPOLATION_SCHEM::EXTRAPOLATION_SCHEM() : map () +{ + map & + table = ( map & ) *this ; + + table[Ports::Calcium_Ports::E0_SCHEM ] = CalciumTypes::E0_SCHEM ; + table[Ports::Calcium_Ports::E1_SCHEM ] = CalciumTypes::E1_SCHEM ; + table[Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ] = CalciumTypes::UNDEFINED_EXTRA_SCHEM ; +} + + +CalciumTypes::ExtrapolationSchem EXTRAPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (Ports::Calcium_Ports::ExtrapolationSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::ExtrapolationSchem)c ] ; +} + +const EXTRAPOLATION_SCHEM extrapolationSchem ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx new file mode 100644 index 000000000..c9701863b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx @@ -0,0 +1,62 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CORBATYPES_TO_CALCIUMTYPES_HXX_ +#define _CORBATYPES_TO_CALCIUMTYPES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumTypes.hxx" + +#include +#include + + +class DATE_CAL_SCHEM : public std::map +{ +public : + + DATE_CAL_SCHEM(); + CalciumTypes::DateCalSchem operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const; +}; + + +extern const DATE_CAL_SCHEM dateCalSchem ; + +class DEPENDENCY_TYPE : public std::map +{ +public : + + DEPENDENCY_TYPE(); + CalciumTypes::DependencyType operator[]( const Ports::Calcium_Ports::DependencyType &c ) const; +}; + +extern const DEPENDENCY_TYPE dependencyType ; + +class INTERPOLATION_SCHEM : public std::map +{ +public : + + INTERPOLATION_SCHEM(); + CalciumTypes::InterpolationSchem operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const; +} ; + +extern const INTERPOLATION_SCHEM interpolationSchem ; + +class EXTRAPOLATION_SCHEM : public std::map +{ +public : + + EXTRAPOLATION_SCHEM(); + CalciumTypes::ExtrapolationSchem operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const; +} ; + +extern const EXTRAPOLATION_SCHEM extrapolationSchem ; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am index 69587cb2d..2b8416bb3 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am @@ -33,10 +33,13 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # # header files salomeinclude_HEADERS = calcium_port_factory.hxx \ + CorbaTypes2CalciumTypes.hxx \ + CalciumTypes2CorbaTypes.hxx \ CalciumGenericProvidesPort.hxx \ calcium_uses_port.hxx \ CalciumGenericUsesPort.hxx \ - calcium_port_provides.hxx \ + calcium_provides_port.hxx \ + CalciumProvidesPort.hxx \ calcium_integer_port_uses.hxx \ calcium_real_port_uses.hxx \ calcium_double_port_uses.hxx \ @@ -82,9 +85,12 @@ noinst_LTLIBRARIES = libSalomeCalcium.la libSalomeCalcium_la_SOURCES = calcium_port_factory.cxx \ calcium_uses_port.cxx \ + calcium_provides_port.cxx\ calcium_repository_types.cxx \ CalciumCouplingPolicy.cxx \ - calcium_destructors_port_provides.cxx \ + CorbaTypes2CalciumTypes.cxx \ + CalciumTypes2CorbaTypes.cxx \ + CalciumProvidesPort.cxx \ calcium_destructors_port_uses.cxx libSalomeCalcium_la_CXXFLAGS = $(COMMON_CPPFLAGS) diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_provides.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_provides.cxx deleted file mode 100644 index 841a2105c..000000000 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_provides.cxx +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 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. -// -// 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 : calcium_destructors_port_provides.cxx -// Author : Eric Fayolle (EDF) -// Module : KERNEL -#include "calcium_port_provides.hxx" - -calcium_real_port_provides::~calcium_real_port_provides(void) {}; -calcium_double_port_provides::~calcium_double_port_provides(void) {}; -calcium_integer_port_provides::~calcium_integer_port_provides(void) {}; -calcium_logical_port_provides::~calcium_logical_port_provides(void) {}; -calcium_complex_port_provides::~calcium_complex_port_provides(void) {}; -calcium_string_port_provides::~calcium_string_port_provides(void) {}; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx index ccf076d3a..a722cd966 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx @@ -34,7 +34,7 @@ #include "provides_port.hxx" #include -#include "calcium_port_provides.hxx" +#include "CalciumProvidesPort.hxx" #include "calcium_integer_port_uses.hxx" #include "calcium_real_port_uses.hxx" diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_provides.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_provides.hxx deleted file mode 100644 index 5c18fb078..000000000 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_provides.hxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 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. -// -// 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 : calcium_port_provides.hxx -// Author : Eric Fayolle (EDF) -// Module : KERNEL -// Modified by : $LastChangedBy$ -// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (jeu, 01 mar 2007) $ -// Id : $Id$ - -#ifndef _CALCIUM_PORT_PROVIDES_HXX_ -#define _CALCIUM_PORT_PROVIDES_HXX_ - -#include "Calcium_Ports.hh" -#include "CalciumGenericProvidesPort.hxx" -#include "CalciumCouplingPolicy.hxx" - - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_integer_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Integer_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_real_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Real_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_double_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Double_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_complex_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Complex_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_logical_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Logical_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT(calcium_string_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_String_Port, \ - seq_u_manipulation ) \ - -#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx new file mode 100644 index 000000000..6f34c26b7 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx @@ -0,0 +1,10 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#include "calcium_provides_port.hxx" + +calcium_provides_port::calcium_provides_port() {} + +calcium_provides_port::~calcium_provides_port() {} diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx new file mode 100644 index 000000000..52bf881e8 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx @@ -0,0 +1,48 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_PROVIDES_PORT_HXX_ +#define _CALCIUM_PROVIDES_PORT_HXX_ + +#include "provides_port.hxx" +#include "CalciumTypes.hxx" + +class calcium_provides_port : public provides_port +{ +public : + + typedef CalciumTypes::DependencyType DependencyType; + typedef CalciumTypes::DateCalSchem DateCalSchem; + typedef CalciumTypes::InterpolationSchem InterpolationSchem; + typedef CalciumTypes::ExtrapolationSchem ExtrapolationSchem; + typedef CalciumTypes::DisconnectDirective DisconnectDirective; + + calcium_provides_port(); + virtual ~calcium_provides_port(); + + virtual void setDependencyType (DependencyType dependencyType) =0; + virtual DependencyType getDependencyType () const =0; + + virtual void setStorageLevel (size_t storageLevel) =0; + virtual size_t getStorageLevel () const =0; + + virtual void setDateCalSchem (DateCalSchem dateCalSchem) =0; + virtual DateCalSchem getDateCalSchem () const =0; + + virtual void setAlpha(double alpha) =0; + virtual double getAlpha() const =0; + + virtual void setDeltaT(double deltaT ) =0; + virtual double getDeltaT() const =0; + + virtual void setInterpolationSchem (InterpolationSchem interpolationSchem) =0; + virtual void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem) =0; + virtual InterpolationSchem getInterpolationSchem () const =0; + virtual ExtrapolationSchem getExtrapolationSchem () const =0; + +}; + +#endif + diff --git a/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx b/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx index d09f9053b..8428f25ee 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx @@ -28,7 +28,7 @@ #include "CalciumCouplingPolicy.hxx" -#include "calcium_port_provides.hxx" +#include "CalciumProvidesPort.hxx" #include "DatastreamException.hxx" using namespace CalciumTypes; diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx index 8becd65c3..bab981f03 100644 --- a/src/DSC/DSC_User/Datastream/GenericPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -281,7 +281,7 @@ void GenericPort::put(CorbaInDataType dataPara // ( n'effectue pas de recopie de la donnée trouvée dans storedDatas ) // ( L'utilisateur devra être attentif à la politique de gestion de l'historique // spécifique au mode de couplage car il peut y avoir une suppression potentielle -// d'une donnée utilisée directement au code utilisateur ) +// d'une donnée utilisée directement dans le code utilisateur ) // Le code doit prendre connaissance du transfert de propriété ou non des données // auprès du mode de couplage choisi. template < typename DataManipulator, typename COUPLING_POLICY > @@ -416,8 +416,10 @@ GenericPort::get(TimeType time, storedDatas_mutex.unlock(); std::cout << "-------- Get : MARK 13 ------------------" << std::endl; - // dataToTransmit est positionné par la méthode put - // La propriété de la données est transmise à l'utilisateur + // 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 des niveaux return dataToTransmit; } diff --git a/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx new file mode 100644 index 000000000..16da2682f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx @@ -0,0 +1,26 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#ifndef _GENERIC_PROVIDES_PORT_HXX_ +#define _GENERIC_PROVIDES_PORT_HXX_ + +#include "provides_port.hxx" +#include "GenericPort.hxx" + + +template +class GenericProvidesPort : public ProvidesPort, + public GenericPort< DataManipulator , CouplingPolicy > { +public : + // Type de données manipulés + typedef typename DataManipulator::Type DataType; + typedef typename DataManipulator::CorbaInType CorbaInDataType; + + virtual ~GenericProvidesPort() {}; + +}; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx index a85721af6..95d23f280 100644 --- a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx @@ -43,7 +43,7 @@ //ex : GENERATE_USES_PORT(Ports::Data_Short_Port,data_short_port); template -class GenericUsesPort : public virtual UsesPort +class GenericUsesPort : public UsesPort { public : // Type de données manipulés @@ -88,12 +88,15 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::set size_t n = _my_ports->length()+1; _my_ports->length(n); (*_my_ports)[n]=CorbaPortType::_narrow(port); + return true; } else { // Vérifier si port is_nil _my_ports = new Engines::DSC::uses_port(); _my_ports->length(1); (*_my_ports)[0]=CorbaPortType::_narrow(port); + return true; } + return false; } template diff --git a/src/DSC/DSC_User/Datastream/Makefile.am b/src/DSC/DSC_User/Datastream/Makefile.am index 1dcd8398a..9aa857d5e 100644 --- a/src/DSC/DSC_User/Datastream/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Makefile.am @@ -34,6 +34,7 @@ SUBDIRS = Palm Calcium # # header files salomeinclude_HEADERS = GenericPort.hxx \ + GenericProvidesPort.hxx \ GenericUsesPort.hxx \ DataIdFilter.hxx \ CorbaTypeManipulator.hxx \ diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am index 07df31b52..7ea4dca88 100644 --- a/src/DSC/DSC_User/Makefile.am +++ b/src/DSC/DSC_User/Makefile.am @@ -70,7 +70,8 @@ COMMON_LIBS = # lib_LTLIBRARIES = libSalomeDSCSuperv.la -libSalomeDSCSuperv_la_SOURCES = uses_port.cxx \ +libSalomeDSCSuperv_la_SOURCES = base_port.cxx \ + uses_port.cxx \ provides_port.cxx \ Superv_Component_i.cxx diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index f7ea45fa8..37a34640e 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -67,7 +67,7 @@ public: virtual ~Superv_Component_i(); // Exceptions declarations. - // There are also declared on the Superv_Component_i.cxx to avoid problems + // There are defined on the Superv_Component_i.cxx to avoid problems // from dlopen. DSC_EXCEPTION(BadFabType); DSC_EXCEPTION(BadType); diff --git a/src/DSC/DSC_User/base_port.cxx b/src/DSC/DSC_User/base_port.cxx new file mode 100644 index 000000000..a944500fc --- /dev/null +++ b/src/DSC/DSC_User/base_port.cxx @@ -0,0 +1,18 @@ +#include "base_port.hxx" + + +base_port::base_port() +{ + default_properties = new PortProperties_i(); +} + +base_port::~base_port() +{ + delete default_properties; +} + +Ports::PortProperties_ptr +base_port::get_port_properties() +{ + return default_properties->_this(); +} diff --git a/src/DSC/DSC_User/base_port.hxx b/src/DSC/DSC_User/base_port.hxx index c3d7bb6c3..eed215e04 100644 --- a/src/DSC/DSC_User/base_port.hxx +++ b/src/DSC/DSC_User/base_port.hxx @@ -26,15 +26,26 @@ #ifndef _PORT_HXX_ #define _PORT_HXX_ -/*! \class base_port - * \brief This class is the base class of DSC_User's C++ ports. - * - * This class is the base class of DSC_User's C++ ports. +#include "PortProperties_i.hxx" +/* + * This class is base class for all DSC_User provides and uses port. + * It provides a default property object for the port. */ class base_port { public : - virtual ~base_port() {}; + base_port(); + virtual ~base_port(); + + /*! + * This is used to get the property object of the port. + * + * \return property's CORBA reference. + */ + virtual Ports::PortProperties_ptr get_port_properties(); + +protected : + PortProperties_i * default_properties; }; #endif diff --git a/src/DSC/DSC_User/provides_port.cxx b/src/DSC/DSC_User/provides_port.cxx index 701b7b07e..a09f5cf71 100644 --- a/src/DSC/DSC_User/provides_port.cxx +++ b/src/DSC/DSC_User/provides_port.cxx @@ -26,17 +26,7 @@ #include "provides_port.hxx" provides_port::provides_port() -{ - default_properties = new PortProperties_i(); -} +{} provides_port::~provides_port() -{ - delete default_properties; -} - -Ports::PortProperties_ptr -provides_port::get_port_properties() -{ - return default_properties->_this(); -} +{} diff --git a/src/DSC/DSC_User/provides_port.hxx b/src/DSC/DSC_User/provides_port.hxx index 0647f9aeb..a0aeacd0b 100644 --- a/src/DSC/DSC_User/provides_port.hxx +++ b/src/DSC/DSC_User/provides_port.hxx @@ -29,14 +29,12 @@ #include "base_port.hxx" #include "SALOME_Ports.hh" #include "DSC_Engines.hh" -#include "PortProperties_i.hxx" /*! \class provides_port * \brief This class implements a DSC_User provides C++ port. * * This class is base class for all DSC_User provides port. * It's an abstract class. - * It provides a default property object for the port. */ class provides_port : public base_port { @@ -61,15 +59,6 @@ class provides_port : public base_port virtual void provides_port_changed(int connection_nbr, const Engines::DSC::Message message) {} - /*! - * This is used to get the property object of the port. - * - * \return property's CORBA reference. - */ - virtual Ports::PortProperties_ptr get_port_properties(); - - private : - PortProperties_i * default_properties; }; #endif diff --git a/src/DSC/DSC_User/uses_port.cxx b/src/DSC/DSC_User/uses_port.cxx index b110e48d8..2a904b2ff 100644 --- a/src/DSC/DSC_User/uses_port.cxx +++ b/src/DSC/DSC_User/uses_port.cxx @@ -17,26 +17,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// -// -// File : uses_port.cxx -// Author : André RIBES (EDF) -// Module : KERNEL #include "uses_port.hxx" uses_port::uses_port() -{ - default_properties = new PortProperties_i(); -} +{} uses_port::~uses_port() -{ - delete default_properties; -} +{} -Ports::PortProperties_ptr -uses_port::get_port_properties() -{ - return default_properties->_this(); -} diff --git a/src/DSC/DSC_User/uses_port.hxx b/src/DSC/DSC_User/uses_port.hxx index 93a2ad757..93307b3b1 100644 --- a/src/DSC/DSC_User/uses_port.hxx +++ b/src/DSC/DSC_User/uses_port.hxx @@ -29,14 +29,12 @@ #include "base_port.hxx" #include "SALOME_Ports.hh" #include "DSC_Engines.hh" -#include "PortProperties_i.hxx" /*! \class provides_port * \brief This class implements a DSC_User uses C++ port. * * This class is base class for all DSC_User uses port. * It's an abstract class. - * It provides a default property object for the port. * * Contrary to DSC_Basic layer, a uses port as an implementation * provided by this class which permits to manipulate the uses port. @@ -64,7 +62,7 @@ class uses_port : public base_port virtual bool set_port(Ports::Port_ptr port) = 0; /*! - * This is method is the uses port's callback to be aware of + * This method is the uses port's callback to be aware of * connections states. * It's an abstract method. The uses port uses this method * to manage the sequence of the DSC_Basic uses port. @@ -75,15 +73,6 @@ class uses_port : public base_port virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port, const Engines::DSC::Message message) = 0; - /*! - * This is used to get the property object of the port. - * - * \return property's CORBA reference. - */ - virtual Ports::PortProperties_ptr get_port_properties(); - - private : - PortProperties_i * default_properties; }; #endif -- 2.39.2