![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
Relay DataIO data over a socket. More...
#include <DataIOSocketRelay.h>

Public Member Functions | |
| DataIOSocketRelay (DataIOBase &map_target, const char *ip, int port, bool is_read=true) | |
| Only constructor for this object – requires mapping target, socket info. | |
| ~DataIOSocketRelay () | |
| int16 | syncExternal () override |
| Synchronize DataIO values to socket – both write and read. | |
| Public Member Functions inherited from clockwerk::DataIOBase | |
| DataIOBase () | |
| Default constructor. | |
| ~DataIOBase () | |
| 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 () |
| DataIOBase * | dataSource () |
| 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. | |
| GraphTreeObject * | parent () |
| Functions to get object's parent/children. | |
| GraphTreeObject ** | children () |
| GraphTreeObject * | childAtIndex (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. | |
| GraphTreeObject * | getRootDataPointer () |
| 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 | |
| int16 | _syncWriteSocket () |
| Write DataIO information to socket. | |
| int16 | _syncReadSocket () |
| Read DataIO information from socket. | |
| Protected Member Functions inherited from clockwerk::DataIOBase | |
| 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 | |
| std::string | _ip |
| IP address. | |
| int | _port = 0 |
| Port we read info from. | |
| int | _sock_fd = -1 |
| File descriptor for write socket. | |
| sockaddr_in | _addr |
| Socket struct to set IP, etc. | |
| bool | _is_read |
| Flag indicating whether socket is read or write. | |
| DataIOBase & | _tgt |
| Reference information on type and size. | |
| char | _buffer [DATASOCK_IO_BUFFER_SIZE] |
| Buffer stuff for io on string conversion. | |
| Protected Attributes inherited from clockwerk::DataIOBase | |
| 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. | |
Relay DataIO data over a socket.
This class establishes a relay between a DataIO object and some object on the other side of a socket, which could be a dataio or could be some other means of interpreting data. It uses the built-in DataIO to string conversion to convert data to a string, which it sends over a socket.
This relay is designed to map to other DataIO objects and mirror exactly their behavior – that is, if an object is mapped to this object and it is read, it attempts to pull the latest data from the socket and outputs it. When written, it attempts to write the latest to the socket.
This class assumes Linux sockets.
| warptwin::DataIOSocketRelay::DataIOSocketRelay | ( | DataIOBase & | map_target, |
| const char * | ip, | ||
| int | port, | ||
| bool | is_read = true ) |
Only constructor for this object – requires mapping target, socket info.
| map_target | DataIOBase object the socket is mapped to |
| ip | The IP address to connect on |
| port | The port to connect on |
| is_read | true - this target reads from socket and is upstream of map_target false - this target writes to socket and is downstream of map_target |
|
inline |
|
protected |
Read DataIO information from socket.
|
protected |
Write DataIO information to socket.
|
overridevirtual |
Synchronize DataIO values to socket – both write and read.
Reimplemented from clockwerk::DataIOBase.
|
protected |
Socket struct to set IP, etc.
|
protected |
Buffer stuff for io on string conversion.
|
protected |
IP address.
|
protected |
Flag indicating whether socket is read or write.
|
protected |
Port we read info from.
|
protected |
File descriptor for write socket.
|
protected |
Reference information on type and size.