27 #ifndef _CALCIUM_CXXINTERFACE_HXX_
28 #define _CALCIUM_CXXINTERFACE_HXX_
30 #if defined(__CONST_H) || defined(__CALCIUM_H)
31 #error "The header CalciumCxxInterface.hxx must be included before calcium.h"
49 template <
typename T1,
typename T2>
51 static const bool value =
false;
53 template <
typename T1>
61 #include <boost/type_traits/remove_all_extents.hpp>
71 CORBA::String_var componentName=component.
instanceName();
73 if (instanceName.empty()) instanceName=componentName;
80 CORBA::String_var componentName=component.
instanceName();
84 std::vector<std::string> usesPortNames;
85 std::vector<std::string>::const_iterator it;
94 for (it=usesPortNames.begin(); it != usesPortNames.end(); ++it)
98 myCalciumUsesPort= component.Superv_Component_i::get_port<
calcium_uses_port >((*it).c_str());
104 if (SALOME::VerbosityActivated())
106 std::cerr <<
"-------- CalciumInterface(ecp_fin) MARK 1 -|" << *it <<
"|----" <<
108 typeid(myCalciumUsesPort).
name() <<
"-------------" << std::endl;
115 myCalciumUsesPort->
disconnect(provideLastGivenValue);
147 template <
typename T1,
typename T2>
static void
151 typedef typename PortType::DataManipulator DataManipulator;
152 typedef typename DataManipulator::Type DataType;
153 typedef typename DataManipulator::InnerType InnerType;
158 template <
typename T1>
static void
161 ecp_free<T1,T1> ( dataPtr );
173 template <
typename T1,
typename T2 >
static void
179 const std::string & nomVar,
186 CORBA::String_var componentName=component.
instanceName();
190 typedef typename PortType::DataManipulator DataManipulator;
191 typedef typename DataManipulator::Type CorbaDataType;
192 typedef typename DataManipulator::InnerType InnerType;
196 CorbaDataType corbaData;
198 if (SALOME::VerbosityActivated())
199 std::cerr <<
"-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
208 if (SALOME::VerbosityActivated())
210 std::cout <<
"-------- CalciumInterface(lecture) MARK 2 --"<<
typeid(
port).
name()<<
"----------------" << std::endl;
213 std::cout <<
"-------- CalciumInterface(lecture) MARK 2b1 -----" <<
typeid(t1).
name() <<
"-------------" << std::endl;
214 std::cout <<
"-------- CalciumInterface(lecture) MARK 2b2 -----" <<
typeid(t2).
name() <<
"-------------" << std::endl;
219 port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
220 if (SALOME::VerbosityActivated())
221 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
252 "Dependency mode is not the same as the required one");
254 << portDependencyType <<
" is not the same as the required one."));
258 std::stringstream msgout,
msg;
264 msg <<
"ti=" << ti <<
", tf=" << tf ;
266 corbaData =
port->get(tt,tf, 0);
267 msgout <<
"read t=" << tt ;
269 if (SALOME::VerbosityActivated())
270 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
284 corbaData =
port->get(0, i);
285 msgout <<
"read i=" << i ;
287 if (SALOME::VerbosityActivated())
288 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
301 if (SALOME::VerbosityActivated())
302 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
305 corbaData =
port->next(ti,i);
307 if(i==0)msgout<<
"t=" <<ti;
308 else msgout<<
"i=" <<i;
317 if (SALOME::VerbosityActivated())
318 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
320 size_t corbaDataSize = DataManipulator::size(corbaData);
322 if (SALOME::VerbosityActivated())
323 std::cout <<
"-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
328 if ( bufferLength != 0 )
330 MESSAGE(
"bufferLength devrait valoir 0 pour l'utilisation du mode sans copie (data==NULL)");
332 nRead = corbaDataSize;
336 if (SALOME::VerbosityActivated())
337 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
349 if (SALOME::VerbosityActivated())
350 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
365 nRead = std::min < size_t > (corbaDataSize,bufferLength);
367 if (SALOME::VerbosityActivated())
368 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
374 if (SALOME::VerbosityActivated())
375 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
378 if (SALOME::VerbosityActivated())
380 std::cout <<
"-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
381 std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout,
" "));
382 std::cout <<
"Ptr :" << data << std::endl;
383 std::cout <<
"-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
391 template <
typename T1 >
static void
397 const std::string & nomVar,
403 i,nomVar,bufferLength,nRead,data);
411 template <
typename T1,
typename T2>
static void
416 const std::string & nomVar,
422 CORBA::String_var componentName=component.
instanceName();
426 typedef typename boost::remove_all_extents< T1 >::type T1_without_extent;
427 typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
430 typedef typename ProvidesPortType::DataManipulator DataManipulator;
433 typedef typename DataManipulator::Type CorbaDataType;
434 typedef typename DataManipulator::InnerType InnerType;
436 T1_without_extent
const & _data = data;
441 if (SALOME::VerbosityActivated())
442 std::cerr <<
"-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
444 if ( nomVar.empty() )
451 if (SALOME::VerbosityActivated())
453 std::cout <<
"-------- CalciumInterface(ecriture) MARK 2 ---"<<
typeid(
port).
name()<<
"---------------" << std::endl;
456 std::cout <<
"-------- CalciumInterface(ecriture) MARK 2b1 -----" <<
typeid(t1).
name() <<
"-------------" << std::endl;
457 std::cout <<
"-------- CalciumInterface(ecriture) MARK 2b2 -----" <<
typeid(t2).
name() <<
"-------------" << std::endl;
462 port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
464 if (SALOME::VerbosityActivated())
465 std::cout <<
"-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
506 "SEQUENCE_DEPENDENCY mode is not possible when writing");
508 <<
" is not possible when writing."));
522 if ( bufferLength < 1 )
528 CorbaDataType corbaData;
530 if (SALOME::VerbosityActivated())
531 std::cout <<
"-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
553 if (SALOME::VerbosityActivated())
555 T1_without_extent t1b;
557 std::cout <<
"-------- CalciumInterface(ecriture) MARK 4b1 -----" <<
typeid(t1b).
name() <<
"-------------" << std::endl;
558 std::cout <<
"-------- CalciumInterface(ecriture) MARK 4b2 -----" <<
typeid(t2b).
name() <<
"-------------" << std::endl;
568 port->put(*corbaData,t, -1);
569 std::stringstream
msg;
580 if (SALOME::VerbosityActivated())
581 std::cout <<
"-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
587 port->put(*corbaData,-1, i);
588 std::stringstream
msg;
598 if (SALOME::VerbosityActivated())
599 std::cout <<
"-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
602 if (SALOME::VerbosityActivated())
604 std::cout <<
"-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
605 for (
int i = 0; i < corbaData->length(); ++i)
606 std::cout <<
"-------- CalciumInterface(ecriture), corbaData[" << i <<
"] = " << (*corbaData)[i] << std::endl;
613 if (SALOME::VerbosityActivated())
614 std::cout <<
"-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
619 template <
typename T1>
static void
624 const std::string & nomVar,
628 ecp_ecriture<T1,T1> (component,
dependencyType,t,i,nomVar,bufferLength,data);
634 CORBA::String_var componentName=component.
instanceName();
677 "Dependency mode must be iteration mode");
679 << portDependencyType <<
" must be iteration mode."));
682 port->calcium_erase(0., i,
true);
684 std::stringstream
msg;
693 CORBA::String_var componentName=component.
instanceName();
736 "Dependency mode must be time mode");
738 << portDependencyType <<
" must be time mode."));
741 port->calcium_erase(t, 0,
true);
743 std::stringstream
msg;
752 CORBA::String_var componentName=component.
instanceName();
795 "Dependency mode must be iteration mode");
797 << portDependencyType <<
" must be iteration mode."));
800 port->calcium_erase(0., i,
false);
802 std::stringstream
msg;
811 CORBA::String_var componentName=component.
instanceName();
854 "Dependency mode must be time mode");
856 << portDependencyType <<
" must be time mode."));
859 port->calcium_erase(t, 0,
false);
861 std::stringstream
msg;
const DEPENDENCY_TYPE dependencyType
Definition: CorbaTypes2CalciumTypes.cxx:88
#define LOC(message)
Definition: DSC_Exception.hxx:55
std::string getContainerName()
C++ method: return the name of the container associated with this component This name does not contai...
Definition: Component_i.cxx:1082
char * instanceName()
CORBA method: return name of the instance, unique in this Container.
Definition: Component_i.cxx:238
static void writeEvent(const char *request, const std::string &containerName, const char *instance_name, const char *port_name, const char *error, const char *message)
Write a record in the trace file.
Definition: DSC_interface.cxx:478
Class OSS is useful when streaming data through a function that expect a string as parameter.
Definition: DSC_Exception.hxx:65
This class implements DSC_User component.
Definition: Superv_Component_i.hxx:54
virtual void get_uses_port_names(std::vector< std::string > &port_names, const std::string servicename="") const
Gets the list of the ports of a service.
Definition: Superv_Component_i.cxx:316
Definition: calcium_provides_port.hxx:34
Definition: calcium_uses_port.hxx:36
virtual void disconnect(bool)
Definition: calcium_uses_port.hxx:40
Definition: CalciumCxxInterface.cxx:32
static void ecp_cd(Superv_Component_i &component, std::string &instanceName)
Definition: CalciumCxxInterface.hxx:68
static void ecp_free(T1 *dataPtr)
Definition: CalciumCxxInterface.hxx:148
static void ecp_efft(Superv_Component_i &component, const std::string &nomVar, double const &t)
Definition: CalciumCxxInterface.hxx:809
static void ecp_fint(Superv_Component_i &component, const std::string &nomVar, double const &t)
Definition: CalciumCxxInterface.hxx:691
static void ecp_ecriture(Superv_Component_i &component, int const &dependencyType, double const &t, long const &i, const std::string &nomVar, size_t bufferLength, T1 const &data)
Definition: CalciumCxxInterface.hxx:412
static void ecp_effi(Superv_Component_i &component, const std::string &nomVar, long const &i)
Definition: CalciumCxxInterface.hxx:750
static void ecp_fin(Superv_Component_i &component, bool provideLastGivenValue)
Definition: CalciumCxxInterface.hxx:78
static void ecp_fini(Superv_Component_i &component, const std::string &nomVar, long const &i)
Definition: CalciumCxxInterface.hxx:632
static void ecp_lecture(Superv_Component_i &component, int const &dependencyType, double &ti, double const &tf, long &i, const std::string &nomVar, size_t bufferLength, size_t &nRead, T1 *&data)
Definition: CalciumCxxInterface.hxx:174
const int CPATAL
Definition: CalciumTypes.hxx:136
const int CPTPVR
Definition: CalciumTypes.hxx:96
const int CPOK
Definition: CalciumTypes.hxx:81
const int CPITVR
Definition: CalciumTypes.hxx:103
DependencyType
Definition: CalciumTypes.hxx:68
@ ITERATION_DEPENDENCY
Definition: CalciumTypes.hxx:69
@ TIME_DEPENDENCY
Definition: CalciumTypes.hxx:68
@ SEQUENCE_DEPENDENCY
Definition: CalciumTypes.hxx:71
@ UNDEFINED_DEPENDENCY
Definition: CalciumTypes.hxx:68
const int CPLIEN
Definition: CalciumTypes.hxx:182
const int CPIT
Definition: CalciumTypes.hxx:44
const int CPNTNULL
Definition: CalciumTypes.hxx:127
const int CPNMVR
Definition: CalciumTypes.hxx:87
containerName
Definition: SALOME_ContainerPy.py:383
string msg
Definition: TestMinimalExample.py:168
string name
Definition: pythfilter.py:56
def copy(src, dst)
Definition: pythonpath_reduction.py:35
port
Definition: salome_instance.py:114
Definition: CalciumException.hxx:38
Definition: Copy2CorbaSpace.hxx:40
Definition: Copy2UserSpace.hxx:45
static void apply(T1 *&data, T2 &corbaData, size_t)
Definition: Copy2UserSpace.hxx:48
Definition: DSC_Exception.hxx:94
virtual const char * what(void) const noexcept
Definition: DSC_Exception.hxx:126
Definition: Copy2UserSpace.hxx:158
Definition: CalciumCxxInterface.hxx:50
static const bool value
Definition: CalciumCxxInterface.hxx:51
Definition: Superv_Component_i.hxx:76
Definition: Superv_Component_i.hxx:80
Definition: Superv_Component_i.hxx:79
Definition: CalciumPortTraits.hxx:37
Definition: CalciumPortTraits.hxx:86
#define MESSAGE(msg)
Definition: test1.c:32