00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _CALCIUM_MACRO_C_INTERFACE_H_
00030 #define _CALCIUM_MACRO_C_INTERFACE_H_
00031
00032
00033
00034
00035
00036
00037 #define CALCIUM_C2CPP_INTERFACE_HXX_(_name,_porttype,_type,_qual) \
00038 extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
00039 CalTimeType< _type _qual >::TimeType * ti, \
00040 CalTimeType< _type _qual >::TimeType * tf, long * i, \
00041 const char * const nomvar, size_t bufferLength, \
00042 size_t * nRead, _type _qual ** data ); \
00043 \
00044 \
00045 extern "C" void ecp_lecture_##_name##_free ( _type _qual * data); \
00046 \
00047 \
00048 extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
00049 CalTimeType< _type _qual >::TimeType *t, \
00050 long i, \
00051 const char * const nomvar, size_t bufferLength, \
00052 _type _qual * data ); \
00053
00054
00055
00056
00057
00058
00059
00060 #define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual) \
00061 extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
00062 CalTimeType< _type _qual >::TimeType * ti, \
00063 CalTimeType< _type _qual >::TimeType * tf, long * i, \
00064 const char * const nomvar, size_t bufferLength, \
00065 size_t * nRead, _type _qual ** data ) \
00066 { \
00067 Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
00068 double _ti=0.; \
00069 double _tf=0.; \
00070 if(dependencyType == CalciumTypes::CP_TEMPS) \
00071 { \
00072 _ti=*ti; \
00073 _tf=*tf; \
00074 } \
00075 size_t _nRead=0; \
00076 size_t _bufferLength=bufferLength; \
00077 \
00078 if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
00079 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
00080 try \
00081 { \
00082 CalciumInterface::ecp_lecture< _type,_porttype >( *_component, dependencyType, _ti, _tf, *i, nomvar, \
00083 _bufferLength, _nRead, *data); \
00084 } \
00085 catch ( const CalciumException & ex) \
00086 { \
00087 DEBTRACE( ex.what() ); \
00088 return ex.getInfo(); \
00089 } \
00090 catch ( ... ) \
00091 { \
00092 DEBTRACE( "Unexpected exception ") ; \
00093 return CalciumTypes::CPATAL; \
00094 } \
00095 if ( IsSameType< _porttype , cplx >::value ) \
00096 { \
00097 *nRead=_nRead/2; \
00098 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
00099 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
00100 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
00101 } \
00102 else \
00103 *nRead = _nRead; \
00104 if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
00105 *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
00106 DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
00107 return CalciumTypes::CPOK; \
00108 }; \
00109 \
00110 \
00111 extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) \
00112 { \
00113 CalciumInterface::ecp_free< _type, _porttype >(data); \
00114 }; \
00115 \
00116 \
00117 extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
00118 CalTimeType< _type _qual >::TimeType *t, \
00119 long i, \
00120 const char * const nomvar, size_t bufferLength, \
00121 _type _qual * data ) \
00122 { \
00123 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
00124 Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
00125 \
00126 double _t=0.; \
00127 if(dependencyType == CalciumTypes::CP_TEMPS) \
00128 _t=*t; \
00129 size_t _bufferLength=bufferLength; \
00130 if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
00131 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
00132 try \
00133 { \
00134 \
00135 DEBTRACE( "----------->-" << nomvar ) \
00136 CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, dependencyType, \
00137 _t,i,nomvar,_bufferLength,*data); \
00138 } \
00139 catch ( const CalciumException & ex) \
00140 { \
00141 DEBTRACE( ex.what() ); \
00142 return ex.getInfo(); \
00143 } \
00144 catch ( ... ) \
00145 { \
00146 DEBTRACE("Unexpected exception " ); \
00147 return CalciumTypes::CPATAL; \
00148 } \
00149 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
00150 return CalciumTypes::CPOK; \
00151 }; \
00152
00153
00154 #endif