1#ifndef _DRAMA2_UTIL_INC
2#define _DRAMA2_UTIL_INC
30#include "drama2_err.h"
40#define D2DEPRECATED __attribute__ ((deprecated))
41#define D2DEPRECATED_EXPLAIN(_a_) __attribute__ ((deprecated(_a_)))
44#define D2DEPRECATED_EXPLAIN(_a_)
67 template <
typename Container>
87 const std::string::size_type
len =
in.length();
88 std::string::size_type
i = 0;
94 if (
i == std::string::npos)
101 if (
j == std::string::npos) {
164 template <
typename T>
238 template <
typename AT,
typename T>
239 class ScopeGuardAtomic {
240 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)");
268 _exitVal = _item.load();
303 _item.store(_exitVal);
ScopeGuardAtomic(AT &item, const T executionVal, const T exitVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:323
ScopeGuardAtomic(AT &item, const T executionVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:294
~ScopeGuardAtomic()
Destroy the ScopeGuardAtomic item, restoring its value to the specified exit value.
Definition util.hh:329
This class implements a simple scope guard class with an std::atomic based type as the underlying typ...
Definition util.hh:266
~ScopeGuard()
Destroy the ScopeGuard item, restoring its value to the specified exit value.
Definition util.hh:248
ScopeGuard(T &item, const T executionVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:216
ScopeGuard(T &item, const T executionVal, const T exitVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:241
This class implements a simple scope guard class.
Definition util.hh:192
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1327
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:96
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