]> rtime.felk.cvut.cz Git - can-usb1.git/blob - ulan/host/apps/ul_asd/ul_corba_toolkit.h
Initializing repo
[can-usb1.git] / ulan / host / apps / ul_asd / ul_corba_toolkit.h
1 #ifndef _UL_CORBA_TOOLKIT_
2 #define _UL_CORBA_TOOLKIT_
3
4 #include <stdio.h>
5 #include <string.h>
6 #include <orbit/orbit.h>
7 #include <ORBitservices/CosNaming.h>
8
9 /* extracts type of exception: Three return Values are possible:
10  * CORBA_NO_EXCEPTION, CORBA_USER_EXCEPTION, CORBA_SYSTEM_EXCEPTION:/
11 */
12 #define etk_exception_type(ev) (ev->_major)
13
14 /** 
15  * test @ev for any exception 
16  */
17 gboolean 
18 etk_raised_exception (CORBA_Environment *ev);
19
20 /** 
21  * test @ev for specific exception  @ex
22  */
23 gboolean 
24 etk_raised_exception_is_a (CORBA_Environment *ev, CORBA_char* ex);
25
26 /**
27  * in case of any exception this operation will abort the process  
28  */
29 void 
30 etk_abort_if_exception(CORBA_Environment *ev, const char* mesg); 
31
32 /**
33  * in case of any exception this operation will only free allocated resources
34  */
35 void 
36 etk_ignore_if_exception(CORBA_Environment *ev, const char* mesg); 
37
38 /**
39  *
40  */
41 void
42 etk_export_object_to_stream (CORBA_ORB          orb,
43                              CORBA_Object       servant,
44                              FILE              *stream,
45                              CORBA_Environment *ev);
46
47
48 /* Writes stringified object reference of @servant to file
49  * @filename. If error occures @ev points to exception object on
50  * return.
51  */
52 void 
53 etk_export_object_to_file (CORBA_ORB          orb,
54                            CORBA_Object       servant,
55                            char              *filename, 
56                            CORBA_Environment *ev);
57
58 /**
59  *
60  */
61 CORBA_Object
62 etk_import_object_from_stream (CORBA_ORB          orb,
63                                FILE              *stream,
64                                CORBA_Environment *ev);
65
66 /**
67  *
68  */
69 CORBA_Object
70 etk_import_object_from_file (CORBA_ORB          orb,
71                              CORBA_char        *filename,
72                              CORBA_Environment *ev);
73
74
75 /** resolves default name-service, usually given to application as
76  * command line argument "-ORBInitRef NameService=IOR:0100000028..",
77  * or since release 2.8.0 corbalocs in form of URL can be used, eg:
78  * "-ORBInitRef NameService=corbaloc:iiop:HOSTNAME:PORT/NameService%00"
79  */
80 CosNaming_NamingContext 
81 etk_get_name_service (CORBA_ORB         orb,
82                       CORBA_Environment *ev);
83
84
85 /* binds @servant object reference to unique @name at
86  * @name_service. @name is a NULL terminated list of strings
87  * (CORBA_char*). If error occures @ev points to exception object on
88  * return.
89  */
90 void 
91 etk_name_service_bind (CosNaming_NamingContext  name_service,
92                        CORBA_Object             servant,
93                        gchar                   *id_vec[], 
94                        CORBA_Environment       *ev);
95
96 /* resolves object reference @return with unique @name at
97  *  @name_service. @name is a NULL terminated list of strings
98  *  (CORBA_char*).  If error occures @ev points to * exception object
99  *  on return.
100  */
101 CORBA_Object 
102 etk_name_service_resolve (CosNaming_NamingContext  name_service,
103                           gchar                   *id_vec[], 
104                           CORBA_Environment       *ev);
105
106 #endif