summaryrefslogtreecommitdiff
path: root/ace/Strategies.i
blob: 5cdcb51c92eb41f3e0435a0b2a8dfee433593734 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- C++ -*- */
// $Id$

// Strategies.i

ACE_INLINE
ACE_Reactor_Notification_Strategy::~ACE_Reactor_Notification_Strategy (void)
{
}

ACE_INLINE
ACE_Connection_Recycling_Strategy::ACE_Connection_Recycling_Strategy (void)
{
}

ACE_INLINE
ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state)
  : recycle_state_ (initial_state)
{
}

ACE_INLINE
ACE_Recyclable::~ACE_Recyclable (void)
{
}

ACE_INLINE ACE_Recyclable_State
ACE_Recyclable::recycle_state (void) const
{
  return this->recycle_state_;
}

ACE_INLINE void
ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state)
{
  if (this->recycle_state_ == ACE_RECYCLABLE_CLOSED)
    return;

  this->recycle_state_ = new_state;
}

ACE_INLINE
ACE_Hashable::ACE_Hashable (void)
  : hash_value_ (0)
{
}

ACE_INLINE
ACE_Hashable::~ACE_Hashable (void)
{
}

ACE_INLINE u_long
ACE_Hashable::hash (void) const
{
  // In doing the check below, we take chance of paying a performance
  // price when the hash value is zero.  But, that will (hopefully)
  // happen far less often than a non-zero value, so this caching
  // strategy should pay off, esp. if hash computation is expensive
  // relative to the simple comparison.

  if (this->hash_value_ == 0)
    ((ACE_Hashable *) this)->hash_value_ = this->hash_i ();

  return this->hash_value_;
}

ACE_INLINE
ACE_Refcountable::ACE_Refcountable (int refcount)
  : refcount_ (refcount)
{
}

ACE_INLINE
ACE_Refcountable::~ACE_Refcountable (void)
{
}

ACE_INLINE int
ACE_Refcountable::increment (void)
{
  return ++this->refcount_;
}

ACE_INLINE int
ACE_Refcountable::decrement (void)
{
  return --this->refcount_;
}

ACE_INLINE int
ACE_Refcountable::refcount (void) const
{
  return this->refcount_;
}