diff options
Diffstat (limited to 'cppe/include/IceE/FactoryTableDef.h')
-rw-r--r-- | cppe/include/IceE/FactoryTableDef.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cppe/include/IceE/FactoryTableDef.h b/cppe/include/IceE/FactoryTableDef.h new file mode 100644 index 00000000000..6551481b5b4 --- /dev/null +++ b/cppe/include/IceE/FactoryTableDef.h @@ -0,0 +1,61 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICEE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICEE_FACTORY_TABLE_DEF_H +#define ICEE_FACTORY_TABLE_DEF_H + +#include <IceE/StaticMutex.h> +#include <IceE/Mutex.h> +#include <IceE/UserExceptionFactoryF.h> +#include <IceE/Config.h> +#include <string> +#include <map> + +namespace IceE +{ + +class ICEE_API FactoryTableDef : private IceE::noncopyable +{ +public: + + void addExceptionFactory(const ::std::string&, const IceEInternal::UserExceptionFactoryPtr&); + IceEInternal::UserExceptionFactoryPtr getExceptionFactory(const ::std::string&) const; + void removeExceptionFactory(const ::std::string&); + +private: + + IceE::Mutex _m; + + typedef ::std::pair<IceEInternal::UserExceptionFactoryPtr, int> EFPair; + typedef ::std::map< ::std::string, EFPair> EFTable; + EFTable _eft; +}; + +class ICEE_API FactoryTableWrapper : private IceE::noncopyable +{ +public: + + friend class FactoryTable; + + FactoryTableWrapper(); + ~FactoryTableWrapper(); + +private: + + void initialize(); + void finalize(); + static IceE::StaticMutex _m; + static int _initCount; +}; + +extern ICEE_API FactoryTableWrapper factoryTableWrapper; + +} + +#endif |