summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/tools/Completion/Completion_Counter_Base.h
blob: 231b066584db2049097aa91c7ac369075e911955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Completion_Counter_Base.h
 *
 *  $Id$
 *
 *  @author Martin Corino <mcorino@remedy.nl>
 */
//=============================================================================

#ifndef COMPLETION_COUNTER_H
#define COMPLETION_COUNTER_H

#include /**/ "ace/pre.h"

#include /**/ "ace/config-all.h"
#include "ace/Null_Mutex.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

namespace DAnCE
  {

  template <class ACE_LOCK>
  class Completion_Counter_Base
    {
    public:
      typedef ACE_LOCK lock_type;
      Completion_Counter_Base (unsigned int exec_count,
                               unsigned int fail_count);
      virtual ~Completion_Counter_Base ();

      void  decrement_exec_count ();
      void  increment_fail_count ();

      unsigned int exec_count ();
      unsigned int fail_count ();

      bool all_completed ();

    protected:
      unsigned int exec_count_i ();
      unsigned int fail_count_i ();

      virtual void on_all_completed () = 0;
      virtual void on_all_completed_with_failure () = 0;

    private:
      mutable ACE_LOCK lock_;
      unsigned int exec_count_;
      unsigned int fail_count_;
    };

  }; /* DAnCE */

#if defined (__ACE_INLINE__)
#include "Completion/Completion_Counter_Base.inl"
#endif /* __ACE_INLINE__ */

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "Completion/Completion_Counter_Base.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Completion_Counter_Base.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include /**/ "ace/post.h"

#endif /* COMPLETION_HANDLER_T_H */