summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/contrib/utility/Utility')
-rw-r--r--ACE/contrib/utility/Utility/ExH/Compound.hpp47
-rw-r--r--ACE/contrib/utility/Utility/ExH/Compound.tpp71
-rw-r--r--ACE/contrib/utility/Utility/ExH/Converter.hpp24
-rw-r--r--ACE/contrib/utility/Utility/ExH/Converter.tpp19
-rw-r--r--ACE/contrib/utility/Utility/ExH/ExH.hpp22
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp63
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp104
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp23
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp40
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp20
-rw-r--r--ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp26
-rw-r--r--ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp18
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp63
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp90
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp23
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/Exception.hpp29
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Container.hpp182
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Shell.hpp86
-rw-r--r--ACE/contrib/utility/Utility/Hetero/TypeList.hpp46
-rw-r--r--ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp57
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Vector.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Introspection.hpp14
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Makefile19
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.cpp24
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.ipp48
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.cpp21
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.ipp37
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.tpp18
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp104
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp77
-rw-r--r--ACE/contrib/utility/Utility/Makefile16
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp96
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp105
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp60
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp122
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp84
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp22
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp20
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp16
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp103
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp170
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp108
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp167
-rw-r--r--ACE/contrib/utility/Utility/Synch/Policy/Null.hpp54
-rw-r--r--ACE/contrib/utility/Utility/Synch/Policy/Null.ipp20
47 files changed, 2719 insertions, 0 deletions
diff --git a/ACE/contrib/utility/Utility/ExH/Compound.hpp b/ACE/contrib/utility/Utility/ExH/Compound.hpp
new file mode 100644
index 00000000000..664583fffb2
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Compound.hpp
@@ -0,0 +1,47 @@
+// file : Utility/ExH/Compound.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_COMPOUND_HPP
+#define UTILITY_EX_H_COMPOUND_HPP
+
+#include <string>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename Type, typename Base>
+ class Compound : public virtual Base
+ {
+ public:
+ explicit
+ Compound (char const* description) throw ();
+
+ explicit
+ Compound (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ Compound (T const& description) throw ();
+
+ Compound (Compound const& src) throw ();
+
+ virtual
+ ~Compound () throw ();
+
+ public:
+ Compound&
+ operator= (Compound const& src) throw ();
+
+ protected:
+ Compound () throw ();
+ };
+ }
+}
+
+#include "Utility/ExH/Compound.tpp"
+
+#endif // UTILITY_EX_H_COMPOUND_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Compound.tpp b/ACE/contrib/utility/Utility/ExH/Compound.tpp
new file mode 100644
index 00000000000..a4c798d97cb
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Compound.tpp
@@ -0,0 +1,71 @@
+// file : Utility/ExH/Compound.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ // c-tor's & d-tor
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound () throw ()
+ {
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (char const* description) throw ()
+ {
+ Base::init (description);
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (std::string const& description) throw ()
+ {
+ try
+ {
+ Base::init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ template <typename Type, typename Base>
+ template <typename T>
+ Compound<Type, Base>::
+ Compound (T const& description) throw ()
+ {
+ Base::init (converter<T> (description).c_str ());
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (Compound const& src) throw ()
+ {
+ Base::init (src.what ());
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ ~Compound () throw ()
+ {
+ }
+
+ // operator=
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>& Compound<Type, Base>::
+ operator= (Compound const& src) throw ()
+ {
+ Base::init (src.what ());
+ return *this;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Converter.hpp b/ACE/contrib/utility/Utility/ExH/Converter.hpp
new file mode 100644
index 00000000000..563114fd1c4
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Converter.hpp
@@ -0,0 +1,24 @@
+// file : Utility/ExH/Converter.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_CONVERTER_HPP
+#define UTILITY_EX_H_CONVERTER_HPP
+
+#include <string>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename T>
+ std::string
+ converter (T const& t);
+ }
+}
+
+#include "Utility/ExH/Converter.tpp"
+
+#endif // UTILITY_EX_H_CONVERTER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Converter.tpp b/ACE/contrib/utility/Utility/ExH/Converter.tpp
new file mode 100644
index 00000000000..2d48015fe80
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Converter.tpp
@@ -0,0 +1,19 @@
+// file : Utility/ExH/Converter.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename T>
+ std::string
+ converter (T const& t)
+ {
+ // Default implementation just assumes that implicit converion exist.
+ return t;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/ExH.hpp b/ACE/contrib/utility/Utility/ExH/ExH.hpp
new file mode 100644
index 00000000000..722ecd02d25
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/ExH.hpp
@@ -0,0 +1,22 @@
+// file : Utility/ExH/ExH.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_EX_H_HPP
+#define UTILITY_EX_H_EX_H_HPP
+
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/System/DescriptiveException.hpp"
+
+#include "Utility/ExH/Logic/Exception.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ExH/Compound.hpp"
+
+#include "Utility/ExH/Converter.hpp"
+#include "Utility/ExH/StringStreamConverter.hpp"
+
+#endif // UTILITY_EX_H_EX_H_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp
new file mode 100644
index 00000000000..9559014e64d
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp
@@ -0,0 +1,63 @@
+// file : Utility/ExH/Logic/DescriptiveException.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+#define UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+
+#include <memory>
+#include <string>
+
+
+#include "Utility/ExH/Logic/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ class DescriptiveException : public virtual Exception
+ {
+ public:
+ explicit
+ DescriptiveException (char const* description) throw ();
+
+ explicit
+ DescriptiveException (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ DescriptiveException (T const& description) throw ();
+
+ DescriptiveException (DescriptiveException const& src) throw ();
+
+ virtual
+ ~DescriptiveException () throw ();
+
+ DescriptiveException&
+ operator= (DescriptiveException const& src) throw ();
+
+ protected:
+ DescriptiveException () throw ();
+
+ void
+ init (char const* description) throw ();
+
+ public:
+ virtual char const*
+ what () const throw ();
+
+ private:
+ std::auto_ptr<std::string> description_;
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/Logic/DescriptiveException.ipp"
+#include "Utility/ExH/Logic/DescriptiveException.tpp"
+
+#endif // UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
new file mode 100644
index 00000000000..4a50a687777
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
@@ -0,0 +1,104 @@
+// file : Utility/ExH/Logic/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ // c-tor's & d-tor
+
+ inline DescriptiveException::
+ DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (char const* description) throw ()
+ {
+ init (description);
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (std::string const& description) throw ()
+ {
+ try
+ {
+ init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ }
+
+ inline DescriptiveException::
+ ~DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException& DescriptiveException::
+ operator= (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ return *this;
+ }
+
+
+ // accessors / modifiers
+
+ inline void
+ DescriptiveException::init (char const* description) throw ()
+ {
+ try
+ {
+ if (description == 0 || description[0] == '\0')
+ {
+ description_.reset (0);
+ }
+ else
+ {
+ if (description_.get () != 0)
+ {
+ *description_ = description;
+ }
+ else
+ {
+ description_.reset (new std::string (description));
+ }
+ }
+ }
+ catch (...)
+ {
+ description_.reset (0);
+ }
+ }
+
+ inline char const*
+ DescriptiveException::what () const throw ()
+ {
+ try
+ {
+ if (description_.get () != 0)
+ {
+ return description_->c_str ();
+ }
+ }
+ catch (...)
+ {
+ }
+
+ return Exception::what ();
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp
new file mode 100644
index 00000000000..02c65a67e2b
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp
@@ -0,0 +1,23 @@
+// file : Utility/ExH/Logic/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ template <typename T>
+ DescriptiveException::
+ DescriptiveException (T const& description) throw ()
+ {
+ init (converter<T> (description).c_str ());
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp
new file mode 100644
index 00000000000..e91e1811622
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp
@@ -0,0 +1,40 @@
+// file : Utility/ExH/Logic/Exception.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+#define UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+
+#include "Utility/ExH/System/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+
+ // Logic::Exception inherits from System::Exception for the
+ // following reason. Semantically for some part of the
+ // system particular instance of Logic::Exception may seem as
+ // opaque System::Exception and the only way to handle it would
+ // be to propagate it further. In other words Logic::Exception
+ // can be seemlesly "converted" to System::Exception if there is
+ // no part of the system interested in handling it.
+ //
+
+ class Exception : public virtual System::Exception
+ {
+ public:
+ virtual
+ ~Exception () throw ();
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/Logic/Exception.ipp"
+
+#endif // UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp
new file mode 100644
index 00000000000..d3b774be937
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp
@@ -0,0 +1,20 @@
+// file : Utility/ExH/Logic/Exception.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ inline Exception::
+ ~Exception () throw ()
+ {
+ }
+ }
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp
new file mode 100644
index 00000000000..a9a495f22e2
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp
@@ -0,0 +1,26 @@
+// file : Utility/ExH/StringStreamConverter.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+#define UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+
+#include <sstream>
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ std::string
+ converter (std::ostringstream const& t);
+ }
+}
+
+#include "Utility/ExH/StringStreamConverter.ipp"
+
+#endif // UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp
new file mode 100644
index 00000000000..e454ac3f96c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp
@@ -0,0 +1,18 @@
+// file : Utility/ExH/StringStreamConverter.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ inline std::string
+ converter (std::ostringstream const& t)
+ {
+ return t.str ();
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp
new file mode 100644
index 00000000000..8bc3de8ba1e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp
@@ -0,0 +1,63 @@
+// file : Utility/ExH/System/DescriptiveException.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+#define UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+
+#include <string>
+#include "Utility/ExH/System/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ class DescriptiveException : public virtual Exception
+ {
+ public:
+ explicit
+ DescriptiveException (char const* description) throw ();
+
+ explicit
+ DescriptiveException (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ DescriptiveException (T const& description) throw ();
+
+ DescriptiveException (DescriptiveException const& src) throw ();
+
+ virtual
+ ~DescriptiveException () throw ();
+
+ DescriptiveException&
+ operator= (DescriptiveException const& src) throw ();
+
+ protected:
+ DescriptiveException () throw ();
+
+ void
+ init (char const* description) throw ();
+
+ public:
+ virtual char const*
+ what () const throw ();
+
+ private:
+
+ static unsigned long const DESCRIPTION_SIZE = 256;
+
+ char description_ [DESCRIPTION_SIZE];
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/System/DescriptiveException.ipp"
+#include "Utility/ExH/System/DescriptiveException.tpp"
+
+#endif // UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp
new file mode 100644
index 00000000000..d9768a518eb
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp
@@ -0,0 +1,90 @@
+// file : Utility/ExH/System/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include <cstring>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ // c-tor's & d-tor
+
+ inline DescriptiveException::
+ DescriptiveException () throw ()
+ {
+ description_[0] = '\0';
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (char const* description) throw ()
+ {
+ init (description);
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (std::string const& description) throw ()
+ {
+ try
+ {
+ init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ }
+
+ inline DescriptiveException::
+ ~DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException& DescriptiveException::
+ operator= (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ return *this;
+ }
+
+
+ // accessors / modifiers
+
+ inline void DescriptiveException::
+ init (char const* description) throw ()
+ {
+ if (description != 0)
+ {
+ std::strncpy (description_, description, DESCRIPTION_SIZE - 1);
+ description_[DESCRIPTION_SIZE - 1] = '\0';
+ }
+ else
+ {
+ description_[0] = '\0';
+ }
+ }
+
+ inline char const* DescriptiveException::
+ what () const throw ()
+ {
+ if (description_[0] != '\0')
+ {
+ return description_;
+ }
+ else
+ {
+ return Exception::what ();
+ }
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp
new file mode 100644
index 00000000000..320216acc2e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp
@@ -0,0 +1,23 @@
+// file : Utility/ExH/System/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ template <typename T>
+ inline DescriptiveException::
+ DescriptiveException (T const& description) throw ()
+ {
+ init (converter<T> (description).c_str ());
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/Exception.hpp b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp
new file mode 100644
index 00000000000..0ed7fbfa975
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp
@@ -0,0 +1,29 @@
+// file : Utility/ExH/System/Exception.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+#define UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+
+#include <exception>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ // This is the only way to make predefined exceptions like
+ // std::bad_alloc, etc to appear in the right place of the hierarchy.
+ //
+
+ typedef std::exception Exception;
+ }
+ }
+}
+
+#endif // UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Container.hpp b/ACE/contrib/utility/Utility/Hetero/Container.hpp
new file mode 100644
index 00000000000..d28d5fff0c4
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Container.hpp
@@ -0,0 +1,182 @@
+// file : Utility/Hetero/Container.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_CONTAINER_HPP
+#define UTILITY_HETERO_CONTAINER_HPP
+
+#include <typeinfo>
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ //
+ //
+ //
+ class Typing {};
+
+ //
+ //
+ //
+ class Container
+ {
+ public:
+ ~Container ()
+ {
+ delete holder_;
+ }
+
+ public:
+ template <typename T>
+ Container (T const& t)
+ : holder_ (new TypedHolder<T> (t))
+ {
+ }
+
+ Container (Container const& c)
+ : holder_ (c.holder_->clone ())
+ {
+ }
+
+ public:
+ template <typename T>
+ Container&
+ operator= (T const& t)
+ {
+ delete holder_;
+ holder_ = 0;
+ holder_ = new TypedHolder<T> (t);
+ return *this;
+ }
+
+ Container&
+ operator= (Container const& c)
+ {
+ delete holder_;
+ holder_ = 0;
+ holder_ = c.holder_->clone ();
+ return *this;
+ }
+
+ public:
+ template <typename T>
+ operator T& ()
+ {
+ return value<T> ();
+ }
+
+ template <typename T>
+ operator T const& () const
+ {
+ return value<T> ();
+ }
+
+ public:
+ template <typename T>
+ T&
+ value ()
+ {
+ if (holder_->type () == typeid (T))
+ {
+ return dynamic_cast<TypedHolder<T>*>(holder_)->value ();
+ }
+ else
+ {
+ throw Typing ();
+ }
+ }
+
+ template <typename T>
+ T const&
+ value () const
+ {
+ if (holder_->type () == typeid (T))
+ {
+ return dynamic_cast<TypedHolder<T>*>(holder_)->value ();
+ }
+ else
+ {
+ throw Typing ();
+ }
+ }
+
+ public:
+ std::type_info const&
+ type () const
+ {
+ return holder_->type ();
+ }
+
+ public:
+ template <typename T>
+ friend T
+ operator+ (Container const& a, T const& b)
+ {
+ return a.value<T> () + b;
+ }
+
+ template <typename T>
+ friend T
+ operator+ (T const& a, Container const& b)
+ {
+ return a + b.value<T> ();
+ }
+
+ private:
+ struct Holder
+ {
+ virtual
+ ~Holder () {}
+
+ virtual Holder*
+ clone () const = 0;
+
+ virtual std::type_info const&
+ type () const = 0;
+ };
+
+ template <typename T>
+ struct TypedHolder : public Holder
+ {
+ TypedHolder (T const& value)
+ : value_ (value)
+ {
+ }
+
+ virtual Holder*
+ clone () const
+ {
+ return new TypedHolder<T> (value_);
+ }
+
+ virtual std::type_info const&
+ type () const
+ {
+ return typeid (T);
+ }
+
+ T const&
+ value () const
+ {
+ return value_;
+ }
+
+ T&
+ value ()
+ {
+ return value_;
+ }
+
+ private:
+ T value_;
+ };
+
+ Holder* holder_;
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_CONTAINER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Shell.hpp b/ACE/contrib/utility/Utility/Hetero/Shell.hpp
new file mode 100644
index 00000000000..0d37a6ba09d
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Shell.hpp
@@ -0,0 +1,86 @@
+// file : Utility/Hetero/Shell.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_SHELL_HPP
+#define UTILITY_HETERO_SHELL_HPP
+
+namespace Utility
+{
+ namespace Hetero
+ {
+
+ //
+ //
+ //
+ class ShellCore
+ {
+ protected:
+ template <typename F, typename T0>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ template <typename F, typename T0, typename T1>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0, T1> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+ if (type_check <T1> (c)) return type_apply<T1> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ template <typename F, typename T0, typename T1, typename T2>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0, T1, T2> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+ if (type_check <T1> (c)) return type_apply<T1> (f, c);
+ if (type_check <T2> (c)) return type_apply<T2> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ private:
+ template <typename T>
+ static bool
+ type_check (Container& c)
+ {
+ return c.type () == typeid (T);
+ }
+
+ template <typename T, typename F>
+ static typename F::RetType
+ type_apply (F& f, Container& c)
+ {
+ return f (c. template value<T> ());
+ }
+ };
+
+
+ //
+ //
+ //
+ template <typename F>
+ struct Shell : F, ShellCore
+ {
+ using F::operator ();
+
+ template <typename T>
+ typename F::RetType
+ operator () (TypedContainer<T>& p)
+ {
+ return apply (*this, p);
+ }
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_SHELL_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/TypeList.hpp b/ACE/contrib/utility/Utility/Hetero/TypeList.hpp
new file mode 100644
index 00000000000..ee7e96c2bcd
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/TypeList.hpp
@@ -0,0 +1,46 @@
+// file : Utility/Hetero/TypeList.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_TYPE_LIST_HPP
+#define UTILITY_HETERO_TYPE_LIST_HPP
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ class NullType {};
+
+ template <typename t0 = NullType,
+ typename t1 = NullType,
+ typename t2 = NullType>
+ struct TypeList
+ {
+ typedef t0 T0;
+ typedef t1 T1;
+ typedef t2 T2;
+ };
+
+ template <typename t0, typename t1>
+ struct TypeList<t0, t1, NullType>
+ {
+ typedef t0 T0;
+ typedef t1 T1;
+ };
+
+ template <typename t0>
+ struct TypeList<t0, NullType, NullType>
+ {
+ typedef t0 T0;
+ };
+
+ template <>
+ struct TypeList<NullType, NullType, NullType>
+ {
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_TYPE_LIST_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp b/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp
new file mode 100644
index 00000000000..67f94bda0ec
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp
@@ -0,0 +1,57 @@
+// file : Utility/Hetero/TypedContainer.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_TYPED_CONTAINER_HPP
+#define UTILITY_HETERO_TYPED_CONTAINER_HPP
+
+#include "Utility/Hetero/Container.hpp"
+#include "Utility/Hetero/TypeList.hpp"
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ template <typename TL>
+ class TypedContainer : public Container
+ {
+ public:
+ typedef TL Types;
+
+ public:
+ template <typename T>
+ TypedContainer (T const& t)
+ : Container (t)
+ {
+ }
+
+ TypedContainer (TypedContainer const& c)
+ : Container (static_cast<Container const&> (c))
+ {
+ }
+
+ public:
+ template <typename T>
+ TypedContainer&
+ operator= (T const& t)
+ {
+ Container& self = *this;
+ self = t;
+ return *this;
+ }
+
+ TypedContainer&
+ operator= (TypedContainer const& c)
+ {
+ Container& self = *this;
+ Container const& other = c;
+ self = other;
+ return *this;
+ }
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_TYPED_CONTAINER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Vector.hpp b/ACE/contrib/utility/Utility/Hetero/Vector.hpp
new file mode 100644
index 00000000000..3826bd6bb1f
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Vector.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Hetero/Vector.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_VECTOR_HPP
+#define UTILITY_HETERO_VECTOR_HPP
+
+#include <vector>
+
+#include "Utility/Hetero/TypeList.hpp"
+#include "Utility/Hetero/TypedContainer.hpp"
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ template <typename T0 = NullType,
+ typename T1 = NullType,
+ typename T2 = NullType>
+ class Vector;
+
+ template <>
+ class Vector<NullType, NullType, NullType>;
+
+ template <typename T0>
+ class Vector<T0, NullType, NullType> :
+ public std::vector<TypedContainer<TypeList<T0> > >
+ {
+ };
+
+ template <typename T0, typename T1>
+ class Vector<T0, T1, NullType> :
+ public std::vector<TypedContainer<TypeList<T0, T1> > >
+ {
+ };
+
+ template <typename T0, typename T1, typename T2>
+ class Vector :
+ public std::vector<TypedContainer<TypeList<T0, T1, T2> > >
+ {
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_VECTOR_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Introspection.hpp b/ACE/contrib/utility/Utility/Introspection/Introspection.hpp
new file mode 100644
index 00000000000..d514f62837a
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Introspection.hpp
@@ -0,0 +1,14 @@
+// file : Utility/Introspection/Introspection.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_INTROSPECTION_HPP
+#define UTILITY_INTROSPECTION_INTROSPECTION_HPP
+
+#include "Utility/Introspection/TypeId.hpp"
+#include "Utility/Introspection/TypeInfo.hpp"
+#include "Utility/Introspection/Object.hpp"
+
+#endif // UTILITY_INTROSPECTION_INTROSPECTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Makefile b/ACE/contrib/utility/Utility/Introspection/Makefile
new file mode 100644
index 00000000000..43f2f67cb51
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Makefile
@@ -0,0 +1,19 @@
+# file : Utility/Introspection/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Archive.pre.rules)
+
+cxx_translation_units := TypeId.cpp Object.cpp
+
+module_base := Introspection
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+$(call include, $(root)/BuildRules/Archive.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.cpp b/ACE/contrib/utility/Utility/Introspection/Object.cpp
new file mode 100644
index 00000000000..015a2736aad
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.cpp
@@ -0,0 +1,24 @@
+// file : Utility/Introspection/Object.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Introspection/Object.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ namespace
+ {
+ TypeInfo object_ (typeid (Object));
+ }
+
+ TypeInfo const& Object::
+ static_type_info () throw ()
+ {
+ return object_;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.hpp b/ACE/contrib/utility/Utility/Introspection/Object.hpp
new file mode 100644
index 00000000000..fdf8228c9f3
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Introspection/Object.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_OBJECT_HPP
+#define UTILITY_INTROSPECTION_OBJECT_HPP
+
+#include "Utility/Introspection/TypeInfo.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ class Object
+ {
+ public:
+ static TypeInfo const&
+ static_type_info () throw ();
+
+ virtual TypeInfo const&
+ type_info () const throw ();
+
+ protected:
+ virtual
+ ~Object ();
+
+ Object () throw ();
+ Object (Object const&) throw ();
+
+ Object&
+ operator= (Object const&) throw ();
+
+ protected:
+ virtual void
+ type_info (TypeInfo const& tid) throw ();
+
+ private:
+ TypeInfo const* type_info_;
+ };
+ }
+}
+
+#include "Utility/Introspection/Object.ipp"
+
+#endif // UTILITY_INTROSPECTION_OBJECT_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.ipp b/ACE/contrib/utility/Utility/Introspection/Object.ipp
new file mode 100644
index 00000000000..7b5de978c6e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.ipp
@@ -0,0 +1,48 @@
+// file : Utility/Introspection/Object.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ inline TypeInfo const& Object::
+ type_info () const throw ()
+ {
+ return *type_info_;
+ }
+
+ inline Object::
+ ~Object ()
+ {
+ }
+
+ inline Object::
+ Object () throw ()
+ {
+ type_info (static_type_info ());
+ }
+
+
+ inline Object::
+ Object (Object const&) throw ()
+ {
+ type_info (static_type_info ());
+ }
+
+
+ inline Object& Object::
+ operator= (Object const&) throw ()
+ {
+ return *this;
+ }
+
+ inline void Object::
+ type_info (TypeInfo const& tid) throw ()
+ {
+ type_info_ = &tid;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.cpp b/ACE/contrib/utility/Utility/Introspection/TypeId.cpp
new file mode 100644
index 00000000000..a0ceddac2a1
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.cpp
@@ -0,0 +1,21 @@
+// file : Utility/Introspection/TypeId.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Introspection/TypeId.hpp"
+
+#include <ostream>
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ std::ostream&
+ operator << (std::ostream& os, TypeId const& t)
+ {
+ return os << t.tid_->name ();
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.hpp b/ACE/contrib/utility/Utility/Introspection/TypeId.hpp
new file mode 100644
index 00000000000..51f66f99a0b
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Introspection/TypeId.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_TYPE_ID_HPP
+#define UTILITY_INTROSPECTION_TYPE_ID_HPP
+
+#include <typeinfo>
+#include <iosfwd>
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ class TypeId
+ {
+ public:
+ template<typename T>
+ TypeId (T const& t);
+
+ TypeId (std::type_info const& tid);
+
+ public:
+ bool
+ operator == (TypeId const& other) const;
+
+ bool
+ operator != (TypeId const& other) const;
+
+ bool
+ operator < (TypeId const& other) const;
+
+ friend std::ostream&
+ operator << (std::ostream& os, TypeId const& t);
+
+ private:
+ std::type_info const* tid_;
+ };
+ }
+}
+
+#include "Utility/Introspection/TypeId.tpp"
+#include "Utility/Introspection/TypeId.ipp"
+
+#endif // UTILITY_INTROSPECTION_TYPE_ID_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.ipp b/ACE/contrib/utility/Utility/Introspection/TypeId.ipp
new file mode 100644
index 00000000000..83a5a503517
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.ipp
@@ -0,0 +1,37 @@
+// file : Utility/Introspection/TypeId.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+// cvs-id : $Id$
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ inline TypeId::
+ TypeId (std::type_info const& tid)
+ : tid_ (&tid)
+ {
+ }
+
+
+ inline bool TypeId::
+ operator == (TypeId const& other) const
+ {
+ return *tid_ == *other.tid_;
+ }
+
+ inline bool TypeId::
+ operator != (TypeId const& other) const
+ {
+ return *tid_ != *other.tid_;
+ }
+
+ inline bool TypeId::
+ operator < (TypeId const& other) const
+ {
+ return tid_->before (*other.tid_);
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.tpp b/ACE/contrib/utility/Utility/Introspection/TypeId.tpp
new file mode 100644
index 00000000000..7c3daef603c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.tpp
@@ -0,0 +1,18 @@
+// file : Utility/Introspection/TypeId.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ template<typename T>
+ inline TypeId::
+ TypeId (T const& t)
+ : tid_ (&typeid (t))
+ {
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp b/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp
new file mode 100644
index 00000000000..4321fdc522c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp
@@ -0,0 +1,104 @@
+// file : Utility/Introspection/TypeInfo.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_TYPE_INFO_HPP
+#define UTILITY_INTROSPECTION_TYPE_INFO_HPP
+
+#include <vector>
+
+#include "Utility/Introspection/TypeId.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ //
+ //
+ //
+ struct Access
+ {
+ enum Value
+ {
+ PRIVATE,
+ PROTECTED,
+ PUBLIC
+ };
+ };
+
+ // Forward declaration of class TypeInfo.
+ //
+ //
+ class TypeInfo;
+
+ //
+ //
+ //
+ class BaseInfo
+ {
+ public:
+ BaseInfo (Access::Value access,
+ bool virtual_base,
+ TypeInfo const& ti);
+
+ public:
+ TypeInfo const&
+ type_info () const;
+
+ Access::Value
+ access () const;
+
+ bool
+ virtual_base () const;
+
+ private:
+ TypeInfo const* ti_;
+ bool virtual_base_;
+ Access::Value access_;
+ };
+
+
+ //
+ //
+ //
+ class TypeInfo
+ {
+ private:
+ typedef
+ std::vector<BaseInfo>
+ BaseInfoList;
+
+ public:
+ typedef
+ BaseInfoList::const_iterator
+ BaseIterator;
+
+ public:
+ TypeInfo (TypeId const& tid);
+
+ TypeId
+ type_id () const;
+
+ BaseIterator
+ begin_base () const;
+
+ BaseIterator
+ end_base () const;
+
+ void
+ add_base (Access::Value access,
+ bool virtual_base,
+ TypeInfo const& ti);
+
+ private:
+ TypeId tid_;
+ BaseInfoList base_;
+ };
+ }
+}
+
+#include "Utility/Introspection/TypeInfo.ipp"
+
+#endif // UTILITY_INTROSPECTION_TYPE_INFO_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp b/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp
new file mode 100644
index 00000000000..395cf7d6539
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp
@@ -0,0 +1,77 @@
+// file : Utility/Introspection/TypeInfo.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ // BaseInfo
+ //
+ //
+
+ inline BaseInfo::
+ BaseInfo (Access::Value access, bool virtual_base, TypeInfo const& ti)
+ : ti_ (&ti),
+ virtual_base_ (virtual_base),
+ access_ (access)
+ {
+ }
+
+ inline TypeInfo const& BaseInfo::
+ type_info () const
+ {
+ return *ti_;
+ }
+
+
+ inline Access::Value BaseInfo::
+ access () const
+ {
+ return access_;
+ }
+
+ inline bool BaseInfo::
+ virtual_base () const
+ {
+ return virtual_base_;
+ }
+
+
+ // TypeInfo
+ //
+ //
+ inline TypeInfo::
+ TypeInfo (TypeId const& tid)
+ : tid_ (tid)
+ {
+ }
+
+ inline TypeId TypeInfo::
+ type_id () const
+ {
+ return tid_;
+ }
+
+ inline TypeInfo::BaseIterator TypeInfo::
+ begin_base () const
+ {
+ return base_.begin ();
+ }
+
+
+ inline TypeInfo::BaseIterator TypeInfo::
+ end_base () const
+ {
+ return base_.end ();
+ }
+
+ inline void TypeInfo::
+ add_base (Access::Value access, bool virtual_base, TypeInfo const& ti)
+ {
+ base_.push_back (BaseInfo (access, virtual_base, ti));
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Makefile b/ACE/contrib/utility/Utility/Makefile
new file mode 100644
index 00000000000..e6951f317fa
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Makefile
@@ -0,0 +1,16 @@
+# file : Utility/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Introspection
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp
new file mode 100644
index 00000000000..43160c09a03
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp
@@ -0,0 +1,96 @@
+// file : Utility/ReferenceCounting/DefaultImpl.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+#define UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/Synch/Policy/Null.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // Default reference counter implementation with parameterised
+ // synchronization policy. It is assumed that none of the SynchPolicy
+ // types throw any logic exceptions. If in fact they do then these
+ // exceptions won't be handled and will be automatically converted
+ // to system exceptions.
+
+ template <typename SynchPolicy = Utility::Synch::Policy::Null>
+ class DefaultImpl : public virtual Interface
+ {
+ public:
+ class InconsistentState_ {};
+ typedef
+ ExH::Compound<InconsistentState_, Exception>
+ InconsistentState;
+
+ public:
+ DefaultImpl () throw (SystemException);
+
+ virtual
+ ~DefaultImpl () throw ();
+
+ public:
+ virtual void
+ add_ref () const throw (Exception, SystemException);
+
+ virtual void
+ remove_ref () const throw ();
+
+ virtual count_t
+ refcount_value () const throw (Exception, SystemException);
+
+ protected:
+ virtual void
+ add_ref_i () const throw (Exception, SystemException);
+
+ virtual bool
+ remove_ref_i () const throw (Exception, SystemException);
+
+ virtual count_t
+ refcount_value_i () const throw (Exception, SystemException);
+
+ typename SynchPolicy::Mutex&
+ lock_i () const throw ();
+
+ protected:
+ typedef
+ typename SynchPolicy::Mutex
+ Mutex_;
+
+ typedef
+ typename SynchPolicy::ReadGuard
+ ReadGuard_;
+
+ typedef
+ typename SynchPolicy::WriteGuard
+ WriteGuard_;
+
+ protected:
+ mutable count_t ref_count_;
+
+ private:
+ mutable Mutex_ lock_;
+
+ private:
+ // Copy semanic is not supported.
+ DefaultImpl (DefaultImpl const&) throw ();
+ DefaultImpl&
+ operator= (DefaultImpl const&) throw ();
+ };
+ }
+}
+
+#include "Utility/ReferenceCounting/DefaultImpl.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp
new file mode 100644
index 00000000000..bac28c77ea2
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp
@@ -0,0 +1,105 @@
+// file : Utility/ReferenceCounting/DefaultImpl.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor & d-tor
+
+ template <typename SynchPolicy>
+ DefaultImpl<SynchPolicy>::
+ DefaultImpl () throw (Interface::SystemException)
+ : ref_count_ (1),
+ lock_ ()
+ {
+ }
+
+ template <typename SynchPolicy>
+ DefaultImpl<SynchPolicy>::
+ ~DefaultImpl () throw ()
+ {
+ }
+
+ // add_ref, remove_ref and refcount_value member functions
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ add_ref () const throw (Exception, SystemException)
+ {
+ WriteGuard_ guard (lock_);
+ add_ref_i ();
+ }
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ remove_ref () const throw ()
+ {
+ bool destroy (false);
+ try
+ {
+ WriteGuard_ guard (lock_);
+ destroy = remove_ref_i ();
+ }
+ catch (...)
+ {
+ // there is nothing we can do
+ }
+
+ if (destroy) delete this;
+ }
+
+ template <typename SynchPolicy>
+ Interface::count_t DefaultImpl<SynchPolicy>::
+ refcount_value () const throw (Exception, SystemException)
+ {
+ ReadGuard_ guard (lock_);
+ return refcount_value_i ();
+ }
+
+ // add_ref_i, remove_ref_i and refcount_value_i member functions
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ add_ref_i () const throw (Exception, SystemException)
+ {
+ ref_count_++;
+ }
+
+ template <typename SynchPolicy>
+ bool DefaultImpl<SynchPolicy>::
+ remove_ref_i () const throw (Exception, SystemException)
+ {
+ bool destroy (false);
+ if (ref_count_ > 0)
+ {
+ if (--ref_count_ == 0) destroy = true;
+ }
+ else
+ {
+ throw InconsistentState (
+ "Utility::ReferenceCounting::DefaultImpl::_remove_ref_i: "
+ "reference counter is zero.");
+ }
+ return destroy;
+
+ }
+
+ template <typename SynchPolicy>
+ Interface::count_t DefaultImpl<SynchPolicy>::
+ refcount_value_i () const throw (Exception, SystemException)
+ {
+ return ref_count_;
+ }
+
+ template <typename SynchPolicy>
+ typename SynchPolicy::Mutex& DefaultImpl<SynchPolicy>::
+ lock_i() const throw ()
+ {
+ return lock_;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp
new file mode 100644
index 00000000000..20346e859b3
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp
@@ -0,0 +1,60 @@
+// file : Utility/ReferenceCounting/ExternalLockImpl.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+#define UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+
+ /*
+
+ Not ported yet.
+
+ class ExternalLockRefCounter : public virtual Util::RefCountBase
+ {
+ public:
+ ExternalLockRefCounter (ACE_Lock* lock = 0);
+ virtual ~ExternalLockRefCounter ();
+
+ void init (ACE_Lock* lock);
+
+ public:
+
+ virtual void _add_ref ();
+ virtual void _remove_ref ();
+ virtual unsigned long _refcount_value ();
+
+ protected:
+
+ virtual void _add_ref_i ();
+ virtual bool _remove_ref_i ();
+ virtual unsigned long _refcount_value_i ();
+
+ ACE_Lock* lock_i ();
+
+ private:
+
+ typedef ACE_Guard <ACE_Lock> Guard_;
+
+ ACE_Lock* lock_;
+ unsigned long ref_count_;
+
+ private:
+ ExternalLockRefCounter (const ExternalLockRefCounter& );
+ void operator= (const ExternalLockRefCounter& );
+ };
+
+ */
+ }
+}
+
+#include "Utility/ReferenceCounting/ExternalLockImpl.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp
new file mode 100644
index 00000000000..7552d411f27
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp
@@ -0,0 +1,122 @@
+// file : Utility/ReferenceCounting/ExternalLockImpl.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ /*
+ inline
+ ExternalLockRefCounter::ExternalLockRefCounter (ACE_Lock* lock)
+ : lock_ (lock),
+ ref_count_ (1)
+ {
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::init (ACE_Lock* lock)
+ {
+ lock_ = lock;
+ }
+
+ inline
+ ExternalLockRefCounter::~ExternalLockRefCounter ()
+ {
+ }
+
+ inline
+ ACE_Lock*
+ ExternalLockRefCounter::lock_i ()
+ {
+ return lock_;
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_add_ref ()
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ _add_ref_i ();
+ }
+ else
+ {
+ _add_ref_i ();
+ }
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_remove_ref ()
+ {
+ bool destroy = false;
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ destroy = _remove_ref_i ();
+ }
+ else
+ {
+ destroy = _remove_ref_i ();
+ }
+ }
+ if (destroy) delete this;
+ }
+
+ inline
+ unsigned long
+ ExternalLockRefCounter::_refcount_value ()
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ return _refcount_value_i ();
+ }
+ else
+ {
+ return _refcount_value_i ();
+ }
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_add_ref_i ()
+ {
+ ref_count_++;
+ }
+
+ inline
+ bool
+ ExternalLockRefCounter::_remove_ref_i ()
+ {
+ bool destroy = false;
+ if (ref_count_ > 0)
+ {
+ if (--ref_count_ == 0) destroy = true;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ExternalLockRefCounter::_remove_ref() "
+ " _remove_ref() called while ref_coundt == 0\n"
+ ));
+ }
+ return destroy;
+ }
+
+ inline
+ unsigned long
+ ExternalLockRefCounter::_refcount_value_i ()
+ {
+ return ref_count_;
+ }
+ */
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp
new file mode 100644
index 00000000000..9231860b84a
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp
@@ -0,0 +1,84 @@
+// file : Utility/ReferenceCounting/Interface.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+#define UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/Logic/Exception.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // Interface to a reference-countable object. Note that _remove_ref ()
+ // member function has a no-throw semantic. Even though it can lead to
+ // a diagnostic loss it was made no-throw because it has a destructor
+ // semantic.
+
+ class Interface
+ {
+ public:
+ typedef
+ unsigned long
+ count_t;
+
+ typedef
+ ExH::System::Exception
+ SystemException;
+
+ class Exception_ {};
+ typedef
+ ExH::Compound<Exception_, ExH::Logic::DescriptiveException>
+ Exception;
+
+ public:
+ virtual void
+ add_ref () const throw (Exception, SystemException) = 0;
+
+ virtual void
+ remove_ref () const throw () = 0;
+
+ virtual count_t
+ refcount_value () const throw (Exception, SystemException) = 0;
+
+ protected:
+ Interface () throw ();
+
+ virtual
+ ~Interface () throw ();
+
+ protected:
+ virtual void
+ add_ref_i () const throw (Exception, SystemException) = 0;
+
+ virtual bool
+ remove_ref_i () const throw (Exception, SystemException) = 0;
+
+ virtual count_t
+ refcount_value_i () const throw (Exception, SystemException) = 0;
+
+ private:
+ // Copy semanic is not supported.
+ Interface (Interface const&) throw ();
+ Interface&
+ operator= (Interface const&) throw ();
+ };
+
+ template <typename Type>
+ Type*
+ add_ref (Type* ptr)
+ throw (Interface::Exception, Interface::SystemException);
+ }
+}
+
+#include "Utility/ReferenceCounting/Interface.tpp"
+#include "Utility/ReferenceCounting/Interface.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp
new file mode 100644
index 00000000000..f901db4b248
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp
@@ -0,0 +1,22 @@
+// file : Utility/ReferenceCounting/Interface.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ inline Interface::
+ ~Interface () throw ()
+ {
+ }
+
+ inline Interface::
+ Interface () throw ()
+ {
+ }
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp
new file mode 100644
index 00000000000..6a6a1d2d263
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp
@@ -0,0 +1,20 @@
+// file : Utility/ReferenceCounting/Interface.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename Type>
+ inline Type*
+ add_ref (Type* ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ if (ptr != 0) ptr->add_ref ();
+ return ptr;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp
new file mode 100644
index 00000000000..a20fe0d888c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp
@@ -0,0 +1,16 @@
+// file : Utility/ReferenceCounting/ReferenceCounting.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+#define UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+#include "Utility/ReferenceCounting/DefaultImpl.hpp"
+#include "Utility/ReferenceCounting/SmartPtr.hpp"
+#include "Utility/ReferenceCounting/StrictPtr.hpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp
new file mode 100644
index 00000000000..682f0678ee1
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp
@@ -0,0 +1,103 @@
+// file : Utility/ReferenceCounting/SmartPtr.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+#define UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename T>
+ class SmartPtr
+ {
+ public:
+ typedef
+ T
+ Type;
+
+ class NotInitialized_ {};
+ typedef
+ ExH::Compound<NotInitialized_, ExH::Logic::DescriptiveException>
+ NotInitialized;
+
+ public:
+ // c-tor's
+
+ SmartPtr () throw ();
+ SmartPtr (Type* ptr) throw ();
+ SmartPtr (SmartPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ template <typename Other>
+ SmartPtr (SmartPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ // d-tor
+
+ ~SmartPtr () throw ();
+
+ // assignment & copy-assignment operators
+
+ SmartPtr<Type>&
+ operator= (Type* ptr) throw ();
+
+ SmartPtr<Type>&
+ operator= (SmartPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ template <typename Other>
+ SmartPtr<Type>&
+ operator= (SmartPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ //conversions
+
+ operator Type* () const throw ();
+
+ // accessors
+
+ Type*
+ operator-> () const throw (NotInitialized);
+
+ Type*
+ in () const throw ();
+
+ Type*
+ retn() throw ();
+
+ private:
+ Type* ptr_;
+ };
+
+ // Specialization of add_ref function for SmartPtr<T>
+ template <typename T>
+ T*
+ add_ref (SmartPtr<T> const& ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+
+ // Dynamic type conversion function for SmartPtr's
+ template <typename D, typename S>
+ D*
+ smart_cast (SmartPtr<S> const& s)
+ throw (Interface::Exception, Interface::SystemException);
+
+ // Acquisition function
+ template <typename T>
+ SmartPtr<T>
+ acquire (T* ptr) throw (Interface::Exception, Interface::SystemException);
+ }
+}
+
+#include "Utility/ReferenceCounting/SmartPtr.tpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp
new file mode 100644
index 00000000000..6596c67f1b1
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp
@@ -0,0 +1,170 @@
+// file : Utility/ReferenceCounting/SmartPtr.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor's & d-tor
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr () throw ()
+ : ptr_ (0)
+ {
+ }
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr (Type* ptr) throw ()
+ : ptr_ (ptr)
+ {
+ }
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr (SmartPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+ template <typename T>
+ template <typename Other>
+ SmartPtr<T>::
+ SmartPtr (SmartPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+
+ template <typename T>
+ SmartPtr<T>::
+ ~SmartPtr () throw ()
+ {
+ // This is an additional catch-all layer to protect from
+ // non-conformant Type.
+ try
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // operator=
+
+ template <typename T>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (Type* ptr) throw ()
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ ptr_ = ptr;
+ return *this;
+ }
+
+
+ template <typename T>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (SmartPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ Type* old_ptr (ptr_);
+ Type* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+
+ template <typename T>
+ template <typename Other>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (SmartPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ Type* old_ptr (ptr_);
+ Other* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+ // conversions
+
+ template <typename T>
+ SmartPtr<T>::
+ operator T* () const throw ()
+ {
+ return ptr_;
+ }
+
+
+ // accessors
+
+ template <typename T>
+ T* SmartPtr<T>::
+ operator-> () const throw (NotInitialized)
+ {
+ if (ptr_ == 0)
+ {
+ throw NotInitialized(
+ "Utility::ReferenceCounting::SmartPtr::operator-> : "
+ "unable to dereference NULL pointer.");
+ }
+ return ptr_;
+ }
+
+ template <typename T>
+ T* SmartPtr<T>::
+ in () const throw ()
+ {
+ return ptr_;
+ }
+
+ template <typename T>
+ T* SmartPtr<T>::
+ retn() throw ()
+ {
+ Type* ret (ptr_);
+ ptr_ = 0;
+ return ret;
+ }
+
+ // Specialization of add_ref function for SmartPtr<T>
+ template <typename T>
+ T*
+ add_ref (SmartPtr<T> const& ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ // delegate to generic implementation
+ return add_ref (ptr.in ());
+ }
+
+ // Dynamic type conversion function for SmartPtr's
+ template <typename D, typename S>
+ D*
+ smart_cast (SmartPtr<S> const& s)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ return add_ref (dynamic_cast<D*>(s.in ()));
+ }
+
+ // Acquisition function
+ template <typename T>
+ SmartPtr<T>
+ acquire (T* ptr) throw (Interface::Exception, Interface::SystemException)
+ {
+ return SmartPtr<T> (ptr);
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp
new file mode 100644
index 00000000000..c88c90d5e50
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp
@@ -0,0 +1,108 @@
+// file : Utility/ReferenceCounting/StrictPtr.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+#define UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename T>
+ class StrictPtr
+ {
+ public:
+ typedef
+ T
+ Type;
+
+ class NotInitialized_ {};
+ typedef
+ ExH::Compound<NotInitialized_, ExH::Logic::DescriptiveException>
+ NotInitialized;
+
+ public:
+ // c-tor's
+
+ StrictPtr () throw ();
+
+ explicit
+ StrictPtr (Type* ptr) throw ();
+
+ StrictPtr (StrictPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ template <typename Other>
+ StrictPtr (StrictPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+ // d-tor
+
+ ~StrictPtr () throw ();
+
+ // assignment & copy-assignment operators
+
+ StrictPtr<Type>&
+ operator= (Type* ptr) throw ();
+
+ StrictPtr<Type>&
+ operator= (StrictPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ template <typename Other>
+ StrictPtr<Type>&
+ operator= (StrictPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ // conversions
+
+ // Note: implicit conversion (operator Type* ()) is not supported.
+
+ // comparison
+
+ bool
+ operator== (Type* other) const throw ();
+
+ bool
+ operator!= (Type* other) const throw ();
+
+ // accessors
+
+ Type*
+ operator-> () const throw (NotInitialized);
+
+ Type*
+ in () const throw ();
+
+ Type*
+ retn() throw ();
+
+ private:
+ Type* ptr_;
+ };
+
+ // Specialization of add_ref function for StrictPtr<T>
+ template <typename T>
+ T*
+ add_ref (StrictPtr<T> const& ptr)
+ throw (Interface::Exception, Interface::SystemException);
+
+ // Dynamic type conversion function for StrictPtr's
+ template <typename D, typename S>
+ StrictPtr<D>
+ strict_cast (StrictPtr<S> const& s)
+ throw (Interface::Exception, Interface::SystemException);
+ }
+}
+
+#include "Utility/ReferenceCounting/StrictPtr.tpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp
new file mode 100644
index 00000000000..6a30188119c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp
@@ -0,0 +1,167 @@
+// file : Utility/ReferenceCounting/StrictPtr.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor's & d-tor
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr () throw ()
+ : ptr_ (0)
+ {
+ }
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr (Type* ptr) throw ()
+ : ptr_ (ptr)
+ {
+ }
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr (StrictPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+ template <typename T>
+ template <typename Other>
+ StrictPtr<T>::
+ StrictPtr (StrictPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+
+ template <typename T>
+ StrictPtr<T>::
+ ~StrictPtr () throw ()
+ {
+ // This is an additional catch-all layer to protect from
+ // non-conformant Type.
+ try
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // operator=
+
+ template <typename T>
+ StrictPtr<T>&
+ StrictPtr<T>::operator= (Type* ptr) throw ()
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ ptr_ = ptr;
+ return *this;
+ }
+
+ template <typename T>
+ StrictPtr<T>& StrictPtr<T>::
+ operator= (StrictPtr<Type> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ Type* old_ptr (ptr_);
+ Type* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+
+ template <typename T>
+ template <typename Other>
+ StrictPtr<T>& StrictPtr<T>::
+ operator= (StrictPtr<Other> const& s_ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ Type* old_ptr (ptr_);
+ Other* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+ // comparison
+
+ template <typename T>
+ bool StrictPtr<T>::
+ operator== (Type* other) const throw ()
+ {
+ return ptr_ == other;
+ }
+
+ template <typename T>
+ bool StrictPtr<T>::
+ operator!= (Type* other) const throw ()
+ {
+ return ptr_ != other;
+ }
+
+ // accessors
+
+ template <typename T>
+ T* StrictPtr<T>::
+ operator-> () const throw (NotInitialized)
+ {
+ if (ptr_ == 0)
+ {
+ throw NotInitialized(
+ "Utility::ReferenceCounting::StrictPtr::operator-> : "
+ "unable to dereference NULL pointer.");
+ }
+ return ptr_;
+ }
+
+ template <typename T>
+ T* StrictPtr<T>::
+ in () const throw ()
+ {
+ return ptr_;
+ }
+
+ template <typename T>
+ T* StrictPtr<T>::
+ retn() throw ()
+ {
+ Type* ret (ptr_);
+ ptr_ = 0;
+ return ret;
+ }
+
+ // Specialization of add_ref function for StrictPtr<T>
+ template <typename T>
+ T*
+ add_ref (StrictPtr<T> const& ptr)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ // delegate to generic implementation
+ return add_ref (ptr.in ());
+ }
+
+ // Dynamic type conversion function for StrictPtr's
+ template <typename D, typename S>
+ StrictPtr<D>
+ strict_cast (StrictPtr<S> const& s)
+ throw (Interface::Exception, Interface::SystemException)
+ {
+ return StrictPtr<D>(add_ref (dynamic_cast<D*>(s.in ())));
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp b/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp
new file mode 100644
index 00000000000..cfc9c8f788e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp
@@ -0,0 +1,54 @@
+// file : Utility/Synch/Policy/Null.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_SYNCH_POLICY_NULL_HPP
+#define UTILITY_SYNCH_POLICY_NULL_HPP
+
+namespace Utility
+{
+ namespace Synch
+ {
+ namespace Policy
+ {
+
+ class NullMutex
+ {
+ };
+
+ class NullGuard
+ {
+ public:
+ explicit
+ NullGuard (NullMutex&) throw ();
+
+ private:
+ NullGuard (NullGuard const&) throw ();
+
+ NullGuard&
+ operator= (NullGuard const&) throw ();
+ };
+
+ struct Null
+ {
+ typedef
+ NullMutex
+ Mutex;
+
+ typedef
+ NullGuard
+ ReadGuard;
+
+ typedef
+ NullGuard
+ WriteGuard;
+ };
+ }
+ }
+}
+
+#include "Utility/Synch/Policy/Null.ipp"
+
+#endif // UTILITY_SYNCH_POLICY_NULL_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp b/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp
new file mode 100644
index 00000000000..dbc4c78b698
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp
@@ -0,0 +1,20 @@
+// file : Utility/Synch/Policy/Null.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Synch
+ {
+ namespace Policy
+ {
+ inline NullGuard::
+ NullGuard (NullMutex&) throw ()
+ {
+ }
+ }
+ }
+}
+
+//$Id$