32 #ifndef DRAIN_CONTEXT_H_
33 #define DRAIN_CONTEXT_H_
36 #include <drain/Log.h>
45 #include "drain/util/Cloner.h"
47 #include "drain/util/StatusFlags.h"
48 #include "drain/util/StringMapper.h"
49 #include "drain/util/VariableMap.h"
79 long int getId()
const {
84 const std::string & getName()
const {
116 const Variable & getStatus(
const std::string & key,
bool update)
const {
119 return statusMap[key];
127 void setStatus(
const std::string & key,
const T & value){
128 statusMap[key] = value;
151 const std::string name;
159 void updateStatus()
const {
169 static long int counter;
191 bool expandVariables;
269 contextPtr = & getCloner<C>().get();
281 return (contextPtr !=
nullptr);
290 template <
class T=Context>
293 return (T &)*contextPtr;
298 return getCloner<T>().getSourceOrig();
332 return getCloner<C>();
Utilities.
Definition: Context.h:180
std::string formatStr
Definition: Context.h:198
StatusFlags statusFlags
Optional log filename (syntax): when defined, automatically opened by CommandBank::run()
Definition: Context.h:98
virtual drain::VariableMap & getStatusMap(bool update=true)
A long description of context variables and other resources.
Definition: Context.h:105
virtual void report(StatusFlags &flags)
Report status. Typically, report final status of a thread to its base context.
Definition: Context.h:138
const std::string basename
Used by copy const.
Definition: Context.h:67
Definition: Context.h:245
Contextual(Context &ctx)
Copies internal contextPtr.
Definition: Context.h:261
bool contextIsSet() const
True, if contextPtr has been set.
Definition: Context.h:280
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:255
T & getContext() const
If context has been set, returns it through a cast to base class Context.
Definition: Context.h:291
void setContext()
Sets internal contextPtr to the static source.
Definition: Context.h:268
Contextual()
Sets internal contextPtr to NULL.
Definition: Context.h:251
void setExternalContext(Context &ctx)
Sets internal contextPtr to outside target.
Definition: Context.h:274
std::string getKeys(ivalue_t value, char separator=0) const
Given an integer, retrieves dictionary keys corresponding to each index of set bits.
Definition: FlagsOld.h:250
Flagger & set(const T &arg, const TT &... args)
Set desired flags. Does not reset any flag (zero value has no effect).
Definition: FlagsOld.h:101
Definition: Context.h:204
Definition: StatusFlags.h:45
Adds class-specific convenience functions.
Definition: Context.h:318
A map of Variables.
Definition: VariableMap.h:61
Definition: DataSelector.cpp:1277
DRAIN_VARIABLE Variable
Value container supporting dynamic type.
Definition: Variable.h:63
Wrapper for derived class S, returning base class T.
Definition: Cloner.h:117
virtual const S & getSourceOrig() const
Returns a const reference to a default instance, in actual class.
Definition: Cloner.h:228