1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 File : CalciumInterface.hxx
22 Author : Eric Fayolle (EDF)
24 Modified by : $LastChangedBy$
25 Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
29 #ifndef _CALCIUM_MACRO_C_INTERFACE_H_
30 #define _CALCIUM_MACRO_C_INTERFACE_H_
34 /****** CALCIUM_C2CPP_INTERFACE_HXX_ : ******/
35 /****** Declarations: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
37 #define CALCIUM_C2CPP_INTERFACE_HXX_(_name,_porttype,_type,_qual) \
38 extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
39 CalTimeType< _type _qual >::TimeType * ti, \
40 CalTimeType< _type _qual >::TimeType * tf, long * i, \
41 const char * const nomvar, size_t bufferLength, \
42 size_t * nRead, _type _qual ** data ); \
45 extern "C" void ecp_lecture_##_name##_free ( _type _qual * data); \
48 extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
49 CalTimeType< _type _qual >::TimeType *t, \
51 const char * const nomvar, size_t bufferLength, \
52 _type _qual * data ); \
58 /****** CALCIUM_C2CPP_INTERFACE_CXX_ : ******/
59 /******Definitions: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
60 #define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual) \
61 extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
62 CalTimeType< _type _qual >::TimeType * ti, \
63 CalTimeType< _type _qual >::TimeType * tf, long * i, \
64 const char * const nomvar, size_t bufferLength, \
65 size_t * nRead, _type _qual ** data ) \
67 Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
70 if(dependencyType == CalciumTypes::CP_TEMPS) \
76 size_t _bufferLength=bufferLength; \
78 if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
79 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
82 CalciumInterface::ecp_lecture< _type,_porttype >( *_component, dependencyType, _ti, _tf, *i, nomvar, \
83 _bufferLength, _nRead, *data); \
85 catch ( const CalciumException & ex) \
87 DEBTRACE( ex.what() ); \
88 return ex.getInfo(); \
92 DEBTRACE( "Unexpected exception ") ; \
93 return CalciumTypes::CPATAL; \
95 if ( IsSameType< _porttype , cplx >::value ) \
98 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
99 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
100 DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
104 if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
105 *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
106 DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
107 return CalciumTypes::CPOK; \
111 extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) \
113 CalciumInterface::ecp_free< _type, _porttype >(data); \
117 extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
118 CalTimeType< _type _qual >::TimeType *t, \
120 const char * const nomvar, size_t bufferLength, \
121 _type _qual * data ) \
123 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
124 Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
125 /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
127 if(dependencyType == CalciumTypes::CP_TEMPS) \
129 size_t _bufferLength=bufferLength; \
130 if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
131 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
134 /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
135 DEBTRACE( "----------->-" << nomvar ) \
136 CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, dependencyType, \
137 _t,i,nomvar,_bufferLength,*data); \
139 catch ( const CalciumException & ex) \
141 DEBTRACE( ex.what() ); \
142 return ex.getInfo(); \
146 DEBTRACE("Unexpected exception " ); \
147 return CalciumTypes::CPATAL; \
149 DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
150 return CalciumTypes::CPOK; \