summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
commitc4078c377d74290ebe4e66da0b4975da91732376 (patch)
tree1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
parent700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff)
downloadATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp')
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp132
1 files changed, 0 insertions, 132 deletions
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp b/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
deleted file mode 100644
index 428e78cd061..00000000000
--- a/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// file : Test/ReferenceCounting/DefaultImpl/default_impl.cpp
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2002-2003 Boris Kolpackov
-// license : http://kolpackov.net/license.html
-
-#include "Utility/ReferenceCounting/DefaultImpl.hpp"
-
-using namespace Utility::ReferenceCounting;
-
-struct Base : public virtual Interface
-{
- virtual
- ~Base () throw ()
- {
- }
-};
-
-
-class Impl : public virtual Base,
- public virtual DefaultImpl <>
-{
-public:
- Impl (bool& destroyed)
- : dummy_ (false),
- destroyed_ (destroyed)
- {
- }
-
- Impl ()
- : dummy_ (false),
- destroyed_ (dummy_)
- {
- }
-
- virtual
- ~Impl () throw ()
- {
- destroyed_ = true;
- }
-
-public:
- void
- lock ()
- {
- lock_i ();
- }
-
-private:
- bool dummy_;
- bool& destroyed_;
-};
-
-struct E {};
-
-void postcondition (bool p)
-{
- if (!p) throw E ();
-}
-
-int main ()
-{
- try
- {
- // DefaultImpl
- //
- {
- Impl* a (new Impl);
-
- postcondition (a->refcount_value () == 1);
-
- a->remove_ref ();
- }
-
- // ~DefaultImpl
- //
- {
- Impl* a (new Impl);
- a->remove_ref ();
- }
-
- // add_ref
- //
- {
- Impl* a (new Impl);
-
- a->add_ref ();
-
- postcondition (a->refcount_value () == 2);
-
- a->remove_ref ();
- a->remove_ref ();
- }
-
-
- // remove_ref
- //
- {
- bool destroyed (false);
- Impl* a (new Impl (destroyed));
-
- a->add_ref ();
- a->remove_ref ();
-
- postcondition (destroyed == false && a->refcount_value () == 1);
-
- a->remove_ref ();
-
- postcondition (destroyed == true);
- }
-
-
- // refcount_value
- //
- {
- Impl* a (new Impl);
-
- postcondition (a->refcount_value () == 1);
- }
-
- // lock_i
- //
- {
- Impl* a (new Impl);
- a->lock ();
- }
- }
- catch (...)
- {
- return -1;
- }
-}
-//$Id$