1 // ////////////////////////////////////////////////////////
2 // Lecture on the CORBA Component Model, summer term 2003
3 // Assignment 3+, Stephan Brumme, 702544
4 //
5 // Some generic helper functions
6 //
7
8
9 #ifndef _HELPER_H_INCLUDED
10 #define _HELPER_H_INCLUDED
11
12
13 #include <iostream>
14
15
16 // exits the program if the given CORBA::object_var satisfies CORBA::is_nil
17 template <typename P>
18 void CorbaAssert(const P object, const char* msg, const unsigned int code = 1)
19 {
20 if (CORBA::is_nil(object))
21 CorbaError(msg, code);
22 }
23
24 // displays a given error message and exits the program
25 void CorbaError(const char* msg, const unsigned int code = 1)
26 {
27 std::cerr << msg << std::endl;
28 exit(code);
29 }
30
31
32 #endif // _HELPER_H_INCLUDED
33