summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2017-01-03 16:40:38 +0100
committerJohnny Willemsen <jwillemsen@remedy.nl>2017-01-03 16:40:38 +0100
commit099e520ce5a608fe00cb9d921854b2d87966cde3 (patch)
tree682b951ce5325e7d44da1ea6637d08f869126390 /TAO/tao
parent15327947b0a014aa99909dc33e4cfc9255473542 (diff)
downloadATCD-099e520ce5a608fe00cb9d921854b2d87966cde3.tar.gz
Make the leader follower state a real enum instead of using it as int, that way a compiler can detect when we assign a non-existent value
* TAO/tao/LF_CH_Event.cpp: * TAO/tao/LF_CH_Event.h: * TAO/tao/LF_Event.cpp: * TAO/tao/LF_Event.h: * TAO/tao/LF_Event.inl: * TAO/tao/LF_Invocation_Event.cpp: * TAO/tao/LF_Invocation_Event.h: * TAO/tao/LF_Multi_Event.cpp: * TAO/tao/LF_Multi_Event.h: * TAO/tests/Bug_3531b_Regression/server.cpp:
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/LF_CH_Event.cpp6
-rw-r--r--TAO/tao/LF_CH_Event.h8
-rw-r--r--TAO/tao/LF_Event.cpp4
-rw-r--r--TAO/tao/LF_Event.h16
-rw-r--r--TAO/tao/LF_Event.inl4
-rw-r--r--TAO/tao/LF_Invocation_Event.cpp2
-rw-r--r--TAO/tao/LF_Invocation_Event.h2
-rw-r--r--TAO/tao/LF_Multi_Event.cpp2
-rw-r--r--TAO/tao/LF_Multi_Event.h3
9 files changed, 23 insertions, 24 deletions
diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp
index 735041be0e4..ce68e95f94e 100644
--- a/TAO/tao/LF_CH_Event.cpp
+++ b/TAO/tao/LF_CH_Event.cpp
@@ -30,7 +30,7 @@ TAO_LF_CH_Event::unbind (TAO_LF_Follower *follower)
}
void
-TAO_LF_CH_Event::state_changed_i (int new_state)
+TAO_LF_CH_Event::state_changed_i (LFS_STATE new_state)
{
if (this->state_ != new_state)
{
@@ -64,7 +64,7 @@ TAO_LF_CH_Event::state_changed_i (int new_state)
}
void
-TAO_LF_CH_Event::validate_state_change (int new_state)
+TAO_LF_CH_Event::validate_state_change (LFS_STATE new_state)
{
if (this->state_ == TAO_LF_Event::LFS_IDLE)
{
@@ -128,7 +128,7 @@ TAO_LF_CH_Event::error_detected_i (void) const
}
void
-TAO_LF_CH_Event::set_state (int new_state)
+TAO_LF_CH_Event::set_state (LFS_STATE new_state)
{
// @@ NOTE: Is this still required?
if (!this->is_state_final ()
diff --git a/TAO/tao/LF_CH_Event.h b/TAO/tao/LF_CH_Event.h
index 4acb65afcdf..cb22cd48325 100644
--- a/TAO/tao/LF_CH_Event.h
+++ b/TAO/tao/LF_CH_Event.h
@@ -97,7 +97,7 @@ private:
* Timeouts can occur while waiting for connections.
*
*/
- virtual void state_changed_i (int new_state);
+ virtual void state_changed_i (LFS_STATE new_state);
/// Return true if the condition was satisfied successfully, false if it
/// has not
@@ -108,7 +108,7 @@ private:
virtual bool error_detected_i (void) const;
/// Set the state irrespective of anything.
- virtual void set_state (int new_state);
+ virtual void set_state (LFS_STATE new_state);
virtual int bind (TAO_LF_Follower *follower);
virtual int unbind (TAO_LF_Follower *follower);
@@ -116,9 +116,9 @@ private:
private:
/// The previous state that the LF_CH_Event was in
- int prev_state_;
+ LFS_STATE prev_state_;
- void validate_state_change (int new_state);
+ void validate_state_change (LFS_STATE new_state);
typedef ACE_Hash_Map_Manager_Ex <TAO_LF_Follower *, int,
ACE_Hash<void *>,
diff --git a/TAO/tao/LF_Event.cpp b/TAO/tao/LF_Event.cpp
index c7a02b83935..c91adae57f1 100644
--- a/TAO/tao/LF_Event.cpp
+++ b/TAO/tao/LF_Event.cpp
@@ -21,7 +21,7 @@ TAO_LF_Event::~TAO_LF_Event (void)
}
void
-TAO_LF_Event::state_changed (int new_state, TAO_Leader_Follower &lf)
+TAO_LF_Event::state_changed (LFS_STATE new_state, TAO_Leader_Follower &lf)
{
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ());
@@ -60,7 +60,7 @@ TAO_LF_Event::error_detected (TAO_Leader_Follower &lf) const
}
void
-TAO_LF_Event::set_state (int new_state)
+TAO_LF_Event::set_state (LFS_STATE new_state)
{
this->state_ = new_state;
}
diff --git a/TAO/tao/LF_Event.h b/TAO/tao/LF_Event.h
index 6ea3f87001b..cba8c22d51b 100644
--- a/TAO/tao/LF_Event.h
+++ b/TAO/tao/LF_Event.h
@@ -82,7 +82,7 @@ public:
* FSM. The possible sequence of states through which the FSM
* migrates is defined in the concrete classes.
*/
- enum {
+ enum LFS_STATE {
/// The event is created, and is in initial state
LFS_IDLE = 0,
/// The event is active
@@ -97,11 +97,11 @@ public:
LFS_TIMEOUT,
/// The connection was closed.
LFS_CONNECTION_CLOSED
- };
+ } ;
/// Accessor to change the state. The state isn't changed unless
/// certain conditions are satisfied.
- void state_changed (int new_state, TAO_Leader_Follower &lf);
+ void state_changed (LFS_STATE new_state, TAO_Leader_Follower &lf);
/**
* Virtual methods for this class hierarchy..
@@ -119,14 +119,14 @@ public:
//@}
/// Reset the state, irrespective of the previous states
- void reset_state (int new_state);
+ void reset_state (LFS_STATE new_state);
- static const char *state_name (int st);
+ static const char *state_name (LFS_STATE st);
protected:
/// Validate the state change
- virtual void state_changed_i (int new_state) = 0;
+ virtual void state_changed_i (LFS_STATE new_state) = 0;
/// Check if we should keep waiting.
bool keep_waiting_i (void) const;
@@ -145,11 +145,11 @@ protected:
private:
/// Set the state irrespective of anything.
- virtual void set_state (int new_state);
+ virtual void set_state (LFS_STATE new_state);
protected:
/// The current state
- int state_;
+ LFS_STATE state_;
/// The bounded follower
TAO_LF_Follower *follower_;
diff --git a/TAO/tao/LF_Event.inl b/TAO/tao/LF_Event.inl
index 50ccda83b25..dccfae380bb 100644
--- a/TAO/tao/LF_Event.inl
+++ b/TAO/tao/LF_Event.inl
@@ -20,7 +20,7 @@ TAO_LF_Event::unbind (TAO_LF_Follower *)
}
ACE_INLINE void
-TAO_LF_Event::reset_state (int new_state)
+TAO_LF_Event::reset_state (LFS_STATE new_state)
{
this->state_ = new_state;
}
@@ -32,7 +32,7 @@ TAO_LF_Event::keep_waiting_i (void) const
}
ACE_INLINE const char *
-TAO_LF_Event::state_name (int st)
+TAO_LF_Event::state_name (LFS_STATE st)
{
#define TAO_LF_EVENT_ENTRY(X) case X: return #X
switch (st)
diff --git a/TAO/tao/LF_Invocation_Event.cpp b/TAO/tao/LF_Invocation_Event.cpp
index 060a9c49975..16964032c5b 100644
--- a/TAO/tao/LF_Invocation_Event.cpp
+++ b/TAO/tao/LF_Invocation_Event.cpp
@@ -13,7 +13,7 @@ TAO_LF_Invocation_Event::~TAO_LF_Invocation_Event (void)
}
void
-TAO_LF_Invocation_Event::state_changed_i (int new_state)
+TAO_LF_Invocation_Event::state_changed_i (LFS_STATE new_state)
{
if (this->state_ == new_state)
return;
diff --git a/TAO/tao/LF_Invocation_Event.h b/TAO/tao/LF_Invocation_Event.h
index 25d387f667b..1e56a409c81 100644
--- a/TAO/tao/LF_Invocation_Event.h
+++ b/TAO/tao/LF_Invocation_Event.h
@@ -59,7 +59,7 @@ protected:
* LFS_CONNECTION_CLOSED - The connection was closed when the state
* was active.
*/
- virtual void state_changed_i (int new_state);
+ virtual void state_changed_i (LFS_STATE new_state);
/// Return true if the condition was satisfied successfully, false if it
/// has not
diff --git a/TAO/tao/LF_Multi_Event.cpp b/TAO/tao/LF_Multi_Event.cpp
index c0741bad8de..e2b6601a888 100644
--- a/TAO/tao/LF_Multi_Event.cpp
+++ b/TAO/tao/LF_Multi_Event.cpp
@@ -104,7 +104,7 @@ TAO_LF_Multi_Event::error_detected_i (void) const
}
void
-TAO_LF_Multi_Event::state_changed_i (int )
+TAO_LF_Multi_Event::state_changed_i (LFS_STATE )
{
// no-op
}
diff --git a/TAO/tao/LF_Multi_Event.h b/TAO/tao/LF_Multi_Event.h
index c0cc2916169..5b01b37ac30 100644
--- a/TAO/tao/LF_Multi_Event.h
+++ b/TAO/tao/LF_Multi_Event.h
@@ -66,7 +66,7 @@ private:
protected:
/// Validate the state change
- virtual void state_changed_i (int new_state);
+ virtual void state_changed_i (LFS_STATE new_state);
/// Check whether we have reached the final state..
virtual bool is_state_final (void) const;
@@ -91,7 +91,6 @@ private:
struct Event_Node *events_;
mutable TAO_Connection_Handler * winner_;
-
};
TAO_END_VERSIONED_NAMESPACE_DECL