Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / LF_Invocation_Event.cpp
blob7c627c4cdfb5d9da3ec8251dc336fb97d17c97ff
1 // -*- C++ -*-
2 #include "tao/LF_Invocation_Event.h"
4 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
6 TAO_LF_Invocation_Event::TAO_LF_Invocation_Event ()
7 : TAO_LF_Event ()
11 TAO_LF_Invocation_Event::~TAO_LF_Invocation_Event ()
15 void
16 TAO_LF_Invocation_Event::state_changed_i (LFS_STATE new_state)
18 if (this->state_ == new_state)
19 return;
21 // Validate the state change
22 if (this->state_ == TAO_LF_Event::LFS_IDLE)
24 // From the LFS_IDLE state we can only become active.
25 if (new_state == TAO_LF_Event::LFS_ACTIVE
26 || new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
27 this->state_ = new_state;
28 return;
30 else if (this->state_ == TAO_LF_Event::LFS_ACTIVE)
32 // From LFS_ACTIVE we can only move to a few states
33 if (new_state != TAO_LF_Event::LFS_IDLE)
35 if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
37 this->state_ = TAO_LF_Event::LFS_FAILURE;
39 else
41 this->state_ = new_state;
44 return;
46 else if (this->state_ == TAO_LF_Event::LFS_SUCCESS
47 || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED)
49 // From the two states above we can go back to ACTIVE, as when a
50 // request is restarted.
51 if (new_state == TAO_LF_Event::LFS_ACTIVE)
53 this->state_ = new_state;
55 return;
57 else/* if (this->state_ == TAO_LF_Event::LFS_TIMEOUT || FAILURE */
59 // Other states are final..
64 bool
65 TAO_LF_Invocation_Event::successful_i () const
67 return this->state_ == TAO_LF_Event::LFS_SUCCESS;
70 bool
71 TAO_LF_Invocation_Event::error_detected_i () const
73 return (this->state_ == TAO_LF_Event::LFS_FAILURE
74 || this->state_ == TAO_LF_Event::LFS_TIMEOUT
75 || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED);
78 bool
79 TAO_LF_Invocation_Event::is_state_final () const
81 if (this->state_ == TAO_LF_Event::LFS_TIMEOUT ||
82 this->state_ == TAO_LF_Event::LFS_FAILURE)
83 return true;
85 return false;
88 TAO_END_VERSIONED_NAMESPACE_DECL