1#ifndef _DRAMA2_UTIL_INC
2#define _DRAMA2_UTIL_INC
30#include "drama2_err.h"
41#define D2DEPRECATED __attribute__ ((deprecated))
42#define D2DEPRECATED_EXPLAIN(_a_) __attribute__ ((deprecated(_a_)))
45#define D2DEPRECATED_EXPLAIN(_a_)
64#if defined(D2_NO_FMT_DEPRECATION_ALERTS)
65#define D2_FMT_DEPRECATED(_a_)
67#elif defined(__GNUC__)
68#define D2_FMT_DEPRECATED(_a_) __attribute__((deprecated(_a_)))
71#define D2_FMT_DEPRECATED(_a_)
90 template <
typename Container>
110 const std::string::size_type
len =
in.length();
111 std::string::size_type
i = 0;
117 if (
i == std::string::npos)
124 if (
j == std::string::npos) {
187 template <
typename T>
261 template <
typename AT,
typename T>
262 class ScopeGuardAtomic {
263 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)");
291 _exitVal = _item.load();
326 _item.store(_exitVal);
335 template<
class... >
struct voider {
using type =
void; };
350 template <
typename,
typename = drama::
void_t<>>
struct is_stl_container : std::false_type{};
ScopeGuardAtomic(AT &item, const T executionVal, const T exitVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:346
ScopeGuardAtomic(AT &item, const T executionVal)
Construct a ScopeGuardAtomic for the specified item.
Definition util.hh:317
~ScopeGuardAtomic()
Destroy the ScopeGuardAtomic item, restoring its value to the specified exit value.
Definition util.hh:352
This class implements a simple scope guard class with an std::atomic based type as the underlying typ...
Definition util.hh:289
~ScopeGuard()
Destroy the ScopeGuard item, restoring its value to the specified exit value.
Definition util.hh:271
ScopeGuard(T &item, const T executionVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:239
ScopeGuard(T &item, const T executionVal, const T exitVal)
Construct a ScopeGuard for the specified item.
Definition util.hh:264
This class implements a simple scope guard class.
Definition util.hh:215
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1339
bool ActionExists(const std::string &name)
Determines if action exists.
constexpr bool is_stl_container_v
A type trait to helper determine if a type is an STL container.
Definition util.hh:393
void stringtok(Container &container, std::string const &in, const char *const delimiters=" \t\n\r")
stringtok is a replacement for C's strtok() function.
Definition util.hh:119
typename voider< T0toN... >::type void_t
Define a void_t equivalent.
Definition util.hh:371
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:99
Type trait returning true of the specified type is NOT a STL container.
Definition util.hh:377