WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
clockwerk::DataIOBase Class Reference

#include <DataIOBase.h>

Inheritance diagram for clockwerk::DataIOBase:

Public Member Functions

 DataIOBase ()
 Default constructor.
 ~DataIOBase ()
virtual int16 syncExternal ()
 Synchronize DataIO to some external source – Socket, shared memory, etc.
virtual int dataSize ()
 Get the size of the core data held by the object.
void allowWrite ()
 Functions to manipulate write permissions on DataIO object.
void blockWrite ()
bool writeAllowed ()
void mapTo (DataIOBase &data_source)
 Function to map DataIO object to new upstream data source.
void resetMap ()
DataIOBasedataSource ()
 Access the target to which the DataIO is mapped.
void * writePtr ()
 Function to write value to mapped location – root data or map.
void * read () const
 Function to read value from mapped location – root data or map.
uint8 dataType ()
 Function to return the type of data held by the DataIO.
virtual int16 getValueAsString (char *retval, size_t size)
 Return the value held by the DataIO object as a string.
virtual int16 setValueFromString (const char *value)
 Set the value held by the DataIO object from a string.
Public Member Functions inherited from clockwerk::GraphTreeObject
 GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
 Name-based constructor for GraphTreeObject which will have no children by default.
virtual ~GraphTreeObject ()
 Destructor.
GraphTreeObjectparent ()
 Functions to get object's parent/children.
GraphTreeObject ** children ()
GraphTreeObjectchildAtIndex (uint8 i) const
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer.
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference.
uint8 nChildren () const
 Getters for number of children and descendants.
uint16 nDescendants () const
uint8 capacity () const
const char * name () const
 Getter and setter for object name.
int16 name (const char *new_name)
uint8 rank ()
 Getter for the object rank.
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream.
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition.
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree.
virtual int16 str (char *output, size_t size) const
 Get object represented as string.
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string.

Protected Member Functions

template<typename T>
std::enable_if< std::is_integral< T >::value >::type _typeID (T var)
 Overloaded functions to identify type held by DataIO.
template<typename T>
std::enable_if< std::is_floating_point< T >::value >::type _typeID (T var)
template<typename T, long unsigned int N>
void _typeID (std::array< T, N > var)
template<uint32 R, uint32 C>
void _typeID (Matrix< R, C > var)
void _typeID (const GraphTreeObject &var)
void _typeID (const Time &var)
void _typeID (void *var)
void _typeID (int8 var)
void _typeID (int16 var)
void _typeID (int32 var)
void _typeID (int64 var)
void _typeID (uint8 var)
void _typeID (uint16 var)
void _typeID (uint32 var)
void _typeID (uint64 var)
void _typeID (char *var)
Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address.
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree.
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree.
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing.
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children.

Protected Attributes

DataIOBase_data
void * _data_ptr = nullptr
bool _writeAllowed
bool _root
dataio_types_e _type_id = UNDEFINED
Protected Attributes inherited from clockwerk::GraphTreeObject
GraphTreeObject_parent = nullptr
GraphTreeObject ** _children_ptr = nullptr
uint32 _max_num_children = 0
uint16 _num_descendants = 0
char _name [MAXIMUM_NAME_CHARS] = ""
 String name for object.
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself).
uint8 _rank = 0
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type.
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default.
uint32 _index = 0
 Index pointing to the next write location for the graph tree children.

Detailed Description

The Data IO Base class is designed to provide the basic interface of the Data IO class (see documentation in DataIO.hpp) without requiring templating. This implementation is to allow for generic access to Data IO objects without needing to know or declare the template in the resulting class.

Note
The DataIOBase object, while a child of GraphTreeObject, cannot have any children as no space is allocated for them. Therefore it must lie at the end of the tree.

Constructor & Destructor Documentation

◆ DataIOBase()

clockwerk::DataIOBase::DataIOBase ( )
inline

Default constructor.

◆ ~DataIOBase()

clockwerk::DataIOBase::~DataIOBase ( )
inline

Member Function Documentation

◆ _typeID() [1/16]

void clockwerk::DataIOBase::_typeID ( char * var)
protected

◆ _typeID() [2/16]

void clockwerk::DataIOBase::_typeID ( const GraphTreeObject & var)
protected

◆ _typeID() [3/16]

void clockwerk::DataIOBase::_typeID ( const Time & var)
protected

◆ _typeID() [4/16]

void clockwerk::DataIOBase::_typeID ( int16 var)
protected

◆ _typeID() [5/16]

void clockwerk::DataIOBase::_typeID ( int32 var)
protected

◆ _typeID() [6/16]

void clockwerk::DataIOBase::_typeID ( int64 var)
protected

◆ _typeID() [7/16]

void clockwerk::DataIOBase::_typeID ( int8 var)
protected

◆ _typeID() [8/16]

template<uint32 R, uint32 C>
void clockwerk::DataIOBase::_typeID ( Matrix< R, C > var)
protected

◆ _typeID() [9/16]

template<typename T, long unsigned int N>
void clockwerk::DataIOBase::_typeID ( std::array< T, N > var)
protected

◆ _typeID() [10/16]

template<typename T>
std::enable_if< std::is_floating_point< T >::value >::type clockwerk::DataIOBase::_typeID ( T var)
protected

◆ _typeID() [11/16]

template<typename T>
std::enable_if< std::is_floating_point< T >::value >::type clockwerk::DataIOBase::_typeID ( T var)
protected

Overloaded functions to identify type held by DataIO.

Parameters
varThe variable used to identify type

◆ _typeID() [12/16]

void clockwerk::DataIOBase::_typeID ( uint16 var)
protected

◆ _typeID() [13/16]

void clockwerk::DataIOBase::_typeID ( uint32 var)
protected

◆ _typeID() [14/16]

void clockwerk::DataIOBase::_typeID ( uint64 var)
protected

◆ _typeID() [15/16]

void clockwerk::DataIOBase::_typeID ( uint8 var)
protected

◆ _typeID() [16/16]

void clockwerk::DataIOBase::_typeID ( void * var)
protected

◆ allowWrite()

void clockwerk::DataIOBase::allowWrite ( )
inline

Functions to manipulate write permissions on DataIO object.

◆ blockWrite()

void clockwerk::DataIOBase::blockWrite ( )
inline

◆ dataSize()

◆ dataSource()

DataIOBase * clockwerk::DataIOBase::dataSource ( )
inline

Access the target to which the DataIO is mapped.

Returns
Pointer to data source

◆ dataType()

uint8 clockwerk::DataIOBase::dataType ( )
inline

Function to return the type of data held by the DataIO.

Returns
Type of data held by the DataIO according to dataio_types_e

◆ getValueAsString()

◆ mapTo()

void clockwerk::DataIOBase::mapTo ( DataIOBase & data_source)
inline

Function to map DataIO object to new upstream data source.

Parameters
data_sourceNew upstream data source to which object will be mapped
Note
Blocks writing via this DataIO object

◆ read()

void * clockwerk::DataIOBase::read ( ) const

Function to read value from mapped location – root data or map.

Returns
Void pointer to data held by object

◆ resetMap()

void clockwerk::DataIOBase::resetMap ( )
inline
Parameters
Functionto break data mapping and reset object to its own internal data
Note
Resets write permission to true

◆ setValueFromString()

◆ syncExternal()

virtual int16 clockwerk::DataIOBase::syncExternal ( )
inlinevirtual

Synchronize DataIO to some external source – Socket, shared memory, etc.

Returns
Error code corresponding to success/failure

Reimplemented in warptwin::DataIOShmemRelay, and warptwin::DataIOSocketRelay.

◆ writeAllowed()

bool clockwerk::DataIOBase::writeAllowed ( )
inline

◆ writePtr()

void * clockwerk::DataIOBase::writePtr ( )

Function to write value to mapped location – root data or map.

Returns
Void pointer to data held by object

Member Data Documentation

◆ _data

DataIOBase* clockwerk::DataIOBase::_data
protected

Pointer to data held by the object – by default, this will point internally to _default_data, but can be set to point to another object

◆ _data_ptr

void* clockwerk::DataIOBase::_data_ptr = nullptr
protected

Generic pointer to hold any data type – will be resolved to point to actual object in inherited class

◆ _root

bool clockwerk::DataIOBase::_root
protected

Variable to indicate whether variable in question is root data source or not

◆ _type_id

dataio_types_e clockwerk::DataIOBase::_type_id = UNDEFINED
protected

Variable to store the type of data that the DataIO object is holding. Valid types are documented in the enum and determined at runtime. Runtime determination is necessary because of derived types of GraphTreeObject

◆ _writeAllowed

bool clockwerk::DataIOBase::_writeAllowed
protected

Variable to indicate whether writing is allowed to this variable Set to false upon mapping by default


The documentation for this class was generated from the following files:
  • /Users/mickey/Documents/Projects/warptwin/warpos/clockwerk/src/architecture/DataIOBase.h
  • /Users/mickey/Documents/Projects/warptwin/warpos/clockwerk/src/architecture/DataIOBase.cpp