diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-06-16 16:56:03 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-06-16 16:56:03 +0000 |
commit | dfbaed856c3559145ff1ce20dfdcb4c6fc7069a9 (patch) | |
tree | 146c0a563e94c948e2c6aaab80b2684919dba8f3 /cpp/include/Ice/FactoryTableInit.h | |
parent | C# IceSSL fixes (diff) | |
download | ice-dfbaed856c3559145ff1ce20dfdcb4c6fc7069a9.tar.bz2 ice-dfbaed856c3559145ff1ce20dfdcb4c6fc7069a9.tar.xz ice-dfbaed856c3559145ff1ce20dfdcb4c6fc7069a9.zip |
Fix for ICE-5527 (simplify generated code for user exception and object factories), ICE-4832 (ice_staticId and static initialization) and partial fix for ICE-5515 (ice_staticId on C++ proxies)
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 |