32#ifndef DRAIN_CONTEXT_H_
33#define DRAIN_CONTEXT_H_
42#include "drain/util/Cloner.h"
43#include "drain/util/StatusFlags.h"
44#include "drain/util/VariableMap.h"
47#include "CommandSequence.h"
70 Loop::loopStack loops;
85 long int getId()
const {
90 const std::string & getName()
const {
130 const Variable & getStatus(
const std::string & key,
bool update=
true)
const {
134 return statusMap[key];
142 void setStatus(
const std::string & key,
const T & value){
143 statusMap[key] = value;
162 bool isScriptDefined(){
163 return !routine.empty();
173 const std::string name;
181 void updateStatus()
const;
185 static long int counter;
207 bool expandVariables;
306 template <
class T=Context>
314 return getCloner<T>().getSourceOrig();
349 return getCloner<C>();
Utilities.
Definition Context.h:196
std::string formatStr
Definition Context.h:214
virtual const drain::VariableMap & getStatusMap() const
A long description of context variables and other resources.
Definition Context.h:111
StatusFlags statusFlags
Optional log filename (syntax): when defined, automatically opened by CommandBank::run()
Definition Context.h:104
virtual void report(StatusFlags &flags)
Report status. Typically, report final status of a thread to its base context.
Definition Context.h:153
const std::string basename
Used by copy const.
Definition Context.h:169
Contextual(Context &ctx)
Copies internal contextPtr.
Definition Context.h:277
bool contextIsSet() const
True, if contextPtr has been set.
Definition Context.h:296
Contextual(const Contextual &src)
Copies base context (even null) of the source. Notice that the actual instance may be of derived clas...
Definition Context.h:271
T & getContext() const
If context has been set, returns it through a cast to base class Context.
Definition Context.h:307
Context * contextPtr
Pointer to the current context; nullptr if not set.
Definition Context.h:329
static Cloner< Context, T > & getCloner()
Returns the object cloner.
Definition Context.h:321
void setContext()
Sets internal contextPtr to the static source.
Definition Context.h:284
Contextual()
Sets internal contextPtr to NULL.
Definition Context.h:267
void setExternalContext(Context &ctx)
Sets internal contextPtr to outside target.
Definition Context.h:290
Handler for notifications sent by a Logger.
Definition Log.h:159
void set(const V &... args)
Set bits, accepting numeric values or keys.
Definition Flags.h:293
Definition CommandSequence.h:85
Adds class-specific convenience functions.
Definition Context.h:335
A map of Variables.
Definition VariableMap.h:61
DRAIN_VARIABLE Variable
Value container supporting dynamic type.
Definition Variable.h:63
Wrapper for derived class S, returning base class T.
Definition Cloner.h:118
virtual const S & getSourceOrig() const
Returns a const reference to a default instance, in actual class.
Definition Cloner.h:229