TINC
Toolkit for Interactive Computation
|
The TincClient class. More...
#include <TincClient.hpp>
Public Types | |
enum | { CREATE_DATA_SLICE = 0x01 } |
enum | Status { STATUS_UNKNOWN = 0x00 , STATUS_AVAILABLE = 0x01 , STATUS_BUSY = 0x02 } |
Public Member Functions | |
TincClient () | |
bool | start (uint16_t serverPort=34450, const char *serverAddr="localhost") override |
start the TINC client More... | |
void | stop () override |
stop the connection More... | |
bool | sendTincMessage (void *msg, al::Socket *dst=nullptr, al::ValueSource *src=nullptr) override |
sendTincMessage More... | |
void | requestParameters () |
void | requestProcessors () |
void | requestDiskBuffers () |
void | requestDataPools () |
void | requestParameterSpaces () |
void | synchronize () |
void | sendMetadata () |
bool | barrier (uint32_t group=0, float timeoutsec=0.0) override |
Wait for lock, then wait for unlock. More... | |
Status | serverStatus () |
Return latest status reported by server. More... | |
bool | waitForServer (float timeoutsec=0.0) |
return only when server status is STATUS_AVAILABLE More... | |
uint64_t | pingServer () |
send a ping message to the tinc server More... | |
bool | waitForPong (uint64_t pingCode, float timeoutsec=30, al::Socket *src=nullptr) |
waitForPong More... | |
std::string | getWorkingPath () |
void | setVerbose (bool verbose=true) |
bool | verbose () |
bool | registerParameter (al::ParameterMeta ¶m, al::Socket *src=nullptr) |
register a parameter with this Tinc node More... | |
bool | registerParameterSpaceDimension (ParameterSpaceDimension &psd, al::Socket *src=nullptr) |
register a parameter space dimencion with this Tinc node More... | |
bool | registerParameterSpace (ParameterSpace &ps, al::Socket *src=nullptr) |
register a parameter space with this Tinc node More... | |
bool | registerProcessor (Processor &processor, al::Socket *src=nullptr) |
register a processor with this Tinc node More... | |
bool | registerDiskBuffer (DiskBufferAbstract &db, al::Socket *src=nullptr) |
register a disk buffer with this Tinc node More... | |
bool | registerDataPool (DataPool &dp, al::Socket *src=nullptr) |
register a data pool with this Tinc node More... | |
TincProtocol & | operator<< (al::ParameterMeta &p) |
TincProtocol & | operator<< (ParameterSpace &p) |
TincProtocol & | operator<< (ParameterSpaceDimension &psd) |
TincProtocol & | operator<< (Processor &p) |
TincProtocol & | operator<< (DiskBufferAbstract &db) |
TincProtocol & | operator<< (DataPool &dp) |
void | requestParameters (al::Socket *dst) |
void | requestParameterSpaces (al::Socket *dst) |
void | requestProcessors (al::Socket *dst) |
void | requestDiskBuffers (al::Socket *dst) |
void | requestDataPools (al::Socket *dst) |
void | removeParameter (std::string name, std::string group="", bool invoked=false, al::Socket *src=nullptr) |
void | removeParameterSpace (std::string name, al::Socket *src=nullptr) |
void | removeProcessor (std::string name, al::Socket *src=nullptr) |
void | removeDiskbuffer (std::string name, al::Socket *src=nullptr) |
void | removeDataPool (std::string name, al::Socket *src=nullptr) |
ParameterSpaceDimension * | getDimension (std::string name, std::string group="") |
get a registered dimension in this Tinc node More... | |
al::ParameterMeta * | getParameter (std::string name, std::string group="") |
get a parameter from a registered dimension in this Tinc node More... | |
std::vector< ParameterSpaceDimension * > | dimensions () |
ParameterSpace * | getParameterSpace (std::string name) |
std::vector< ParameterSpace * > | parameterSpaces () |
DiskBufferAbstract * | getDiskBuffer (std::string name) |
DataPool * | getDataPool (std::string name) |
virtual void | markBusy () |
virtual void | markAvailable () |
Status | getStatus () |
void | setRootMapEntry (std::string serverPath, std::string clientPath, std::string host="") |
setRootMapEntry More... | |
const std::map< std::string, std::vector< std::pair< std::string, std::string > > > | getRootPathMap () |
void | print (std::ostream &stream=std::cout) |
Protected Member Functions | |
bool | processIncomingMessage (al::Message &message, al::Socket *src) override |
void | processBarrierRequest (al::Socket *src, uint64_t barrierConsecutive) |
void | processBarrierUnlock (al::Socket *src, uint64_t barrierConsecutive) |
void | processStatusMessage (void *message) |
void | processWorkingPathMessage (void *message) |
void | connectParameterCallbacks (al::ParameterMeta ¶m) |
void | connectDimensionCallbacks (ParameterSpaceDimension &psd) |
void | readRequestMessage (int objectType, std::string objectId, al::Socket *src) |
void | processRequestParameters (al::Socket *dst) |
void | processRequestParameterSpaces (al::Socket *dst) |
void | processRequestProcessors (al::Socket *dst) |
void | processRequestDiskBuffers (al::Socket *dst) |
void | processRequestDataPools (al::Socket *dst) |
bool | readRegisterMessage (int objectType, void *any, al::Socket *src, bool forward=false) |
bool | processRegisterParameter (void *any, al::Socket *src, bool forward=false) |
bool | processRegisterParameterSpace (void *any, al::Socket *src, bool forward=false) |
bool | processRegisterProcessor (void *any, al::Socket *src, bool forward=false) |
bool | processRegisterDiskBuffer (void *any, al::Socket *src, bool forward=false) |
bool | processRegisterDataPool (void *any, al::Socket *src, bool forward=false) |
bool | processConfigureParameterMessage (void *conf, ParameterSpaceDimension *dim, al::Socket *src, bool forward=false) |
void | sendRegisterMessage (ParameterSpaceDimension *dim, al::Socket *dst, al::Socket *src=nullptr) |
void | sendRegisterMessage (ParameterSpace *ps, al::Socket *dst, al::Socket *src=nullptr) |
void | sendRegisterMessage (Processor *p, al::Socket *dst, al::Socket *src=nullptr) |
void | sendRegisterMessage (DiskBufferAbstract *p, al::Socket *dst, al::Socket *src=nullptr) |
void | sendRegisterMessage (DataPool *p, al::Socket *dst, al::Socket *src=nullptr) |
bool | readConfigureMessage (int objectType, void *any, al::Socket *src, bool forward=false) |
bool | processConfigureParameter (void *any, al::Socket *src, bool forward=false) |
bool | processConfigureParameterSpace (void *any, al::Socket *src, bool forward=false) |
bool | processConfigureProcessor (void *any, al::Socket *src, bool forward=false) |
bool | processConfigureDiskBuffer (void *any, al::Socket *src, bool forward=false) |
bool | processConfigureDataPool (void *any, al::Socket *src, bool forward=false) |
void | sendConfigureMessage (ParameterSpaceDimension *dim, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureMessage (ParameterSpace *ps, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureMessage (Processor *p, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureMessage (DataPool *p, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureMessage (DiskBufferAbstract *p, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureParameterSpaceAddDimension (ParameterSpace *ps, ParameterSpaceDimension *dim, al::Socket *dst, al::Socket *src=nullptr) |
void | sendConfigureParameterSpaceRemoveDimension (ParameterSpace *ps, ParameterSpaceDimension *dim, al::Socket *dst, al::Socket *src=nullptr) |
bool | readRemoveMessage (int objectType, void *any, al::Socket *src) |
bool | processRemoveParameter (void *any, al::Socket *src) |
void | sendRemoveMessage (ParameterSpaceDimension *dim, al::Socket *dst, al::Socket *src=nullptr) |
void | sendValueMessage (float value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (bool value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (int32_t value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (uint64_t value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (std::string value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (al::Vec3f value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (al::Vec4f value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (al::Color value, std::string fullAddress, al::ValueSource *src=nullptr) |
void | sendValueMessage (al::Pose value, std::string fullAddress, al::ValueSource *src=nullptr) |
bool | readPingMessage (int objectType, void *any, al::Socket *src) |
bool | readCommandMessage (int objectType, void *any, al::Socket *src) |
bool | sendCommandErrorMessage (uint64_t commandId, std::string objectId, std::string errorMessage, al::Socket *src) |
bool | processCommandParameter (void *any, al::Socket *src) |
bool | processCommandParameterSpace (void *any, al::Socket *src) |
bool | processCommandDiskBuffer (void *any, al::Socket *src) |
bool | processCommandDataPool (void *any, al::Socket *src) |
bool | sendProtobufMessage (void *message, al::Socket *dst) |
std::string | mapFromRemotePath (std::string path, al::Socket *src) |
std::string | mapToRemotePath (std::string path, al::Socket *src) |
Protected Attributes | |
std::vector< ParameterSpaceDimension * > | mParameterSpaceDimensions |
std::vector< ParameterSpace * > | mParameterSpaces |
std::vector< Processor * > | mProcessors |
std::vector< DiskBufferAbstract * > | mDiskBuffers |
std::vector< DataPool * > | mDataPools |
std::vector< std::shared_ptr< ParameterSpaceDimension > > | mLocalPSDs |
std::vector< std::shared_ptr< ParameterSpace > > | mLocalPSs |
std::vector< std::shared_ptr< DiskBufferAbstract > > | mLocalDBs |
std::vector< std::shared_ptr< DataPool > > | mLocalDPs |
int | barrierWaitGranularTimeMs = 20 |
std::mutex | mBusyCountLock |
uint32_t | mBusyCount = 0 |
std::map< std::string, std::vector< std::pair< std::string, std::string > > > | mRootPathMap |
std::map< al::Socket *, std::string > | mClientHostnames |
std::map< al::Socket *, std::vector< uint64_t > > | mPongsReceived |
std::mutex | mPongLock |
bool | mVerbose {false} |
The TincClient class.
A TincClient connects to a TincServer to share TINC objects.
Definition at line 55 of file TincClient.hpp.
|
inherited |
Enumerator | |
---|---|
CREATE_DATA_SLICE |
Definition at line 74 of file TincProtocol.hpp.
|
inherited |
Enumerator | |
---|---|
STATUS_UNKNOWN | |
STATUS_AVAILABLE | |
STATUS_BUSY |
Definition at line 76 of file TincProtocol.hpp.
tinc::TincClient::TincClient | ( | ) |
|
overridevirtual |
Wait for lock, then wait for unlock.
group | group to make the barrier for. 0 is all. |
timeoutsec | timeout time im seconds |
Implements tinc::TincProtocol.
|
protectedinherited |
|
protectedinherited |
|
inlineinherited |
Definition at line 206 of file TincProtocol.hpp.
|
inherited |
|
inherited |
get a registered dimension in this Tinc node
name | name (id) of the dimension |
group |
If group is empty, the first matching name in any group is returned
It is recommended that you always call this function instead of storing the pointer, as the dimension might be free in some cases, for example if it was created by a network REGISTER command and then destroyed through a network REMOVE command.
|
inherited |
|
inherited |
get a parameter from a registered dimension in this Tinc node
name | name (id) of the parameter |
group |
If group is empty, the first matching name in any group is returned
It is recommended that you always call this function instead of storing the pointer, as the dimension might be free in some cases, for example if it was created by a network REGISTER command and then destroyed through a network REMOVE command.
|
inherited |
|
inlineinherited |
Definition at line 255 of file TincProtocol.hpp.
|
inherited |
std::string tinc::TincClient::getWorkingPath | ( | ) |
|
protectedinherited |
|
protectedinherited |
|
virtualinherited |
Reimplemented in tinc::TincServer.
|
virtualinherited |
Reimplemented in tinc::TincServer.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inlineinherited |
Definition at line 213 of file TincProtocol.hpp.
uint64_t tinc::TincClient::pingServer | ( | ) |
send a ping message to the tinc server
The server will return a pong message with the number recieved.
|
inherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
overrideprotected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
register a data pool with this Tinc node
dp | the data pool to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination.
|
inherited |
register a disk buffer with this Tinc node
db | the disk buffer to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination.
|
inherited |
register a parameter with this Tinc node
param | the parameter to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination. This is equivalent to registerParameterSpaceDimension() and will internally wrap the parameter in a dimension. TincClient does not take ownership of the param object, and does not free it when destroyed.
|
inherited |
register a parameter space with this Tinc node
psd | the parameter space dimension to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination.
|
inherited |
register a parameter space dimencion with this Tinc node
ps | the parameter space to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination. TincClient does not take ownership of the psd object, and does not free it when destroyed.
|
inherited |
register a processor with this Tinc node
processor | the processor to register |
src | the source socket of the request |
If src is not nullptr, network notification of registration will be blocked for that destination.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inline |
|
inherited |
|
inline |
|
inherited |
|
inline |
|
inherited |
|
inline |
|
inherited |
|
inline |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
void tinc::TincClient::sendMetadata | ( | ) |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
overridevirtual |
sendTincMessage
msg | The encoded message to send |
dst | the socket to send meessage to. If nullptr send to all |
src | information of source. If passed block sending to this location. |
Reimplemented from tinc::TincProtocol.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Status tinc::TincClient::serverStatus | ( | ) |
Return latest status reported by server.
|
inlineinherited |
setRootMapEntry
serverPath | |
clientPath | |
host | This function is only generally useful if set for the server. |
Definition at line 248 of file TincProtocol.hpp.
void tinc::TincClient::setVerbose | ( | bool | verbose = true | ) |
|
override |
start the TINC client
serverPort | |
serverAddr |
|
override |
stop the connection
Closes listening thread and cleans up connections.
Any state received from the server remains on the client, but any actions will not affect the server and will be overriden if reconnected.
|
inline |
|
inline |
Definition at line 135 of file TincClient.hpp.
bool tinc::TincClient::waitForPong | ( | uint64_t | pingCode, |
float | timeoutsec = 30 , |
||
al::Socket * | src = nullptr |
||
) |
waitForPong
pingCode | |
timeoutsec | |
src | Source of pong message (use nullptr for server) |
This function clears mPongsReceived for src if pong was received before time out.
bool tinc::TincClient::waitForServer | ( | float | timeoutsec = 0.0 | ) |
return only when server status is STATUS_AVAILABLE
timeoutsec |
|
protectedinherited |
Definition at line 414 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 417 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 416 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 422 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 405 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 404 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 410 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 411 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 408 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 409 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 401 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 402 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 426 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 425 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 403 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 421 of file TincProtocol.hpp.
|
protectedinherited |
Definition at line 428 of file TincProtocol.hpp.