Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
Activity Class Reference

#include "vault/gear/activity.hpp"

Description

Record to describe an Activity, to happen within the Scheduler's control flow.

Note
Activity is a »POD with constructor«
  • trivially destructible
  • trivially copyable
  • standard layout

Definition at line 226 of file activity.hpp.

Classes

union  ArgumentData
 Storage of Argument data dependent on Activity::verb_. More...
 
struct  Callback
 Extension point to invoke. More...
 
struct  Condition
 Access gate condition to evaluate. More...
 
struct  Feed
 Payload data to provide. More...
 
struct  Invocation
 External work functor to activate. More...
 
struct  Notification
 Notification towards another Activity. More...
 
struct  TimeWindow
 Time window to define for activation. More...
 
struct  Timing
 Timing observation to propagate. More...
 

Public Types

enum  Verb {
  INVOKE ,
  WORKSTART ,
  WORKSTOP ,
  NOTIFY ,
  GATE ,
  POST ,
  FEED ,
  HOOK ,
  TICK
}
 All possible kinds of activities. More...
 

Public Attributes

const Verb verb_
 
Activitynext
 Activities are organised into chains to represent relations based on verbs.
 
ArgumentData data_
 

Public Member Functions

 Activity (Verb verb) noexcept
 
 Activity (uint64_t o1, uint64_t o2) noexcept
 
 Activity (JobFunctor &job, Time nominalTime, Activity &feed) noexcept
 
 Activity (Activity *target, Time limitWhen=Time::ANYTIME) noexcept
 
 Activity (int expectNotifications, Time deadline=Time::NEVER) noexcept
 
 Activity (Time when, Activity *followUp) noexcept
 
 Activity (Time start, Time after, Activity *followUp) noexcept
 
 Activity (activity::Hook &callback, size_t arg) noexcept
 
 Activity () noexcept
 
 operator std::string () const
 diagnostic representation
 
std::string showVerb () const
 
std::string showData () const
 
template<class EXE >
activity::Proc activate (Time now, EXE &executionCtx)
 Core Operation: Activate and perform this Activity.
 
template<class EXE >
activity::Proc dispatch (Time now, EXE &executionCtx)
 Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or priority queue; typically this is achieved by invoking the post-λ on the executionCtx, or by activating a POST-Activity.
 
bool is (Activity::Verb expectedVerb) const
 
void incDependencies ()
 
void setNotificationTarget (Activity *target, Time limitStart=Time::ANYTIME)
 
Time constrainedStart (Time start)
 
Time constrainedDeath (Time death)
 

Private Types

using Instant = activity::Instant
 

Private Member Functions

void setDefaultArg (Verb verb) noexcept
 
activity::Proc invokeFunktor (Time) noexcept
 
template<class EXE >
activity::Proc signalStart (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc signalStop (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc checkGate (Time now, EXE &)
 
activity::Proc receiveGateNotification (Time now)
 
template<class EXE >
activity::Proc postSelf (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc postNotify (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc callHook (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc notifyHook (Time now, EXE &executionCtx)
 
template<class EXE >
activity::Proc doTick (Time now, EXE &executionCtx)
 

Constructor & Destructor Documentation

◆ Activity() [1/9]

Activity ( Verb  verb)
inlineexplicitnoexcept

Definition at line 333 of file activity.hpp.

◆ Activity() [2/9]

Activity ( uint64_t  o1,
uint64_t  o2 
)
inlinenoexcept

Definition at line 345 of file activity.hpp.

References Activity::FEED.

◆ Activity() [3/9]

Activity ( JobFunctor job,
Time  nominalTime,
Activity feed 
)
inlinenoexcept

Definition at line 352 of file activity.hpp.

References Activity::INVOKE.

◆ Activity() [4/9]

Activity ( Activity target,
Time  limitWhen = Time::ANYTIME 
)
inlineexplicitnoexcept

Definition at line 361 of file activity.hpp.

References Activity::NOTIFY.

◆ Activity() [5/9]

Activity ( int  expectNotifications,
Time  deadline = Time::NEVER 
)
inlineexplicitnoexcept

Definition at line 369 of file activity.hpp.

References Activity::GATE.

◆ Activity() [6/9]

Activity ( Time  when,
Activity followUp 
)
inlinenoexcept

Definition at line 376 of file activity.hpp.

References Activity::POST.

◆ Activity() [7/9]

Activity ( Time  start,
Time  after,
Activity followUp 
)
inlinenoexcept

Definition at line 383 of file activity.hpp.

References Activity::POST.

◆ Activity() [8/9]

Activity ( activity::Hook callback,
size_t  arg 
)
inlinenoexcept

Definition at line 390 of file activity.hpp.

References Activity::HOOK.

◆ Activity() [9/9]

Activity ( )
inlinenoexcept

Definition at line 397 of file activity.hpp.

References Activity::TICK.


Class Documentation

◆ vault::gear::Activity::ArgumentData

union vault::gear::Activity::ArgumentData
Class Members
Feed feed
Timing timing
Callback callback
Condition condition
TimeWindow timeWindow
Invocation invocation
Notification notification
+ Collaboration diagram for Activity::ArgumentData:

◆ vault::gear::Activity::Callback

struct vault::gear::Activity::Callback
Class Members
Hook * hook
size_t arg
+ Collaboration diagram for Activity::Callback:

◆ vault::gear::Activity::Feed

struct vault::gear::Activity::Feed
Class Members
uint64_t one
uint64_t two
+ Collaboration diagram for Activity::Feed:

◆ vault::gear::Activity::Invocation

struct vault::gear::Activity::Invocation
Class Members
JobFunctor * task
Instant time
+ Collaboration diagram for Activity::Invocation:

◆ vault::gear::Activity::Notification

struct vault::gear::Activity::Notification
Class Members
Activity * target
Instant timing
+ Collaboration diagram for Activity::Notification:

◆ vault::gear::Activity::TimeWindow

struct vault::gear::Activity::TimeWindow
Class Members
Instant life
Instant dead
+ Collaboration diagram for Activity::TimeWindow:

◆ vault::gear::Activity::Timing

struct vault::gear::Activity::Timing
Class Members
Instant instant
size_t quality
+ Collaboration diagram for Activity::Timing:

Member Typedef Documentation

◆ Instant

using Instant = activity::Instant
private

Definition at line 228 of file activity.hpp.

Member Enumeration Documentation

◆ Verb

enum Verb

All possible kinds of activities.

Enumerator
INVOKE 

dispatch a JobFunctor into a worker thread

WORKSTART 

signal start of some processing and transition grooming mode ⟼ *work mode

WORKSTOP 

correspondingly signal end of some processing

NOTIFY 

push a message to another Activity

GATE 

probe window + count-down; activate next Activity, else re-schedule

POST 

post a message providing a chain of further time-bound Activities

FEED 

supply additional payload data for a preceding Activity

HOOK 

invoke an extension point through the activity::Hook interface

TICK 

internal engine »heart beat« for internal maintenance hook(s)

Definition at line 232 of file activity.hpp.

Member Function Documentation

◆ operator std::string()

operator std::string ( ) const

diagnostic representation

◆ showVerb()

string showVerb ( ) const

Definition at line 70 of file activity-lang.cpp.

References Activity::FEED, Activity::GATE, Activity::HOOK, Activity::INVOKE, Activity::NOTIFY, Activity::POST, Activity::TICK, Activity::verb_, Activity::WORKSTART, and Activity::WORKSTOP.

Referenced by ActivityDetector::buildActivationTap(), and ActivityDetector::buildGateWatcher().

+ Here is the caller graph for this function:

◆ showData()

◆ activate()

template<class EXE >
activity::Proc activate ( Time  now,
EXE &  executionCtx 
)

Core Operation: Activate and perform this Activity.

Template Parameters
EXEconcrete binding for the execution context
Parameters
nowcurrent _»wall clock time« (time used for scheduling)
Remarks
this defines the Activity state machine and implements behaviour in dependency of the kind of Activity::Verb. Actual implementation defined effects in the Scheduler are abstracted as executionCtx:
  • post : dispatch the given Activity with start time
  • work : drop the GroomingToken and start processing
  • done : record the end time of a media computation
  • tick : regular maintenance hook
Returns
activity::Proc indication how to proceed with execution

Definition at line 626 of file activity.hpp.

References Activity::callHook(), Activity::checkGate(), Activity::doTick(), Activity::FEED, Activity::GATE, Activity::HOOK, Activity::INVOKE, Activity::invokeFunktor(), Activity::NOTIFY, vault::gear::activity::PASS, Activity::POST, Activity::postNotify(), Activity::postSelf(), Activity::signalStart(), Activity::signalStop(), Activity::TICK, Activity::verb_, Activity::WORKSTART, and Activity::WORKSTOP.

Referenced by ActivityLang::activateChain(), ActivityDetector::ActivityProbe::activation(), Activity::dispatch(), ActivityDetector_test::insert_ActivationTap(), SchedulerCommutator_test::verify_Significance(), SchedulerActivity_test::verifyActivity_Gate_block(), SchedulerActivity_test::verifyActivity_Gate_dead(), SchedulerActivity_test::verifyActivity_Gate_opened(), SchedulerActivity_test::verifyActivity_Gate_pass(), ActivityDetector_test::watch_ActivationProbe(), ActivityDetector_test::watch_ActivationTap(), ActivityDetector_test::watch_gate(), and ActivityDetector_test::watch_notification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dispatch()

template<class EXE >
activity::Proc dispatch ( Time  now,
EXE &  executionCtx 
)

Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or priority queue; typically this is achieved by invoking the post-λ on the executionCtx, or by activating a POST-Activity.

Control flow passing here has acquired the GroomingToken and can thus assume single threaded execution until WORKSTART.

Notably this entrance is used to implement gating to wait for prerequisites; when a notification is passed to a GATE-Activity, the embedded counter is decremented; after all prerequisites are „checked off“ this way, the Activity-chain behind the Gate is activated.

Parameters
nowthe scheduler-time; assuming that a call through the post-λ will only be actually de-queued when scheduler-time equals the start time defined in the POST activity and passed through the post-λ as parameter.
Note
special twist for the NOTIFY-Activity: it is not activated itself, rather the #notify operation is invoked on its target argument; this is necessary since a notification passes control-flow outside the regular linear next-chain.

Definition at line 676 of file activity.hpp.

References Activity::activate(), Activity::FEED, Activity::GATE, Activity::HOOK, Activity::notifyHook(), vault::gear::activity::PASS, Activity::POST, Activity::receiveGateNotification(), and Activity::verb_.

Referenced by ActivityLang::dispatchChain(), ActivityDetector::ActivityProbe::notify(), SchedulerActivity_test::verifyActivity_Gate_notify(), and SchedulerActivity_test::verifyActivity_Gate_opened().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is()

◆ incDependencies()

void incDependencies ( )
inline

Definition at line 428 of file activity.hpp.

References Activity::ArgumentData::condition, Activity::data_, Activity::GATE, Activity::Condition::incDependencies(), and Activity::is().

Referenced by Term::expectNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNotificationTarget()

void setNotificationTarget ( Activity target,
Time  limitStart = Time::ANYTIME 
)
inline

Definition at line 435 of file activity.hpp.

References Activity::data_, Activity::is(), Activity::ArgumentData::notification, Activity::NOTIFY, Activity::Notification::target, and Activity::Notification::timing.

Referenced by Term::expectNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ constrainedStart()

Time constrainedStart ( Time  start)
inline
Parameters
startconstrain by a POST-Activity's start time

Definition at line 443 of file activity.hpp.

References Activity::data_, Activity::is(), Activity::TimeWindow::life, util::max(), Activity::POST, and Activity::ArgumentData::timeWindow.

Referenced by ActivationEvent::refineTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ constrainedDeath()

Time constrainedDeath ( Time  death)
inline
Parameters
deathconstrain by a POST-Activity's deadline

Definition at line 450 of file activity.hpp.

References Activity::data_, Activity::TimeWindow::dead, Activity::is(), util::min(), Activity::POST, and Activity::ArgumentData::timeWindow.

Referenced by ActivationEvent::refineTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultArg()

◆ invokeFunktor()

activity::Proc invokeFunktor ( Time  )
inlineprivatenoexcept

Definition at line 485 of file activity.hpp.

References Activity::data_, Activity::FEED, Activity::ArgumentData::feed, vault::gear::activity::HALT, Activity::ArgumentData::invocation, Activity::INVOKE, JobClosure::invokeJobOperation(), Activity::next, ON_EXCEPTION_RETURN, Activity::Feed::one, vault::gear::activity::PASS, Activity::Invocation::task, Activity::Invocation::time, Activity::Feed::two, and Activity::verb_.

Referenced by Activity::activate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ signalStart()

template<class EXE >
activity::Proc signalStart ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 511 of file activity.hpp.

References Activity::data_, vault::gear::activity::PASS, Activity::Timing::quality, and Activity::ArgumentData::timing.

Referenced by Activity::activate().

+ Here is the caller graph for this function:

◆ signalStop()

template<class EXE >
activity::Proc signalStop ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 519 of file activity.hpp.

References Activity::data_, vault::gear::activity::PASS, Activity::Timing::quality, and Activity::ArgumentData::timing.

Referenced by Activity::activate().

+ Here is the caller graph for this function:

◆ checkGate()

template<class EXE >
activity::Proc checkGate ( Time  now,
EXE &   
)
inlineprivate

Definition at line 527 of file activity.hpp.

References Activity::ArgumentData::condition, Activity::data_, Activity::GATE, Activity::Condition::isDead(), Activity::Condition::isHold(), vault::gear::activity::PASS, vault::gear::activity::SKIP, and Activity::verb_.

Referenced by Activity::activate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ receiveGateNotification()

activity::Proc receiveGateNotification ( Time  now)
inlineprivate

Definition at line 539 of file activity.hpp.

References Activity::ArgumentData::condition, Activity::data_, Activity::GATE, Activity::Condition::isFree(), Activity::Condition::lockPermanently(), vault::gear::activity::PASS, Activity::Condition::rest, vault::gear::activity::SKIP, and Activity::verb_.

Referenced by Activity::dispatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postSelf()

template<class EXE >
activity::Proc postSelf ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 556 of file activity.hpp.

References Activity::data_, Activity::TimeWindow::dead, Activity::is(), Activity::TimeWindow::life, Time::NEVER, Activity::next, Activity::POST, and Activity::ArgumentData::timeWindow.

Referenced by Activity::activate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postNotify()

template<class EXE >
activity::Proc postNotify ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 567 of file activity.hpp.

References Activity::ArgumentData::callback, Activity::ArgumentData::condition, Activity::data_, Activity::GATE, Activity::Condition::getDeadline(), Hook::getDeadline(), Activity::HOOK, Activity::Callback::hook, Activity::is(), Time::NEVER, Activity::ArgumentData::notification, Activity::NOTIFY, Activity::Notification::target, and Activity::Notification::timing.

Referenced by Activity::activate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callHook()

template<class EXE >
activity::Proc callHook ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 585 of file activity.hpp.

References Hook::activation(), Activity::ArgumentData::callback, Activity::data_, Activity::Callback::hook, and vault::gear::activity::PASS.

Referenced by Activity::activate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyHook()

template<class EXE >
activity::Proc notifyHook ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 593 of file activity.hpp.

References Activity::ArgumentData::callback, Activity::data_, Activity::Callback::hook, Hook::notify(), and vault::gear::activity::PASS.

Referenced by Activity::dispatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doTick()

template<class EXE >
activity::Proc doTick ( Time  now,
EXE &  executionCtx 
)
inlineprivate

Definition at line 601 of file activity.hpp.

Referenced by Activity::activate().

+ Here is the caller graph for this function:

Member Data Documentation

◆ verb_

◆ next

◆ data_

+ Inheritance diagram for Activity:
+ Collaboration diagram for Activity:

The documentation for this class was generated from the following files: