summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp')
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp84
1 files changed, 84 insertions, 0 deletions
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$