1#ifndef DRAMA2_GITARG_INC
2#define DRAMA2_GITARG_INC
97 if ((
unsigned int)(
f1) & (
unsigned int)(
f2))
107 inline void ___CheckLockTaken(
108 const std::string &
func,
109 const std::string &
file,
121 "Programming error - the program invoked a gitarg::Get() method (or constructor) without having taken the DRAMA lock. Please copy stack trace above to support.",
141 extern void __AddEnumPossiblities(
const Flags flags,
159 class EnumLookupClass {
218 template <
typename LookupClass,
typename EnumType>
class Enum {
227 void SetValue(
const unsigned int i) {
228 if (
i > lookupObject.GetMaxValue())
229 _value = InvalidValue();
237 return (
EnumType)(lookupObject.GetMaxValue()+1);
248 _value = InvalidValue();
286 Enum(
const sds::Id& Id,
287 const std::string &
Name=
"Argument1",
289 const std::string &
Default=
"",
291 :_value(InvalidValue()) {
327 const std::string &
Name=
"Argument1",
329 const std::string &
Default=
"",
331 :_value(InvalidValue()) {
367 void Get(
const sds::Id& Id,
368 const std::string &
Name=
"Argument1",
370 const std::string &
Default=
"",
389 lookupObject.GetStringArray(),
391 (
int)(
flags),
sizeof(
string),
string,&index,&
status);
396 "Failed to fetch Enumerated Argument from SDS",
400 __AddEnumPossiblities(
flags, lookupObject.GetStringArray(), &
except);
413 operator std::string()
const {
414 return lookupObject.GetStringArray()[
int(_value)];
466 template <
long int MinVal,
long int MaxVal,
long int DefaultVal=0>
class Real {
469 virtual const double * Range() {
514 const std::string &
Name=
"Argument1",
555 const std::string &
Name=
"Argument1",
603 const std::string &
Name=
"Argument1",
652 const std::string &
Name=
"Argument1",
691 const std::string &
Name=
"Argument1",
708 "Failed to fetch real number Argument from SDS",
751 const std::string &
Name=
"Argument1",
770 "Failed to fetch real number Argument from SDS",
814 virtual const long int * Range() {
858 const std::string &
Name =
"Argument1",
898 const std::string &
Name =
"Argument1",
946 const std::string &
Name =
"Argument1",
990 const std::string &
Name =
"Argument1",
1029 const std::string &
Name=
"Argument1",
1045 "Failed to fetch integer Argument from SDS",
1089 const std::string &
Name=
"Argument1",
1107 "Failed to fetch integer Argument from SDS",
1117 operator long int()
const {
1137 class String :
public std::string {
1138 using std::string::string;
1141 static const unsigned _DefaultStringLength = 100;
1143 void RawGet (
const sds::Id& Id,
const std::string &
Name,
1177 const std::string &
Name =
"Argument1",
1179 const std::string &
Default =
"",
1216 const std::string &
Name =
"Argument1",
1218 const std::string &
Default =
"",
1275 const std::string &
Name =
"Argument1",
1277 const std::string &
Default =
"",
1286 this->std::string::operator=(
str);
1295 this->std::string::operator=(
str);
1304 this->std::string::operator=(
s);
1314 this->std::string::operator=(
c);
1406 const std::string &
Name=
"Argument1",
1451 const std::string &
Name=
"Argument1",
1489 const std::string &
Name=
"Argument1",
1506 "Failed to fetch boolean Argument from SDS",
1516 operator bool()
const {
1545 class Id :
public sds::Id {
1547 bool _readFromFile =
false;
1548 bool _defaultUsed =
false;
1549 std::string _actualName;
1551 void UseDefaultIfReq(
const std::string &name,
1553 const std::string &fileName,
1556 const std::string &
mess);
1563 Id() : sds::
Id() { }
1623 const std::string &
Name=
"Argument1",
1625 const std::string
Default =
"",
1691 const std::string &
Name=
"Argument1",
1693 const std::string
Default =
"",
1757 const std::string &
Name=
"Argument1",
1759 const std::string
Default =
"",
1797 class Filename :
public String {
1834 const std::string &
Name =
"Argument1",
1836 const std::string &
Default =
"",
1878 const std::string &
Name =
"Argument1",
1880 const std::string &
Default =
"",
1938 const std::string &
Name =
"Argument1",
1940 const std::string &
Default =
"",
2037 typename std::enable_if<std::is_base_of<
ArgFlagVal,
2038 typename ContainerType::value_type>
::value>
::type* =
nullptr>
2043 const bool _ignoreCase;
2044 unsigned _theValue = 0;
2094 const unsigned First = 1,
2095 const unsigned Last = 0,
2127 const unsigned First = 1,
2141 "ArgFlags First argument position value of % is less then min of 1",
2147 "ArgFlags Last argument position value of % is less then First of %",
2158 for (
unsigned arg =
First; arg <
Last ; arg++)
2165 auto thisVal = _GetString(
Id, arg, _ignoreCase);
2179 for (
auto & flag : _validFlags)
2183 _theValue |= flag.flag;
2191 "Argument value at position %, %, is not an acceptable flag value",
An Exception class for exceptions thrown by DRAMA V2 classes.
Definition exception.hh:164
unsigned GetVal()
Return the flags value - the mask of set bits.
Definition gitarg.hh:2238
unsigned Get(const sds::Id &Id, const unsigned First=1, unsigned Last=0, const bool FailOnInvalid=true)
Get argument flag value set from an SDS structure.
Definition gitarg.hh:2153
ArgFlags(const ContainerType &validFlagVals, const sds::Id &Id, const unsigned First=1, const unsigned Last=0, const bool FailOnInvalid=true, const bool IgnoreCase=true)
Constructor with the initial value set from an SDS structure.
Definition gitarg.hh:2119
ArgFlags(const ContainerType &validFlagVals, bool ignoreCase=true)
Constructor.
Definition gitarg.hh:2088
This class is used to check for the existence of one or more flags in an SDS structure.
Definition gitarg.hh:2068
Bool(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const bool Default=false, const Flags flags=(Flags::Upper|Flags::Abbrev|Flags::KeepErr))
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:1475
Bool operator=(const bool src)
Assign a bool to this gitarg::Bool item.
Definition gitarg.hh:1551
Bool(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const bool Default=false, const Flags flags=(Flags::Upper|Flags::Abbrev|Flags::KeepErr))
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:1431
virtual const GitLogStrType * Lookup()
Return a pointer to an array of enum strings equivalents.
Definition gitarg.hh:1387
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const bool Default=false, const Flags flags=(Flags::Upper|Flags::Abbrev|Flags::KeepErr))
Get the value of the object from an SDS struture.
Definition gitarg.hh:1514
virtual ~Bool()
Destructor.
Definition gitarg.hh:1489
Bool(bool initVal=false)
Simple constructor with a default value of false.
Definition gitarg.hh:1395
A class which reads Boolean values from SDS argument structures.
Definition gitarg.hh:1370
virtual ~EnumLookupClass()
Destructor.
Definition gitarg.hh:215
virtual unsigned int GetMaxValue() const =0
This function should return the maximum normal value of the enumerated value.
virtual const char ** GetStringArray() const =0
Return a pointer to an array of enum strings equivalents.
An interface for the lookup class template arguments to drama::gitarg::Enum.
Definition gitarg.hh:186
virtual ~Enum()
Destructor.
Definition gitarg.hh:460
Enum(EnumType InitialValue)
Constructor with initial value supplied.
Definition gitarg.hh:283
Enum(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::Upper|Flags::Abbrev|Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:313
Enum & operator=(const EnumType &rhs)
Allow an item of the underlying EnumType to be assigned to this object.
Definition gitarg.hh:453
void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::Upper|Flags::Abbrev|Flags::KeepErr)
Get the value of the object from an SDS structure.
Definition gitarg.hh:394
Enum()
Default contructor for the object.
Definition gitarg.hh:274
Enum(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::Upper|Flags::Abbrev|Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:351
A class which reads Enumerated values from a SDS argument structures.
Definition gitarg.hh:245
Filename(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure.
Definition gitarg.hh:1902
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Fetch the value of this item from an SDS structure.
Filename(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure.
Definition gitarg.hh:1860
Filename()
Default constructor.
Definition gitarg.hh:1929
A class which reads a file name from an SDS Command argument structures.
Definition gitarg.hh:1824
Id(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure or file.
Definition gitarg.hh:1648
Id()
Default constructor.
Definition gitarg.hh:1590
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string Default="", const Flags flags=(Flags::KeepErr))
Get the value of the object from an SDS structure or file.
virtual bool WasReadFromFile() const
Indicates if the structure was read from a file.
virtual bool WasReadFromDefault() const
Indicates if the structure was read from the default.
Id(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure or file.
Definition gitarg.hh:1715
virtual std::string ActualName() const
Return the actual name of the file or structure.
A class which reads an SDS structure from DRAMA SDS Command argument structures.
Definition gitarg.hh:1572
Int(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const long Default=DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which contructs the value from an item in an SDS structure.
Definition gitarg.hh:883
virtual void Get(const sds::Id &Id, const long Min, const long Max, const std::string &Name="Argument1", const int Position=1, const long int Default=DefaultVal, const Flags flags=Flags::KeepErr)
Get the value of the object from an SDS structure.
Definition gitarg.hh:1112
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const long int Default=DefaultVal, const Flags flags=Flags::KeepErr)
Get the value of the object from an SDS structure.
Definition gitarg.hh:1054
Int(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const long Default=DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which contructs the value from an item in an SDS structure.
Definition gitarg.hh:922
Int(const long def=DefaultVal)
Simple constructor with a default value specified.
Definition gitarg.hh:852
Int(const sds::Id &Id, const long Min, const long Max, const std::string &Name="Argument1", const int Position=1, const long Default=DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which contructs the value from an item in an SDS structure.
Definition gitarg.hh:969
Int(drama::thread::TAction *taction, const sds::Id &Id, const long Min, const long Max, const std::string &Name="Argument1", const int Position=1, const long Default=DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which contructs the value from an item in an SDS structure.
Definition gitarg.hh:1012
A class which reads integer values from an SDS argument structure.
Definition gitarg.hh:838
Real(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const double Default=(double) DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure, for use in a threaded action...
Definition gitarg.hh:579
virtual void Get(const sds::Id &Id, const double Min, const double Max, const std::string &Name="Argument1", const int Position=1, const double Default=(double)(DefaultVal), const Flags flags=Flags::KeepErr)
Get the value of the object from an SDS structure.
Definition gitarg.hh:774
Real(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const double Default=(double) DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:539
Real(drama::thread::TAction *taction, const sds::Id &Id, const double Min, const double Max, const std::string &Name="Argument1", const int Position=1, const double Default=(double) DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure, for use in a threaded action...
Definition gitarg.hh:674
Real(const double def=(double) DefaultVal)
Simple constructor with a default value specified.
Definition gitarg.hh:507
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const double Default=(double)(DefaultVal), const Flags flags=Flags::KeepErr)
Get the value of the object from an SDS structure.
Definition gitarg.hh:716
Real(const sds::Id &Id, const double Min, const double Max, const std::string &Name="Argument1", const int Position=1, const double Default=(double) DefaultVal, const Flags flags=Flags::KeepErr)
Constructor which constructs the value from an item in an SDS structure.
Definition gitarg.hh:626
A class which reads real values from an SDS argument structure.
Definition gitarg.hh:493
String operator=(const std::string &str)
Assign a std::string to this gitarg::String.
Definition gitarg.hh:1312
String(drama::thread::TAction *taction, const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure.
Definition gitarg.hh:1240
String(const String &)=default
Copy constructor Default is sufficent.
String()
Default constructor.
Definition gitarg.hh:1271
String operator=(const String &str)
Assign a const std::string to this gitarg::String.
Definition gitarg.hh:1321
String & operator=(char c)
Set this gitarg::String to a string containing a single character.
Definition gitarg.hh:1340
String(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Constructor with the initial value set from an SDS structure.
Definition gitarg.hh:1203
virtual void Get(const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const std::string &Default="", const Flags flags=Flags::KeepErr)
Fetch the value of this item from an SDS structure.
String operator=(const char *s)
Copy contents of a C string into this gitarg::String.
Definition gitarg.hh:1330
A class which reads a string item from an SDS structure.
Definition gitarg.hh:1164
A C++ Interface to the handling SDS structures.
Definition sds.hh:428
A class used by threads to access and enable the DRAMA context of an action or of a particular UFACE ...
Definition thread.hh:562
A class which implements a DRAMA Action with runs a thread.
Definition threadaction.hh:199
DRAMA 2 main include file.
#define DramaTHROW_S(status_, format_,...)
Throw a Drama exception with safe string formatting.
Definition exception.hh:110
Flags
The various flags used in GIT operations.
Definition gitarg.hh:83
@ Upper
Convert strings to upper case.
@ KeepErr
Keep error status on return
@ LastBit
Only consider Least significant bit of integer values when treating integers as logical.
@ Abbrev
Allow abbreviations
@ Lower
Convert strings to lower case.
@ KeepValErr
Keep error status on return for value errors, not for no value supplied errors
@ NoFlagSet
Value indicating no flags set.
constexpr Flags operator|(Flags f1, Flags f2)
Operator to allow Flags values to be or-ed.
Definition gitarg.hh:107
std::vector< ArgFlagVal > ArgFlagValVector
Declare a vector for ArgFlagVal items.
Definition gitarg.hh:1991
bool IsFlagSet(const Flags f1, const Flags f2)
Operator to allow determination of if a Flag enum value set.
Definition gitarg.hh:123
@ Default
System default type.
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
Type used to specify arg/flag relationships to ArgFlags class.
Definition gitarg.hh:1981
DRAMA 2 include file - Code common to DRAMA 2 features supporting threading.