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