OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / doc / mico / examples / codesets / server.cc
1 #define MICO_CONF_IMR
2 #include <CORBA-SMALL.h>
3 #ifdef HAVE_ANSI_CPLUSPLUS_HEADERS
4 #include <iostream>
5 #include <fstream>
6 #else
7 #include <iostream.h>
8 #include <fstream.h>
9 #endif
10 #include "hello.h"
11
12
13 using namespace std;
14
15 class Hello_impl : virtual public Hello_skel {
16 public:
17     char *sayHello (const char *s)
18     {
19         cout << s << endl;
20         return CORBA::string_dup (s);
21     }
22 };
23
24 int
25 main (int argc, char *argv[])
26 {
27     CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb");
28     CORBA::BOA_var boa = orb->BOA_init (argc, argv, "mico-local-boa");
29
30     Hello_impl * hi = new Hello_impl;
31
32     ofstream of ("server.ref");
33     CORBA::String_var str = orb->object_to_string (hi);
34     of << str.in() << endl;
35     of.close ();
36
37     boa->impl_is_ready (CORBA::ImplementationDef::_nil());
38     orb->run ();
39     return 0;
40 }