diff options
Diffstat (limited to 'cpp/include/Ice/FactoryTableInit.h')
-rw-r--r-- | cpp/include/Ice/FactoryTableInit.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/cpp/include/Ice/FactoryTableInit.h b/cpp/include/Ice/FactoryTableInit.h index 45f90825a7d..903497949ec 100644 --- a/cpp/include/Ice/FactoryTableInit.h +++ b/cpp/include/Ice/FactoryTableInit.h @@ -11,6 +11,7 @@ #define ICE_FACTORYTABLEINIT_H #include <Ice/FactoryTable.h> +#include <Ice/DefaultObjectFactory.h> namespace IceInternal { @@ -27,6 +28,60 @@ static FactoryTableInit factoryTableInitializer; // Dummy variable to force i extern ICE_API FactoryTable* factoryTable; + +class ICE_API CompactIdInit +{ +public: + + CompactIdInit(const char*, int); + + ~CompactIdInit(); + +private: + const int _compactId; +}; + +template<class E> +class DefaultUserExceptionFactoryInit +{ +public: + + DefaultUserExceptionFactoryInit(const char* typeId) : + _typeId(typeId) + { + factoryTable->addExceptionFactory(_typeId, new DefaultUserExceptionFactory<E>(_typeId)); + } + + ~DefaultUserExceptionFactoryInit() + { + factoryTable->removeExceptionFactory(_typeId); + } + +private: + const ::std::string _typeId; +}; + +template<class O> +class DefaultObjectFactoryInit +{ +public: + + DefaultObjectFactoryInit(const char* typeId) : + _typeId(typeId) + { + factoryTable->addObjectFactory(_typeId, new DefaultObjectFactory<O>(_typeId)); + } + + ~DefaultObjectFactoryInit() + { + factoryTable->removeObjectFactory(_typeId); + } + +private: + const ::std::string _typeId; + +}; + } #endif |