Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / Refcountable_T.h
blob5dab2e6e5409a156333985e864cbae40b10e6d11
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Refcountable_T.h
7 * @author Doug Schmidt
8 * @author Johnny Willemsen
9 */
10 //=============================================================================
11 #ifndef ACE_REFCOUNTABLE_T_H
12 #define ACE_REFCOUNTABLE_T_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/ACE_export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Atomic_Op.h"
22 #include "ace/Synch_Traits.h"
23 #include "ace/Null_Mutex.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 template <class ACE_LOCK>
28 class ACE_Refcountable_T
30 public:
31 /// Destructor.
32 virtual ~ACE_Refcountable_T () = default;
34 /// Increment refcount
35 long increment ();
37 /// Decrement refcount
38 long decrement ();
40 /// Returns the current refcount.
41 long refcount () const;
43 protected:
44 /// Protected constructor.
45 ACE_Refcountable_T (long refcount);
47 /// Current refcount.
48 ACE_Atomic_Op <ACE_LOCK, long> refcount_;
51 ACE_END_VERSIONED_NAMESPACE_DECL
53 #if defined (__ACE_INLINE__)
54 #include "ace/Refcountable_T.inl"
55 #endif /* __ACE_INLINE__ */
57 #include "ace/Refcountable_T.cpp"
59 #include /**/ "ace/post.h"
60 #endif /*ACE_REFCOUNTABLE_T_H*/