00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OMNIEVENTS__SERVANT_H
00025 #define OMNIEVENTS__SERVANT_H
00026
00027 #ifdef HAVE_CONFIG_H
00028 # include "config.h"
00029 #endif
00030
00031 #ifdef HAVE_IOSTREAM
00032 # include <iostream>
00033 #else
00034 # include <iostream.h>
00035 #endif
00036
00037 #include <string>
00038 #include <omniORB4/CORBA.h>
00039
00040 using namespace std;
00041
00042
00043 namespace OmniEvents {
00044
00051 CORBA::Object_ptr
00052 createReference(PortableServer::POA_ptr poa, const char* repositoryId);
00053
00063 template<class T>
00064 typename T::_ptr_type
00065 createNarrowedReference(PortableServer::POA_ptr poa, const char* repositoryId)
00066 {
00067 CORBA::Object_var obj =createReference(poa,repositoryId);
00068 return T::_unchecked_narrow(obj.in());
00069 }
00070
00072 char* newUniqueId();
00073
00074
00078 class Servant : public virtual PortableServer::ServantBase
00079 {
00080 public:
00081 virtual PortableServer::POA_ptr _default_POA();
00082 virtual ~Servant();
00083
00084 protected:
00085 Servant(PortableServer::POA_ptr poa);
00086
00088 void activateObjectWithId(const char* oidStr);
00090 void deactivateObject();
00091
00092 PortableServer::POA_var _poa;
00093
00095 class Output
00096 {
00097 ostream& _os;
00098 mutable string _indent;
00099 public:
00100 Output(ostream& os, string indent):_os(os),_indent(indent){}
00101 Output(const Output& v):_os(v._os),_indent(v._indent){v._indent="";}
00102 ~Output(){if(!_indent.empty())_os<<_indent<<"}\n";}
00103 };
00105 Output basicOutput(
00106 ostream& os, const char* name, int indent,
00107 PortableServer::ServantBase* servant,
00108 CORBA::Object_ptr target=CORBA::Object::_nil()
00109 );
00110
00111 private:
00113 Servant();
00114 };
00115
00116 };
00117
00118 #endif // OMNIEVENTS__SERVANT_H