00001
00002 #ifndef __UPF_CXX_API_H__
00003 #define __UPF_CXX_API_H__
00004
00005 namespace upf
00006 {
00007
00008
00009
00010
00011
00012
00013 #ifndef UPF_BUILDING_MODULE
00014
00019 inline bool init()
00020 { return (bool)upf_init(); }
00021
00028 inline bool done()
00029 { return (bool)upf_done(); }
00030 #endif
00031
00037 inline Ptr<IManager> getManager()
00038 { return _makeCxxObject<IManager>(upf_middleware->manager); }
00039
00044 inline Ptr<IServiceManager> getServiceManager()
00045 { return _makeCxxObject<IServiceManager>(upf_middleware->serviceManager); }
00046
00050 inline CID getCID(const char *classname)
00051 { return upf_middleware->funcs.classname_to_cid(classname); }
00052
00059 inline Ptr<IObject> create(CID classID)
00060 {
00061 Ptr<IObject> ptr = _makeCxxObject<IObject>(upf_middleware->funcs.create_instance(classID));
00062 if (ptr)
00063 {
00064
00065 ptr->_upf_getABIObject()->refCnt--;
00066 }
00067 return ptr;
00068 }
00069
00077 #ifndef _MSC_VER
00078 template<class Interface> inline Ptr<IObject> create()
00079 #else
00080
00081 template<class Interface> inline Ptr<IObject> create(Interface*** = NULL)
00082 #endif
00083 {
00084 return create(InterfaceTraits<Interface>::implName());
00085 }
00086
00088 inline Ptr<IObject> create(const char *classname)
00089 { return create(getCID(classname)); }
00090
00092 inline Ptr<IObject> create(const std::string& classname)
00093 { return create(getCID(classname.c_str())); }
00094
00095 }
00096
00097
00098 #endif