summaryrefslogtreecommitdiff
path: root/TAO/tao/LF_Event.inl
blob: f47b63d0b67f3c7a525fb335c06af3230eac199e (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
// -*- C++ -*-
TAO_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE int
TAO_LF_Event::bind (TAO_LF_Follower *follower)
{
  if (this->follower_ != 0)
    return -1;
  this->follower_ = follower;
  return 0;
}

ACE_INLINE int
TAO_LF_Event::unbind (TAO_LF_Follower *)
{
  if (this->follower_ == 0)
    return -1;
  this->follower_ = 0;
  return 0;
}

ACE_INLINE void
TAO_LF_Event::reset_state (LFS_STATE new_state)
{
  this->state_ = new_state;
}

ACE_INLINE bool
TAO_LF_Event::keep_waiting_i () const
{
  return (!this->successful_i ()) && (!this->error_detected_i ());
}

ACE_INLINE const char *
TAO_LF_Event::state_name (LFS_STATE st)
{
#define TAO_LF_EVENT_ENTRY(X) case X: return #X
  switch (st)
    {
      TAO_LF_EVENT_ENTRY (LFS_IDLE);
      TAO_LF_EVENT_ENTRY (LFS_ACTIVE);
      TAO_LF_EVENT_ENTRY (LFS_CONNECTION_WAIT);
      TAO_LF_EVENT_ENTRY (LFS_SUCCESS);
      TAO_LF_EVENT_ENTRY (LFS_FAILURE);
      TAO_LF_EVENT_ENTRY (LFS_TIMEOUT);
      TAO_LF_EVENT_ENTRY (LFS_CONNECTION_CLOSED);
    }
  return "***Unknown enum value, update TAO_LF_Event::state_name()";
#undef TAO_LF_EVENT_ENTRY
}

TAO_END_VERSIONED_NAMESPACE_DECL