TINC
Toolkit for Interactive Computation
|
The TincProtocol class. More...
#include <TincProtocol.hpp>
Public Types | |
enum | { CREATE_DATA_SLICE = 0x01 } |
enum | Status { STATUS_UNKNOWN = 0x00 , STATUS_AVAILABLE = 0x01 , STATUS_BUSY = 0x02 } |
Public Member Functions | |
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 bool | barrier (uint32_t group=0, float timeoutsec=0.0)=0 |
activate a network barrier More... | |
void | setVerbose (bool v) |
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 | |
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) |
virtual bool | sendTincMessage (void *msg, al::Socket *dst=nullptr, al::ValueSource *src=nullptr) |
sendTincMessage More... | |
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 TincProtocol class.
This class serves as the basis for TincClient and TincServer classes and provides refence storage and network synchronization
This class registers objects (ParameterSpaceDimension, ParameterSpace, DataPool, etc.), but takes no ownership of them. They are not deallocated when the TincProtocol object is destroyed and the user must guarantee that they are valid for the whole duration of the TincProtocol object's life, or the must be removed from TincProtocol before being destroyed.
When an object is not registered, but created internally, e.g. from a network command, the TincProtocol will destroy the object when it itself is destroyed. So it is the user's responsibility not to destroy the TincProtocol object while still requiring the objects that were provided by it. It might also be the case that the object is destroyed from a network request, so for these types of objects it is always good to request them directly from TincProtocol every time they are used, e.g. using getDimension() and checking for nullptr, instead of storing the pointer.
Definition at line 71 of file TincProtocol.hpp.
anonymous enum |
Enumerator | |
---|---|
CREATE_DATA_SLICE |
Definition at line 74 of file TincProtocol.hpp.
Enumerator | |
---|---|
STATUS_UNKNOWN | |
STATUS_AVAILABLE | |
STATUS_BUSY |
Definition at line 76 of file TincProtocol.hpp.
|
pure virtual |
activate a network barrier
group | group to make the barrier for. 0 is all. |
timeoutsec | timeout in secods |
Group support not implemented yet.
Implemented in tinc::TincServer, and tinc::TincClient.
|
protected |
|
protected |
|
inline |
Definition at line 206 of file TincProtocol.hpp.
DataPool* tinc::TincProtocol::getDataPool | ( | std::string | name | ) |
ParameterSpaceDimension* tinc::TincProtocol::getDimension | ( | std::string | name, |
std::string | group = "" |
||
) |
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.
DiskBufferAbstract* tinc::TincProtocol::getDiskBuffer | ( | std::string | name | ) |
al::ParameterMeta* tinc::TincProtocol::getParameter | ( | std::string | name, |
std::string | group = "" |
||
) |
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.
ParameterSpace* tinc::TincProtocol::getParameterSpace | ( | std::string | name | ) |
|
inline |
Definition at line 255 of file TincProtocol.hpp.
Status tinc::TincProtocol::getStatus | ( | ) |
|
protected |
|
protected |
|
virtual |
Reimplemented in tinc::TincServer.
|
virtual |
Reimplemented in tinc::TincServer.
TincProtocol& tinc::TincProtocol::operator<< | ( | al::ParameterMeta & | p | ) |
TincProtocol& tinc::TincProtocol::operator<< | ( | DataPool & | dp | ) |
TincProtocol& tinc::TincProtocol::operator<< | ( | DiskBufferAbstract & | db | ) |
TincProtocol& tinc::TincProtocol::operator<< | ( | ParameterSpace & | p | ) |
TincProtocol& tinc::TincProtocol::operator<< | ( | ParameterSpaceDimension & | psd | ) |
TincProtocol& tinc::TincProtocol::operator<< | ( | Processor & | p | ) |
|
inline |
Definition at line 213 of file TincProtocol.hpp.
void tinc::TincProtocol::print | ( | std::ostream & | stream = std::cout | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool tinc::TincProtocol::registerDataPool | ( | DataPool & | dp, |
al::Socket * | src = nullptr |
||
) |
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.
bool tinc::TincProtocol::registerDiskBuffer | ( | DiskBufferAbstract & | db, |
al::Socket * | src = nullptr |
||
) |
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.
bool tinc::TincProtocol::registerParameter | ( | al::ParameterMeta & | param, |
al::Socket * | src = nullptr |
||
) |
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.
bool tinc::TincProtocol::registerParameterSpace | ( | ParameterSpace & | ps, |
al::Socket * | src = nullptr |
||
) |
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.
bool tinc::TincProtocol::registerParameterSpaceDimension | ( | ParameterSpaceDimension & | psd, |
al::Socket * | src = nullptr |
||
) |
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.
bool tinc::TincProtocol::registerProcessor | ( | Processor & | processor, |
al::Socket * | src = nullptr |
||
) |
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.
void tinc::TincProtocol::removeDataPool | ( | std::string | name, |
al::Socket * | src = nullptr |
||
) |
void tinc::TincProtocol::removeDiskbuffer | ( | std::string | name, |
al::Socket * | src = nullptr |
||
) |
void tinc::TincProtocol::removeParameter | ( | std::string | name, |
std::string | group = "" , |
||
bool | invoked = false , |
||
al::Socket * | src = nullptr |
||
) |
void tinc::TincProtocol::removeParameterSpace | ( | std::string | name, |
al::Socket * | src = nullptr |
||
) |
void tinc::TincProtocol::removeProcessor | ( | std::string | name, |
al::Socket * | src = nullptr |
||
) |
void tinc::TincProtocol::requestDataPools | ( | al::Socket * | dst | ) |
void tinc::TincProtocol::requestDiskBuffers | ( | al::Socket * | dst | ) |
void tinc::TincProtocol::requestParameters | ( | al::Socket * | dst | ) |
void tinc::TincProtocol::requestParameterSpaces | ( | al::Socket * | dst | ) |
void tinc::TincProtocol::requestProcessors | ( | al::Socket * | dst | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inlineprotectedvirtual |
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 in tinc::TincServer, and tinc::TincClient.
Definition at line 394 of file TincProtocol.hpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
setRootMapEntry
serverPath | |
clientPath | |
host | This function is only generally useful if set for the server. |
Definition at line 248 of file TincProtocol.hpp.
|
inline |
Definition at line 232 of file TincProtocol.hpp.
|
protected |
Definition at line 414 of file TincProtocol.hpp.
|
protected |
Definition at line 417 of file TincProtocol.hpp.
|
protected |
Definition at line 416 of file TincProtocol.hpp.
|
protected |
Definition at line 422 of file TincProtocol.hpp.
|
protected |
Definition at line 405 of file TincProtocol.hpp.
|
protected |
Definition at line 404 of file TincProtocol.hpp.
|
protected |
Definition at line 410 of file TincProtocol.hpp.
|
protected |
Definition at line 411 of file TincProtocol.hpp.
|
protected |
Definition at line 408 of file TincProtocol.hpp.
|
protected |
Definition at line 409 of file TincProtocol.hpp.
|
protected |
Definition at line 401 of file TincProtocol.hpp.
|
protected |
Definition at line 402 of file TincProtocol.hpp.
|
protected |
Definition at line 426 of file TincProtocol.hpp.
|
protected |
Definition at line 425 of file TincProtocol.hpp.
|
protected |
Definition at line 403 of file TincProtocol.hpp.
|
protected |
Definition at line 421 of file TincProtocol.hpp.
|
protected |
Definition at line 428 of file TincProtocol.hpp.