#ifndef FACILITATOR_H #define FACILITATOR_H #include #include "CipresIDL/api1/Cipres.hpp" #include "CipresCommlib/CipresNameService.h" /* Eventually this will process all ORBxxx arguments and all -Cipres arguments. This will take care of registering the service with the nameservice or cipres registry, based on the -Cipres args supplied. Applications will be able to get a reference to the ORB, the root POA, the Cipres Registry (etc?) from any point in their code by calling, CipresFacilitator::getSingletonPtr()->getORB() for instance. Implemenatation: this is an ACE singleton. It doesn't do any real work until initialize() is called. It does all its cleanup when cleanup() is called, not from the dtor because there seems to be an ordering problem if you wait until the dtor is called. */ class CipresFacilitator { public: static CipresFacilitator * getSingletonPtr(); CORBA::ORB_ptr getORB(); // calls orb_init. orb_init modifies argc and argv. void initialize(int &argc, char **argv); // calls orb_shutdown void cleanup(); // calls orb_run void run(); bool registerWithNameService() const { return m_nsRegister; } bool lookupWithNameService() const { return m_nsRegister; } const char * getIORFile() const { return m_iorFile; } const char * getImplName() const { return m_implName; } void publishIOR(CORBA::Object *objectRef, const char *objectName) ; void publishIORToNameService(CORBA::Object *objectRef, const char *objectName) ; void publishIORToFile(CORBA::Object *objectRef, const char *objectName, const char *filename) const ; CORBA::Object_ptr getObjectFromFile(const char *filename); CipresNameService & getCipresNameService(); private: CipresFacilitator(); ~CipresFacilitator(); CORBA::ORB_var m_orb; // this will have a registry ptr to. char *m_iorFile; bool m_nsRegister; bool m_nsLookup; char *m_implName; CipresNameService m_cipresNameService; }; #endif //FACILITATOR_H