8#ifdef INCLUDE_PROFILING
16#ifdef INCLUDE_PROFILING
41 Action(std::shared_ptr<Tickable> tickable);
61 bool Start(
const bool force =
false);
68 bool Stop(
const bool force =
false);
88#ifdef INCLUDE_PROFILING
107#ifdef INCLUDE_PROFILING
108 std::chrono::time_point<std::chrono::steady_clock> GetClock(
const ClockType clockType)
const;
109 Action& SetClock(
const ClockType clockType, std::chrono::time_point<std::chrono::steady_clock> clockValue);
112 std::weak_ptr<Tickable> mTickable;
113 bool mIsActionRunning;
115#ifdef INCLUDE_PROFILING
116 std::chrono::time_point<std::chrono::steady_clock> mClocks[
static_cast<size_t>(
ClockType::ClockMax)];
Represents a discrete, repeatable operation run by a Tickable.
Definition Action.h:35
virtual bool CanStart()
Permission hook; override to prevent starting. Defaults to true.
bool Run()
Executes the Action if it is currently running.
virtual bool ActionRan()=0
Pure virtual hook invoked by Run() each cycle.
Action(std::shared_ptr< Tickable > tickable)
Constructs an Action associated with a Tickable.
virtual ~Action()=default
virtual bool CanStop()
Permission hook; override to prevent stopping. Defaults to true.
std::shared_ptr< Tickable > GetTickable() const
Returns the Tickable that owns this Action, or nullptr if expired.
bool IsRunning() const
Returns true if this Action is currently in the running state.
bool Start(const bool force=false)
Starts the Action so that subsequent Run() calls will execute it.
virtual void Started(const bool forced)
Notification hook called after the Action has been started.
double GetTime(const ClockType clockType) const
Returns the wall-clock time for a profiling checkpoint.
virtual void Stopped(const bool forced)
Notification hook called after the Action has been stopped.
bool Stop(const bool force=false)
Stops the Action so that subsequent Run() calls become no-ops.
Base class for all identifiable objects in the component system.
Definition Part.h:27
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
ClockType
Identifies a profiling time-point within an Action or Tickable.
Definition Action.h:22