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/DefaultObjectFactory.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/DefaultObjectFactory.h')
-rw-r--r-- | cpp/include/Ice/DefaultObjectFactory.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cpp/include/Ice/DefaultObjectFactory.h b/cpp/include/Ice/DefaultObjectFactory.h new file mode 100644 index 00000000000..d957a378912 --- /dev/null +++ b/cpp/include/Ice/DefaultObjectFactory.h @@ -0,0 +1,48 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_DEFAULT_OBJECT_FACTORY_H +#define ICE_DEFAULT_OBJECT_FACTORY_H + +#include <Ice/Config.h> +#include <Ice/ObjectFactory.h> + +namespace IceInternal +{ +template<class O> +class DefaultObjectFactory : public Ice::ObjectFactory +{ +public: + + DefaultObjectFactory(const ::std::string& typeId) : + _typeId(typeId) + { + } + +#ifndef NDEBUG + virtual ::Ice::ObjectPtr create(const ::std::string& typeId) +#else + virtual ::Ice::ObjectPtr create(const ::std::string&) +#endif + { + assert(typeId == _typeId); + return new O; + } + + virtual void destroy() + { + } + +private: + const ::std::string _typeId; +}; + +} + +#endif |