]> pilppa.org Git - libplpbus.git/blob - src/plpbus/OrbServerImpl.hh
cleanups
[libplpbus.git] / src / plpbus / OrbServerImpl.hh
1 /*
2  * OrbServerImpl.hh
3  *
4  *  Created on: Aug 11, 2010
5  *      Author: lamikr
6  */
7
8 #ifndef ORBSERVERIMPL_HH_
9 #define ORBSERVERIMPL_HH_
10
11 #include <iostream>
12 #include <omniORB4/CORBA.h>
13
14 #include "RequestResponseBus.hh"
15 #include "IServerListener.hh"
16
17 namespace plpbus {
18         class OrbServerImpl
19         {
20                 public:
21                         OrbServerImpl();
22                         virtual ~OrbServerImpl();
23                         virtual void send_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_req_param);
24                         virtual void send_dataitem_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param);
25                         virtual char *send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg);
26                         virtual CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param);
27                         virtual void add_event_listener(plpbus_orb::OrbClient_ptr client_param,
28                                                 const char *msg,
29                                                 CORBA::UShort period_secs);
30                         virtual void shutdown();
31                         virtual int init();
32                         virtual int launch(const char *server_name);
33                         virtual int is_shutdown_pending();
34                         virtual void server_thread_closed();
35                         virtual int add_server_listener(IServerListener *listener_param);
36                 private:
37                         PortableServer::POA_var _poa;
38                         CORBA::ORB_var          _orb;
39                         IServerListener         *_listener;
40                         int                     _server_thread_count;
41                         int                     _shutdown_pending;
42                         virtual PortableServer::POA_var create_poa(CORBA::ORB_var orb);
43                         /**
44                          * Gets naming context from the name service. If the naming context does not yet exist, create it.
45                          */
46                         CosNaming::NamingContext_var get_naming_service_context(const char *service_name_param,
47                                                                         const char *service_kind_param);
48                         /**
49                          * Bind service to naming context.
50                          * If service with same name has already been binded, replace the existing service with the new one.
51                          */
52                         bool bind_naming_context_and_service(CosNaming::NamingContext_var service_context_param,
53                                                         CORBA::Object_ptr service_ref_param,
54                                                         const char *service_name_param,
55                                                         const char *service_kind_param);
56         };
57 }
58
59 #endif /* ORBSERVERIMPL_HH_ */