75 virtual bool setStarting(std::function<
int()> state_method) = 0;
83 virtual bool setExecute(std::function<
int()> state_method) = 0;
91 virtual bool setCompleting(std::function<
int()> state_method) = 0;
99 virtual bool setAborting(std::function<
int()> state_method) = 0;
107 virtual bool setClearing(std::function<
int()> state_method) = 0;
115 virtual bool setStopping(std::function<
int()> state_method) = 0;
123 virtual bool setResetting(std::function<
int()> state_method) = 0;
131 virtual bool setSuspending(std::function<
int()> state_method) = 0;
147 virtual bool setHolding(std::function<
int()> state_method) = 0;
155 virtual bool setUnholding(std::function<
int()> state_method) = 0;
328 virtual bool start();
335 virtual bool clear();
342 virtual bool reset();
384 virtual bool abort();
406 virtual void _start() = 0;
412 virtual void _clear() = 0;
418 virtual void _reset() = 0;
424 virtual void _hold() = 0;
448 virtual void _stop() = 0;
454 virtual void _abort() = 0;
476 void incrementMapStatItem(std::map<int16_t, PackmlStatsItemized>& itemized_map, int16_t
id, int32_t 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 bool setClearing(std::function< int()> state_method)=0
Override to handle setting the clearing state method.
virtual void _start()=0
Override to call implementations version of start command.
virtual bool setResetting(std::function< int()> state_method)=0
Override to handle setting the resetting state method.
void setIdealCycleTime(float ideal_cycle_time)
Sets the ideal cycle time in operations per second.
virtual bool activate()=0
Override to handle activate command.
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.
The StateMachineInterface class defines a implementation independent interface to a PackML state mach...
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 bool setStarting(std::function< int()> state_method)=0
Override to handle setting the starting state method.
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.
virtual bool setSuspending(std::function< int()> state_method)=0
Override to handle setting the suspending state method.
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.
virtual bool isActive()=0
Override to provide an accessor to whether the state machine is currently active. ...
virtual bool setAborting(std::function< int()> state_method)=0
Override to handle setting the aborting state method.
double getStoppedTime()
Accessor for the duration spent in stopped.
double getStartingTime()
Accessor for the duration spent in starting.
virtual void _hold()=0
Override to call implementations version of the hold command.
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.
virtual bool setUnholding(std::function< int()> state_method)=0
Override to handle setting unholding state method.
double getClearingTime()
Accessor for the duration spent in clearing.
virtual bool setStopping(std::function< int()> state_method)=0
Override to handle setting the stopping state method.
StatesEnum current_state_
virtual bool abort()
Call to send the abort command.
virtual bool unhold()
Call to send the unhold command.
virtual ~AbstractStateMachine()
Destructor for AbstractStateMachine.
std::recursive_mutex stat_mutex_
virtual bool setCompleting(std::function< int()> state_method)=0
Override to handle setting the completing state method.
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.
virtual bool setHolding(std::function< int()> state_method)=0
Override to handle setting the holding state method.
double getHoldingTime()
Accessor for the duration spent in holding.
void incrementSuccessCount()
Call to increment the successful operation count.
virtual bool setUnsuspending(std::function< int()> state_method)=0
Override to handle setting the un-suspending state method.
StatesEnum getCurrentState() const
Accessor for the current state.
virtual bool deactivate()=0
Override to handle deactivate command.
virtual bool setExecute(std::function< int()> state_method)=0
Override to handle setting the execute state method.
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.