1 // Copyright (C) 2007-2012 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.
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) $
28 #ifndef _CALCIUM_C_INTERFACE_H_
29 #define _CALCIUM_C_INTERFACE_H_
31 #include "CalciumMacroCInterface.hxx"
32 #include "CalciumTypes.hxx"
33 #include "CalciumFortranInt.h"
36 /* Déclaration de l'Interface entre l'API C et l'API C++
37 L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
38 En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
39 2 En C++/CORBA directement celle de CalciumCxxInterface.hxx
42 /* En CALCIUM l'utilisation de données de type double
43 implique des dates de type double, pour les autres
44 types de données les dates sont de type float
46 template <class T> struct CalTimeType {
47 typedef float TimeType;
50 template <> struct CalTimeType<double> {
51 typedef double TimeType;
54 /* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
56 /* Le premier argument est utilisé :
57 - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
58 Le second argument est utilisé :
59 - comme argument template à l'appel de la méthode C++ correspondante
60 ( le type CORBA de port correspondant est alors obtenu par un trait)
61 Le troisième argument est utilisée :
62 - pour typer le paramètre data de la procédure générée
63 - pour déduire le type des paramètres t, ti tf via un trait
64 - comme premier paramètre template à l'appel de la méthode C++ correspondante
65 (pour typer les données passées en paramètre )
66 Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
67 en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
68 C++ CALCIUM de lecture repère cette différence de type et charge
69 le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
70 Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon
71 il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long
72 s'il est 64 bits sinon celà peut être un long long (s'il existe).
74 CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,);
75 CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,);
77 CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,);
78 CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,);
79 CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,);
81 CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, );
82 CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
83 /* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
84 CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,);
85 CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,);
86 CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,);
88 /* Déclaration de ecp_fin */
89 extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code);
90 extern "C" CalciumTypes::InfoType ecp_cd_ (void * component, char* instanceName);
91 extern "C" CalciumTypes::InfoType ecp_fini_ (void * component, char* nomVar, int i);
92 extern "C" CalciumTypes::InfoType ecp_fint_ (void * component, char* nomVar, float t);
93 extern "C" CalciumTypes::InfoType ecp_effi_ (void * component, char* nomVar, int i);
94 extern "C" CalciumTypes::InfoType ecp_efft_ (void * component, char* nomVar, float t);