Horus Doc || Corba Reference || Corba   Client Server   Stubs C++   Stubs Java   Servant Generator  

HxServerCAPI.c File Reference

#include <OB/CORBA.h>
#include "HxServerCAPI.h"
#include "HxServer.h"

Functions

HXSERVER_API int HxServerInit (int argc, char *argv[])
HXSERVER_API int HxSimpleServerInit (int port)
HXSERVER_API int HxServerRun ()
HXSERVER_API int HxServerShutdown ()
HXSERVER_API char * HxGetInitialObject (const char *name, char *ref)
HXSERVER_API char * HxCreateRgbBuffer (char *ref)
HXSERVER_API void HxSetRgbBufferArray (const char *ref, int *array)
HXSERVER_API void HxBindToNameServer (const char *name, const char *address)

Function Documentation

HXSERVER_API int HxServerInit int    argc,
char *    argv[]
 

00017 {
00018     try 
00019     {
00020         HxServer* server = new HxServer(argc, argv);
00021     }
00022     catch (const CORBA::Exception& e)
00023     {
00024         std::cerr << e << std::endl;
00025         return EXIT_FAILURE;
00026     }
00027     return EXIT_SUCCESS;
00028 }

HXSERVER_API int HxSimpleServerInit int    port
 

00032 {
00033     std::cout << "Starting server";
00034     if(port != -1) std::cout << " at port " << port;
00035     std::cout << "..." << std::endl;
00036 
00037     try 
00038     {
00039         HxServer* server = new HxServer(port);
00040     }
00041     catch (const CORBA::Exception& e)
00042     {
00043         std::cerr << e << std::endl;
00044         return EXIT_FAILURE;
00045     }
00046     return EXIT_SUCCESS;
00047 }

HXSERVER_API int HxServerRun  
 

00051 {
00052     if(!HxServer::instance()) 
00053         return EXIT_FAILURE;
00054 
00055     try 
00056     {
00057         HxServer::instance()->run();
00058     }
00059     catch (const CORBA::Exception& e)
00060     {
00061         std::cerr << e << std::endl;
00062         return EXIT_FAILURE;
00063     }
00064     return EXIT_SUCCESS;
00065 }

HXSERVER_API int HxServerShutdown  
 

00069 {
00070     if(!HxServer::instance()) 
00071         return EXIT_FAILURE;
00072 
00073     try 
00074     {
00075         HxServer::instance()->shutdown(true);
00076     }
00077     catch (const CORBA::Exception& e)
00078     {
00079         std::cerr << e << std::endl;
00080         return EXIT_FAILURE;
00081     }
00082     return EXIT_SUCCESS;
00083 }

HXSERVER_API char* HxGetInitialObject const char *    name,
char *    ref
 

00088 {
00089     if(!HxServer::instance()) 
00090         return strcpy(ref, "");
00091 
00092     CORBA::Object_var obj = HxServer::instance()->getInitialObject(name);
00093     CORBA::String_var strRef = HxServer::instance()->object_to_string(obj);
00094     
00095     return strcpy(ref, strRef.in());
00096 }

HXSERVER_API char* HxCreateRgbBuffer char *    ref
 

00100 {
00101     if(!HxServer::instance()) 
00102         return strcpy(ref, "");
00103 
00104     HxCorba::RgbBuffer_var buf = HxServer::instance()->createRgbBuffer();
00105     CORBA::String_var strRef = HxServer::instance()->object_to_string(buf);
00106 
00107     return strcpy(ref, strRef.in());
00108 }

HXSERVER_API void HxSetRgbBufferArray const char *    ref,
int *    array
 

00112 {
00113     if(!HxServer::instance()) 
00114         return;
00115 
00116     CORBA::Object_ptr obj = HxServer::instance()->string_to_object(ref);
00117     HxCorba::RgbBuffer_var buf = HxCorba::RgbBuffer::_narrow(obj);
00118     HxServer::instance()->setRgbBufferArray(buf, array);
00119 }

HXSERVER_API void HxBindToNameServer const char *    name,
const char *    address
 

00123 {
00124     if(!HxServer::instance()) 
00125         return;
00126 
00127     HxServer::instance()->bindToNameServer(name, address);
00128 }


Generated on Mon Jan 27 15:20:53 2003 for CorbaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001