1#ifndef _DRAMA2_UTIL_INC
2#define _DRAMA2_UTIL_INC
30#include "drama2_err.h"
40#define D2DEPRECATED __attribute__ ((deprecated))
65 template <
typename Container>
85 const std::string::size_type
len =
in.length();
86 std::string::size_type
i = 0;
92 if (
i == std::string::npos)
99 if (
j == std::string::npos) {
162 template <
typename T>
236 template <
typename AT,
typename T>
237 class ScopeGuardAtomic {
238 static_assert(std::is_same<AT, std::atomic<T> >
::value,
"Type AT is not of type std::atomic<T> (Where T = initial/exit value type and AT is the type of the item we are guarding)");
266 _exitVal = _item.load();
301 _item.store(_exitVal);
ScopeGuardAtomic(AT &item, const T executionVal, const T exitVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:321
ScopeGuardAtomic(AT &item, const T executionVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:292
~ScopeGuardAtomic()
Destroy the ScopeGuardAtomic item, restoring its value to the specified exit value.
Definition util.hh:327
This class implements a simple scope guard class with an std::atomic based type as the underlying typ...
Definition util.hh:264
~ScopeGuard()
Destroy the ScopeGuard item, restoring its value to the specified exit value.
Definition util.hh:246
ScopeGuard(T &item, const T executionVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:214
ScopeGuard(T &item, const T executionVal, const T exitVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:239
This class implements a simple scope guard class.
Definition util.hh:190
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
void stringtok(Container &container, std::string const &in, const char *const delimiters=" \t\n\r")
stringtok is a replacment for C's strtok() function.
Definition util.hh:94
std::string FindFile(const std::string &spec, bool impdir=false)
Find a file using DulFindFile() specifications.
std::string StatusToString(StatusType status)
Convert a DRAMA status code to text.
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93