SALOME documentation central

src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx

00001 /*  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
00002   
00003     Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004     CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005   
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License.
00010   
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015   
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019   
00020     See http:  www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021   
00022     File   : CalciumInterface.hxx
00023     Author : Eric Fayolle (EDF)
00024     Module : KERNEL
00025    Modified by : $LastChangedBy$
00026    Date        : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
00027    Id          : $Id$
00028 */
00029 #ifndef _CALCIUM_C_INTERFACE_H_
00030 #define _CALCIUM_C_INTERFACE_H_
00031 
00032 #include "CalciumMacroCInterface.hxx"
00033 #include "CalciumTypes.hxx"
00034 #include "CalciumFortranInt.h"
00035 #include <cstdlib>
00036 
00037 /* Déclaration de l'Interface entre l'API C et l'API C++
00038    L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
00039    En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
00040 2   En C++/CORBA directement celle de CalciumCxxInterface.hxx
00041 */
00042 
00043 /* En CALCIUM l'utilisation de données de type double
00044    implique des dates de type double, pour les autres
00045    types de données les dates sont de type float
00046 */
00047 template <class T> struct CalTimeType {
00048   typedef float TimeType;
00049 };
00050 
00051 template <> struct CalTimeType<double> {
00052   typedef double TimeType;
00053 };
00054 
00055 /* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
00056 
00057 /*  Le premier argument est utilisé :
00058     - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
00059     Le second argument est utilisé :
00060     - comme argument template à l'appel de la méthode C++ correspondante
00061         ( le type CORBA de port correspondant est alors obtenu par un trait)
00062    Le troisième argument est utilisée :
00063    - pour typer le paramètre data de la procédure générée 
00064    - pour déduire le type des paramètres t, ti tf via un trait
00065    - comme premier paramètre template à l'appel de la méthode C++ correspondante
00066          (pour typer les données passées en paramètre )
00067    Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
00068    en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
00069    C++ CALCIUM de lecture repère cette différence de type et charge 
00070    le manipulateur de données d'effectuer  une recopie (qui fonctionne si les types sont compatibles). 
00071    Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon
00072    il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long
00073    s'il est 64 bits sinon celà peut être un long long (s'il existe).
00074 */
00075 CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,);
00076 CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,);
00077 
00078 CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,);
00079 CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,);
00080 CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,);
00081 
00082 CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, );
00083 CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
00084 /*  Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
00085 CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,);
00086 CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,);
00087 CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,);
00088 
00089 /* Déclaration de ecp_fin */
00090 extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code);
00091 extern "C" CalciumTypes::InfoType ecp_cd_ (void * component, char* instanceName);
00092 
00093 #endif