Module sked

Summary

Members Descriptions
namespacescy::sked

namespace scy::sked

Summary

Members Descriptions
classscy::sked::Scheduler
classscy::sked::Task
classscy::sked::TaskFactory
structscy::sked::DailyTrigger
structscy::sked::IntervalTrigger
structscy::sked::OnceOnlyTrigger
structscy::sked::Trigger

class scy::sked::Scheduler

class scy::sked::Scheduler
  : public scy::TaskRunner
  : public scy::json::ISerializable

The Scheduler manages and runs tasks that need to be executed at specific times.

Summary

Members Descriptions
public Scheduler()
public virtual ~Scheduler()
public virtual void schedule(sked::Task* task)
public virtual void cancel(sked::Task* task)
public virtual void clear() Destroys and clears all manages tasks.
public virtual void serialize(json::Value & root)
public virtual void deserialize(json::Value & root)
public virtual void print(std::ostream & ost)
protected virtual void run() Called by the async context to run the next task.
protected virtual void update()

Members

public Scheduler()

public virtual ~Scheduler()

public virtual void schedule(sked::Task* task)

public virtual void cancel(sked::Task* task)

public virtual void clear()

Destroys and clears all manages tasks.

public virtual void serialize(json::Value & root)

public virtual void deserialize(json::Value & root)

public virtual void print(std::ostream & ost)

protected virtual void run()

Called by the async context to run the next task.

protected virtual void update()

class scy::sked::Task

class scy::sked::Task
  : public scy::Task
  : public scy::json::ISerializable

This class extends the Task class to implement scheduling capabilities.

Summary

Members Descriptions
public Task(const std::string & type,const std::string & name)
public Task(Scheduler& scheduler,const std::string & type,const std::string & name)
public virtual void serialize(json::Value & root) Serializes the task to JSON.
public virtual void deserialize(json::Value & root) Deserializes the task from JSON.
public template<typename T>
inline T * createTrigger()
public void setTrigger(sked::Trigger* trigger)
publicsked::Trigger& trigger()
publicScheduler& scheduler()
public std::int64_t remaining() const
public std::string type() const
public std::string name() const
public void setName(const std::string & name)
protected std::string _type
protected std::string _name
protectedsked::Scheduler* _scheduler
protectedsked::Trigger* _trigger
protected mutableMutex_mutex
protected virtual ~Task() Should remain protected.
protected virtual bool beforeRun()
protected void run()
protected virtual bool afterRun()

Members

public Task(const std::string & type,const std::string & name)

public Task(Scheduler& scheduler,const std::string & type,const std::string & name)

public virtual void serialize(json::Value & root)

Serializes the task to JSON.

public virtual void deserialize(json::Value & root)

Deserializes the task from JSON.

public template<typename T>
inline T * createTrigger()

public void setTrigger(sked::Trigger* trigger)

publicsked::Trigger& trigger()

Returns a reference to the associated sked::Trigger or throws an exception.

publicScheduler& scheduler()

Returns a reference to the associated Scheduler or throws an exception.

public std::int64_t remaining() const

Returns the milliseconds remaining until the next scheduled timeout. An sked::Trigger must be associated or an exception will be thrown.

public std::string type() const

public std::string name() const

public void setName(const std::string & name)

protected std::string _type

protected std::string _name

protectedsked::Scheduler* _scheduler

protectedsked::Trigger* _trigger

protected mutableMutex_mutex

protected virtual ~Task()

Should remain protected.

protected virtual bool beforeRun()

protected void run()

Called by the TaskRunner to run the task. Override this method to implement task action. Returning true means the true should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed id destroy() was called during the current task iteration.

protected virtual bool afterRun()

class scy::sked::TaskFactory

The TaskFactory can dynamically instantiate registered sked::Task and sked::Trigger classes from named strings.

Summary

Members Descriptions
public inlinesked::Task* createTask(const std::string & type)
public template<typename T>
inline void registerTask(const std::string & type)
public inline void unregisterTask(const std::string & type)
public inline TaskMap tasks() const
public inlinesked::Trigger* createTrigger(const std::string & type)
public template<typename T>
inline void registerTrigger(const std::string & type)
public inline void unregisterTrigger(const std::string & type)
public inline TriggerMap triggers() const
protected mutableMutex_mutex
protected TaskMap _tasks
protected TriggerMap _triggers

Members

public inlinesked::Task* createTask(const std::string & type)

public template<typename T>
inline void registerTask(const std::string & type)

public inline void unregisterTask(const std::string & type)

public inline TaskMap tasks() const

public inlinesked::Trigger* createTrigger(const std::string & type)

public template<typename T>
inline void registerTrigger(const std::string & type)

public inline void unregisterTrigger(const std::string & type)

public inline TriggerMap triggers() const

protected mutableMutex_mutex

protected TaskMap _tasks

protected TriggerMap _triggers

struct scy::sked::DailyTrigger

struct scy::sked::DailyTrigger
  : public scy::sked::Trigger

Summary

Members Descriptions
publicDateTimetimeOfDay
public std::vector<DaysOfTheWeek> daysExcluded
public DailyTrigger()
public virtual void update()

Members

publicDateTimetimeOfDay

This value represents the time of day the task will trigger. The date part of the timestamp is redundant.

public std::vector<DaysOfTheWeek> daysExcluded

Days of the week can be excluded by adding the appropriate bit flag here.

public DailyTrigger()

public virtual void update()

Updates the scheduleAt value to the next scheduled time.

struct scy::sked::IntervalTrigger

struct scy::sked::IntervalTrigger
  : public scy::sked::Trigger

Summary

Members Descriptions
publicTimespaninterval
public int maxTimes
public IntervalTrigger()
public virtual void update()
public virtual bool expired()
public virtual void serialize(json::Value & root)
public virtual void deserialize(json::Value & root)

Members

publicTimespaninterval

This value represents the interval to wait before running the task.

public int maxTimes

The maximum number of times the task will be run before it is destroyed. 0 for no effect.

public IntervalTrigger()

public virtual void update()

Updates the scheduleAt value to the next scheduled time.

public virtual bool expired()

Returns true if the task is expired and should be destroyed. Returns false by default.

public virtual void serialize(json::Value & root)

public virtual void deserialize(json::Value & root)

struct scy::sked::OnceOnlyTrigger

struct scy::sked::OnceOnlyTrigger
  : public scy::sked::Trigger

Summary

Members Descriptions
public OnceOnlyTrigger()
public inline virtual void update()
public virtual bool expired()

Members

public OnceOnlyTrigger()

public inline virtual void update()

Updates the scheduleAt value to the next scheduled time.

public virtual bool expired()

Returns true if the task is expired and should be destroyed. Returns false by default.

struct scy::sked::Trigger

struct scy::sked::Trigger
  : public scy::json::ISerializable

Summary

Members Descriptions
public std::string type The type of this trigger class.
public std::string name The display name of this trigger class.
public int timesRun
publicDateTimecreatedAt The time the task was created.
publicDateTimescheduleAt The time the task is scheduled to run.
publicDateTimelastRunAt The time the task was last run.
public Trigger(const std::string & type,const std::string & name)
public void update()
public virtual std::int64_t remaining()
public virtual bool timeout()
public virtual bool expired()
public virtual void serialize(json::Value & root)
public virtual void deserialize(json::Value & root)

Members

public std::string type

The type of this trigger class.

public std::string name

The display name of this trigger class.

public int timesRun

The number of times the task has run since creation;

publicDateTimecreatedAt

The time the task was created.

publicDateTimescheduleAt

The time the task is scheduled to run.

publicDateTimelastRunAt

The time the task was last run.

public Trigger(const std::string & type,const std::string & name)

public void update()

Updates the scheduleAt value to the next scheduled time.

public virtual std::int64_t remaining()

Returns the milliseconds remaining until the next scheduled timeout.

public virtual bool timeout()

Returns true if the task is ready to be run, false otherwise.

public virtual bool expired()

Returns true if the task is expired and should be destroyed. Returns false by default.

public virtual void serialize(json::Value & root)

public virtual void deserialize(json::Value & root)

results matching ""

    No results matching ""