34 #ifndef DRAIN_VARIABLE_BASE
35 #define DRAIN_VARIABLE_BASE
38 #include "CastableIterator.h"
40 #include "VariableT.h"
76 if (caster.
ptr ==
nullptr){
79 else if (data.empty()){
83 return (caster.
ptr != (
void *) &data[0]);
133 template <
class T,
class ...TT>
135 void set(
const T &arg,
const TT& ...args){
160 void setType(
const std::type_info & t);
229 std::vector<char> data;
231 mutable CastableIterator dataBegin;
232 mutable CastableIterator dataEnd;
237 void updateIterators();
277 this->assignCastable(value);
285 if (value.isLinking() && this->isLinkable()){
289 this->assignCastable(value);
302 void init(
const std::type_info &t =
typeid(
void)) {
310 void init(
const T & value) {
321 void init(
const T & value,
const std::type_info &t) {
322 std::cerr << __FILE__ <<
':' << __LINE__ <<
':' << __FUNCTION__ <<
" " << value <<
'[' << t.name() <<
']' << std::endl;
324 std::cerr << __LINE__ <<
" reset: " << std::endl;
326 std::cerr << __LINE__ <<
" setType: " << std::endl;
328 std::cerr << __LINE__ <<
" assign: " << std::endl;
330 std::cerr << __LINE__ <<
" ...done " << std::endl;
338 std::cerr << __FILE__ <<
':' << __LINE__ << __FUNCTION__ <<
" " << v << std::endl;
342 this->assignCastable(v);
348 std::cerr << __FILE__ <<
':' << __LINE__ << __FUNCTION__ <<
" " << c << std::endl;
352 this->assignCastable(c);
360 this->assignString(s);
366 void init(std::initializer_list<T> l,
const std::type_info &t =
typeid(
void)) {
370 this->assignContainer(l,
true);
373 template <
class ...TT>
374 void init(
const TT& ...args){
377 this->append(args...);
Definition: CastableIterator.h:57
Definition: Castable.h:76
size_t elementCount
Pointer to the data variable.
Definition: Castable.h:1233
char outputSeparator
Element separator usein in writing and reading character strings (streams).
Definition: Castable.h:1239
char inputSeparator
Element separator usein in reading a char sequence to an (numeric) array.
Definition: Castable.h:1236
void clear()
Clears strings, or for scalars and arrays, sets all the values to zero. Does not change type.
Definition: Castable.cpp:81
void setType()
Sets the storage type. If a target value is available, use setPtr() directly.
Definition: Castable.h:873
void append(const T &x)
Appends the string or appends the array by one element.
Definition: Castable.h:419
void * ptr
Future member: enables setting Caster type.
Definition: Caster.h:247
Base class for variables: Variable, Reference and FlexibleVariable.
Definition: VariableBase.h:56
virtual bool isLinking() const
Tells if the pointer points to an external variable.
Definition: VariableBase.h:75
const CastableIterator & end() const
Like with std::iterator.
Definition: VariableBase.h:190
virtual bool setSize(size_t elementCount)
Extends the array to include elementCount elements of current type.
Definition: VariableBase.h:198
virtual bool isVariable() const
Tells if internal memory exists.
Definition: VariableBase.h:105
VariableBase & operator<<(const T &x)
Extends the array by one element.
Definition: VariableBase.h:170
virtual bool isLinkable() const
Tells if the internal pointer can point to an external variable.
Definition: VariableBase.h:115
const CastableIterator & begin() const
Like with std::iterator.
Definition: VariableBase.h:183
Definition: VariableBase.h:250
void init(const Castable &c)
Copies type, data and separator char.
Definition: VariableBase.h:347
void init(const char *s)
Copies type, data and separator char.
Definition: VariableBase.h:357
void init(std::initializer_list< T > l, const std::type_info &t=typeid(void))
Initialisation with type of the first element or explicit type argument.
Definition: VariableBase.h:366
void init(const std::type_info &t=typeid(void))
Default constructor generates an empty array.
Definition: VariableBase.h:302
void init(const VariableBase &v)
Copies type, data and separator char.
Definition: VariableBase.h:337
void init(const VariableT< T > &value)
Copy constructor handler.
Definition: VariableBase.h:273
VariableT is a final class applied through typedefs Variable, Reference and FlexibleVariable.
Definition: VariableT.h:87
Definition: DataSelector.cpp:1277