176   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   178   float throughput = 0.0f;
   179   if (scheduled_time > std::numeric_limits<double>::epsilon())
   189   auto operating_time = scheduled_time;
   190   operating_time -= stopped_time;
   191   operating_time -= suspend_time;
   192   operating_time -= aborted_time;
   194   float availability = 0.0f;
   195   if (scheduled_time > std::numeric_limits<double>::epsilon())
   197     availability = operating_time / scheduled_time;
   200   float performance = 0.0f;
   201   if (operating_time > std::numeric_limits<double>::epsilon())
   206   float quality = 0.0f;
   210     quality = 
static_cast<float>(
success_count_) / static_cast<float>(total_count);
   213   snapshot_out.
duration = scheduled_time;
   226   snapshot_out.
quality = quality;
   314   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   315   std::chrono::duration<double> duration = std::chrono::steady_clock::now() - 
start_time_;
   316   auto elapsed_time = duration.count();
   319     elapsed_time += iter->second;
   327   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   335     itemized_it.second.count = 0;
   336     itemized_it.second.duration = 0;
   341     itemized_it.second.count = 0;
   342     itemized_it.second.duration = 0;
   347                                                 int32_t count, 
double duration)
   349   auto itemized_stat_it = itemized_map.find(
id);
   350   if (itemized_stat_it != itemized_map.end())
   352     itemized_stat_it->second.count += count;
   353     itemized_stat_it->second.duration += duration;
   359     new_stats.
count = count;
   361     itemized_map.insert(std::pair<int16_t, PackmlStatsItemized>(
id, new_stats));
   367   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   373   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   379   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   385   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   391   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   403   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   404   std::chrono::duration<double> duration = std::chrono::steady_clock::now() - 
start_time_;
   405   auto elapsed_time = duration.count();
   419   std::lock_guard<std::recursive_mutex> lock(
stat_mutex_);
   420   double elapsed_time = 0;
   423     std::chrono::duration<double> duration = std::chrono::steady_clock::now() - 
start_time_;
   424     elapsed_time += duration.count();
 virtual void _clear()=0
Override to call implementations version of clear command. 
void resetStats()
Reset all of the tracked states. 
virtual bool unsuspend()
Call to send the unsuspend command. 
virtual void _start()=0
Override to call implementations version of start command. 
void setIdealCycleTime(float ideal_cycle_time)
Sets the ideal cycle time in operations per second. 
void incrementMapStatItem(std::map< int16_t, PackmlStatsItemized > &itemized_map, int16_t id, int32_t count, double duration)
adds or updates the specific itemized map 
double getUnsuspendingTime()
Accessor for the duration spent in unsuspending. 
std::map< int16_t, PackmlStatsItemized > itemized_error_map_
virtual void _stop()=0
Override to call implementations version of the stop command. 
double getHeldTime()
Accessor for the duration spent in held. 
void invokeStateChangedEvent(const std::string &name, StatesEnum value)
Call to invoke a state changed event. 
void getCurrentStatSnapshot(PackmlStatsSnapshot &snapshot_out)
Fills the reference variable with the current stats snapshot. 
double getUnholdingTime()
Accessor for the duration spent in unholding. 
Container for the current packml statistics snap shot. 
virtual bool start()
Call to send the start command. 
std::chrono::steady_clock::time_point start_time_
double getCompleteTime()
Accessor for the duration spent in complete. 
std::map< StatesEnum, double > duration_map_
EventHandler< AbstractStateMachine, StateChangedEventArgs > stateChangedEvent
double getSuspendingTime()
Accessor for the duration spent in suspending. 
virtual void _unhold()=0
Override to call implementations version of the unhold command. 
double getExecuteTime()
Accessor for the duration spent in execute. 
virtual void _abort()=0
Override to call implementations version of the abort command. 
double calculateTotalTime()
Accessor for the total duration of the state machine. 
virtual bool suspend()
Call to send the suspend command. 
void incrementQualityStatItem(int16_t id, int32_t count, double duration)
Call to increment or add a specific Itemized quality stat. 
double getAbortedTime()
Accessor for the duration spent in aborted. 
double getAbortingTime()
Accessor for the duration spent in aborting. 
double getResettingTime()
Accessor for the duration spent in resetting. 
virtual bool hold()
Call to send the hold command. 
double getSuspendedTime()
Accessor for the duration spent in suspended. 
double getStoppingTime()
Accessor for the duration spent in stopping. 
std::map< int16_t, PackmlStatsItemized > itemized_quality_map
double getStoppedTime()
Accessor for the duration spent in stopped. 
std::map< int16_t, PackmlStatsItemized > itemized_error_map
double getStartingTime()
Accessor for the duration spent in starting. 
Container for the current packml statistics snap shot. 
virtual void _hold()=0
Override to call implementations version of the hold command. 
static void LogWarning(const char *format,...)
virtual void _unsuspend()=0
Override to call implementations version of the unsuspend command. 
virtual bool stop()
Call to send the stop command. 
void incrementErrorStatItem(int16_t id, int32_t count, double duration)
Call to increment or add a specific Itemized error stat. 
double getClearingTime()
Accessor for the duration spent in clearing. 
StatesEnum current_state_
virtual bool abort()
Call to send the abort command. 
virtual bool unhold()
Call to send the unhold command. 
float overall_equipment_effectiveness
std::recursive_mutex stat_mutex_
std::map< int16_t, PackmlStatsItemized > itemized_quality_map_
virtual bool clear()
Call to send the clear command. 
void incrementFailureCount()
Call to increment the failed operation count. 
double getHoldingTime()
Accessor for the duration spent in holding. 
void incrementSuccessCount()
Call to increment the successful operation count. 
StatesEnum getCurrentState() const 
Accessor for the current state. 
virtual void _reset()=0
Override to call implementations version of the reset command. 
virtual void _suspend()=0
Override to call implementations version of the suspend command. 
double getStateDuration(StatesEnum state)
Accessor for the given state duration. 
AbstractStateMachine()
Constructor for AbstractStateMachine. 
double getIdleTime()
Accessor for the duration spent in idle time. 
virtual bool reset()
Call to send the reset command. 
void updateClock(StatesEnum new_state)
Updates all of the durations for the states based on the new state.