LF_Invocation_Event.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "tao/LF_Invocation_Event.h"
00003 
00004 ACE_RCSID(tao,
00005           LF_Invocation_Event,
00006           "LF_Invocation_Event.cpp,v 1.5 2006/03/10 07:19:05 jtc Exp")
00007 
00008 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00009 
00010 TAO_LF_Invocation_Event::TAO_LF_Invocation_Event (void)
00011   : TAO_LF_Event ()
00012 {
00013 }
00014 
00015 TAO_LF_Invocation_Event::~TAO_LF_Invocation_Event (void)
00016 {
00017 }
00018 
00019 void
00020 TAO_LF_Invocation_Event::state_changed_i (int new_state)
00021 {
00022   if (this->state_ == new_state)
00023     return;
00024 
00025   // Validate the state change
00026   if (this->state_ == TAO_LF_Event::LFS_IDLE)
00027     {
00028       // From the LFS_IDLE state we can only become active.
00029       if (new_state == TAO_LF_Event::LFS_ACTIVE
00030           || new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00031         this->state_ = new_state;
00032       return;
00033     }
00034   else if (this->state_ == TAO_LF_Event::LFS_ACTIVE)
00035     {
00036       // From LFS_ACTIVE we can only move to a few states
00037       if (new_state != TAO_LF_Event::LFS_IDLE)
00038         {
00039           if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00040             {
00041               this->state_ = TAO_LF_Event::LFS_FAILURE;
00042             }
00043           else
00044             {
00045               this->state_ = new_state;
00046             }
00047         }
00048       return;
00049     }
00050   else if (this->state_ == TAO_LF_Event::LFS_SUCCESS
00051            || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00052     {
00053       // From the two states above we can go back to ACTIVE, as when a
00054       // request is restarted.
00055       if (new_state == TAO_LF_Event::LFS_ACTIVE)
00056         {
00057           this->state_ = new_state;
00058         }
00059       return;
00060     }
00061   else/* if (this->state_ == TAO_LF_Event::LFS_TIMEOUT || FAILURE */
00062     {
00063       // Other states are final..
00064     }
00065 
00066 }
00067 
00068 int
00069 TAO_LF_Invocation_Event::successful (void) const
00070 {
00071   return this->state_ == TAO_LF_Event::LFS_SUCCESS;
00072 }
00073 
00074 int
00075 TAO_LF_Invocation_Event::error_detected (void) const
00076 {
00077   return (this->state_ == TAO_LF_Event::LFS_FAILURE
00078           || this->state_ == TAO_LF_Event::LFS_TIMEOUT
00079           || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED);
00080 }
00081 
00082 int
00083 TAO_LF_Invocation_Event::is_state_final (void)
00084 {
00085   if (this->state_ == TAO_LF_Event::LFS_TIMEOUT ||
00086       this->state_ == TAO_LF_Event::LFS_FAILURE)
00087     return 1;
00088 
00089   return 0;
00090 }
00091 
00092 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 11:54:15 2006 for TAO by doxygen 1.3.6