Math
Commande de compilation
- Dans le menu Project - Add Existing Item de Visual C++,
il faut ajouter la bibliothèque ${UPS_HOME}/upscrb/upscrb/upsvtm_sc.lib
pour que les méthodes statiques des classes soient disponibles.
- Dans le menu Project - Properties de Visual C++,
il faut spécifier que l'alignement des structures est de quatre octets via
l'option de compilation /ZP4.
Commande d'enregistrement des objets Corba
${MICO_HOME}/bin/ird -ORBIIOPAddr inet:localhost:8888 --db
${MICO_HOME}/db/db-ird
${MICO_HOME}/bin/micod -ORBIIOPAddr inet:localhost:9999 --db
${MICO_HOME}/db/db-micod.txt --forward
upsvtm Corba=Charger
Commande d'exécution
${MICO_HOME}/bin/ird -ORBIIOPAddr inet:localhost:8888 --db
${MICO_HOME}/db/db-ird
${MICO_HOME}/bin/micod -ORBIIOPAddr inet:localhost:9999 --db
${MICO_HOME}/db/db-micod.txt --forward
math -ORBIfaceRepoAddr inet:localhost:8888 -ORBImplRepoAddr
inet:localhost:9999 -ORBBindAddr local:
Fichier source
#include <CORBA.h>
#include <mico/string.h>
#include <upskrn.hh>
#include <upsmat.hh>
#include <upscrbexception.h>
using namespace std;
static CORBA::ORB *pOrb;
static CORBA::BOA *pBoa;
static CORBA::Object *pObjet;
static IUpsKrn *pIUpsKrn;
static IUpsMat *pIUpsMat;
/****************************************************************/
int main(int argc, char *argv[])
/****************************************************************/
{
pOrb=CORBA::ORB_init(argc,argv, "mico-local-orb");
if (!pOrb)
pBoa=pOrb->BOA_init(argc, argv, "mico-local-boa");
if (!pBoa)
pObjet=pOrb->bind("IDL:IUpsKrn:1.0");
if (!pObjet)
pIUpsKrn=IUpsKrn::_narrow(pObjet);
if (!pIUpsKrn)
pObjet=pOrb->bind("IDL:IUpsMat:1.0");
if (!pObjet)
pIUpsMat=IUpsMat::_narrow(pObjet);
if (!pIUpsMat)
try
{
cout
<< "Abs(-10)=" << endl;
cout
<< pIUpsMat->Abs(-10)<< endl;
cout
<< "Abs(10.2)=" << endl;
cout << pIUpsMat->Abs2(10.2)<< endl;
cout
<< "ACos(0.0)="
<< endl;
cout << pIUpsMat->ACos(0.0)<< endl;
cout
<< "ASin(0.0)=" << endl;
cout << pIUpsMat->ASin(0.0)<< endl;
cout
<< "ATan(0.0)="
<< endl;
cout << pIUpsMat->ATan(0.0)<< endl;
cout
<< "Cos(0.0)=" << endl;
cout
<< pIUpsMat->Cos(0.0)<< endl;
cout
<< "Sin(0.0)=" << endl;
cout << pIUpsMat->Sin(0.0)<< endl;
cout
<< "Tan(0.0)="
<< endl;
cout << pIUpsMat->Tan(0.0)<< endl;
cout
<< "ACosH(1.0)=" << endl;
cout << pIUpsMat->ACosH(1.0)<< endl;
cout
<< "ASinH(1.0)="
<< endl;
cout << pIUpsMat->ASinH(1.0)<< endl;
cout
<< "ATanH(10.0)=" << endl;
cout << pIUpsMat->ATanH(10.0)<< endl;
cout
<< "CosH(0.0)="
<< endl;
cout << pIUpsMat->CosH(0.0)<< endl;
cout
<< "SinH(0.0)=" << endl;
cout << pIUpsMat->SinH(0.0)<< endl;
cout
<< "TanH(0.0)="
<< endl;
cout << pIUpsMat->TanH(0.0)<< endl;
cout
<< "Exp(1.0)=" << endl;
cout
<< pIUpsMat->Exp(1.0)<< endl;
cout
<< "Log(10.0)=" << endl;
cout << pIUpsMat->Log(10.0)<< endl;
cout
<< "Log10(10.0)="
<< endl;
cout << pIUpsMat->Log10(10.0)<< endl;
cout
<< "Racine(4.0)=" << endl;
cout << pIUpsMat->Racine2(4.0)<< endl;
}
catch (UpsCrbException *E)
{
cout
<< Erreur UpsKrn-0 : L'exception suivante a été envoyée dans le source
'" << E->NomSourceEnErreur<< "' :" << endl;
cout
<< E->MessageErreur<< endl;
return(1);
}
catch (CORBA::Exception &e)
{
cout
<< "Erreur Mico : L'exception suivante a été envoyée :"
<< endl;
cout <<
e << endl;
return(1);
}
CORBA::release(pIUpsMat);
pIUpsMat=NULL;
CORBA::release(pIUpsKrn);
pIUpsKrn=NULL;
delete pBoa;
delete pOrb;
return(0);
}