summaryrefslogtreecommitdiff
path: root/ace/Cleanup_Strategies_T.h
diff options
context:
space:
mode:
authorkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-03 22:23:07 +0000
committerkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-03 22:23:07 +0000
commitb83706ff81a45c3717d39a99f4510d942818467f (patch)
treea43decbdcc7b804e3a7b469b9a283a59063f2304 /ace/Cleanup_Strategies_T.h
parent68f38fa356a8825ed97787e8f612ba752e721bfa (diff)
downloadATCD-b83706ff81a45c3717d39a99f4510d942818467f.tar.gz
strategy for destruction and cleanupo.
Diffstat (limited to 'ace/Cleanup_Strategies_T.h')
-rw-r--r--ace/Cleanup_Strategies_T.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/ace/Cleanup_Strategies_T.h b/ace/Cleanup_Strategies_T.h
new file mode 100644
index 00000000000..4cdeec27b24
--- /dev/null
+++ b/ace/Cleanup_Strategies_T.h
@@ -0,0 +1,127 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Cleanup_Strategies_T.h
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef CLEANUP_STRATEGIES_H
+#define CLEANUP_STRATEGIES_H
+
+#include "ace/OS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#define ACE_LACKS_PRAGMA_ONCE
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+template <class CONTAINER>
+class ACE_Cleanup_Strategy
+{
+ // = TITLE
+ // Defines a abstract base class which takes care of winding up
+ // and destroying the entries in the container.
+ //
+ // = DESCRIPTION
+ // This class is one of the ways to ensure that the cleanup
+ // can be decoupled from other strategies which need to do it.
+ // The cleanup method provided needs to be implemented as needed.
+
+ public:
+
+ // Traits.
+ typedef ACE_TYPENAME CONTAINER::KEY KEY;
+ typedef ACE_TYPENAME CONTAINER::VALUE VALUE;
+
+ // = Termination.
+
+ virtual ~ACE_Cleanup_Strategy (void);
+
+ // = The cleanup operation.
+
+ virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value) = 0;
+ // This pure virtual method is to be used to destroy the <KEY,
+ // VALUE> entry.
+
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+template <class CONTAINER>
+class ACE_Default_Cleanup_Strategy : public ACE_Cleanup_Strategy<CONTAINER>
+{
+ // = TITLE
+ // Defines a default strategy to be followed for cleaning up
+ // entries from a map which is the container.
+ //
+ // = DESCRIPTION
+ // By defualt the entry to be cleaned up is removed from the
+ // container.
+
+public:
+
+ virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
+ // The method which will do the cleanup of the entry in the container.
+
+};
+
+//////////////////////////////////////////////////////////////////////
+template <class CONTAINER>
+class ACE_Svc_Cleanup_Strategy : public ACE_Cleanup_Strategy<CONTAINER>
+{
+ // = TITLE
+ // Defines a strategy to be followed for cleaning up
+ // entries which are svc_handlers from a container.
+ //
+ // = DESCRIPTION
+ // The entry to be cleaned up is removed from the container.
+ // Here, since we are dealing with svc_handlers specifically, we
+ // perform a couple of extra operations.
+
+public:
+
+ virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
+ // The method which will do the cleanup of the entry in the container.
+
+};
+
+//////////////////////////////////////////////////////////////////////
+
+template <class CONTAINER>
+class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<CONTAINER>
+{
+ // = TITLE
+ // Defines a do-nothing implementation of the cleanup strategy.
+ //
+ // = DESCRIPTION
+ // This class simply does nothing at all! Can be used to nullify
+ // the effect of the Cleanup Strategy.
+
+public:
+
+ virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
+ // the dummy cleanup method.
+
+};
+
+#if defined (__ACE_INLINE__)
+#include "ace/Cleanup_Strategies_T.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/Cleanup_Strategies_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation "ace/Cleanup_Strategies_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* CLEANUP_STRATEGIES_H */