C++ Client  0.0.0.0
C++ wrapper for Corelink DLL
Corelink::Client Class Reference

#include <CorelinkClasses.h>

Static Public Member Functions

static void connect (const std::string &serverIP, int port)
 
static void connectPlugin ()
 
static void cleanup ()
 
static std::string getToken ()
 
static std::vector< std::string > listServerFunctions ()
 
static std::vector< std::string > describeServerFunction (const std::string &func)
 
static std::vector< std::string > listWorkspaces ()
 
static bool addWorkspace (const std::string &workspace)
 
static bool rmWorkspace (const std::string &workspace)
 
static rapidjson::Document genericComm (const rapidjson::Document &json)
 
static rapidjson::Document genericComm (const std::string &json)
 
static rapidjson::Document genericComm (const char *json, const int &len=0)
 
static std::vector< int > listStreams (const std::vector< std::string > &workspaces={}, const std::vector< std::string > &types={})
 
static StreamData streamInfo (const int &streamID)
 
static SendStream createSender (const std::string &workspace, const std::string &type, const std::string &meta, bool echo, bool alert, int protocol)
 
static RecvStream createReceiver (const std::string &workspace, const std::vector< std::string > &types, const std::string &meta, bool echo, bool alert, int protocol)
 
static bool subscribe (const STREAM_ID &receiverID, const STREAM_ID &senderID)
 
static bool unsubscribe (const STREAM_ID &receiverID, const STREAM_ID &senderID)
 
static bool rmStream (const STREAM_ID &streamID)
 

Detailed Description

Definition at line 159 of file CorelinkClasses.h.

Member Function Documentation

◆ addWorkspace()

bool Corelink::Client::addWorkspace ( const std::string &  workspace)
inlinestatic

Tries to add a workspace to the server.

Parameters
workspaceName of workspace to add to server.
Returns
Success of adding workspace.

Definition at line 147 of file CorelinkClient.h.

◆ cleanup()

void Corelink::Client::cleanup ( )
inlinestatic

Disconnects and cleans up client.

Definition at line 87 of file CorelinkClient.h.

◆ connect()

void Corelink::Client::connect ( const std::string &  serverIP,
int  port 
)
inlinestatic

Tries to connect to the server using the provided address.

Parameters
serverIPServer IP.
portServer port.
Exceptions
ERROR_CODE_STATEif client is already initialized.
ERROR_CODE_SOCKETif socket connection issues occur.
ERROR_CODE_COMMif credentials are incorrect.

Definition at line 75 of file CorelinkClient.h.

◆ connectPlugin()

void Corelink::Client::connectPlugin ( )
inlinestatic

Tries to connect to the server using environment variables provided by kubernetes.

Parameters
serverIPServer IP.
portServer port.
Exceptions
ERROR_CODE_STATEif client is already initialized.
ERROR_CODE_SOCKETif socket connection issues occur.
ERROR_CODE_COMMif credentials are incorrect.
ERROR_CODE_VALUEif environment variables not found.

Definition at line 81 of file CorelinkClient.h.

◆ createReceiver()

RecvStream Corelink::Client::createReceiver ( const std::string &  workspace,
const std::vector< std::string > &  types,
const std::string &  meta,
bool  echo,
bool  alert,
int  protocol 
)
inlinestatic

Attempts to create a receiver stream.

Parameters
workspaceworkspace being used for stream.
typestypes of information stream is listening to.
typeLenamount of types provided
metaMetadata attached to stream.
echoCan client listen to itself.
alertRecieve server updates for new streams.
protocolProtocol used by stream.

Definition at line 234 of file CorelinkClient.h.

◆ createSender()

SendStream Corelink::Client::createSender ( const std::string &  workspace,
const std::string &  type,
const std::string &  meta,
bool  echo,
bool  alert,
int  protocol 
)
inlinestatic

Attempts to create a sender stream.

Parameters
workspaceWorkspace being used for stream.
typeType of information stream is sending.
metaMetadata attached to stream.
echoCan client listen to itself.
alertRecieve server updates for new streams.
protocolProtocol used by stream.
Returns
Handler to access send functions.

Definition at line 227 of file CorelinkClient.h.

◆ describeServerFunction()

std::vector< std::string > Corelink::Client::describeServerFunction ( const std::string &  func)
inlinestatic

TODO: Create a wrapper class for the function data. Gets information about the function specified.

Parameters
funcFunction to get information on.
Returns
List of properties of the function.

Definition at line 131 of file CorelinkClient.h.

◆ genericComm() [1/3]

rapidjson::Document Corelink::Client::genericComm ( const rapidjson::Document &  json)
inlinestatic

Sends a generic message to the server. (Best approach to use)

Parameters
jsonRapidjson object to send.

Definition at line 155 of file CorelinkClient.h.

◆ genericComm() [2/3]

rapidjson::Document Corelink::Client::genericComm ( const std::string &  json)
inlinestatic

Sends a generic message to the server.

Parameters
jsonJson string to send to the server.

Definition at line 176 of file CorelinkClient.h.

◆ genericComm() [3/3]

rapidjson::Document Corelink::Client::genericComm ( const char *  json,
const int &  len = 0 
)
inlinestatic

Sends a generic message to the server.

Parameters
jsonJson string to send to the server.
lenLength of message. Default to 0 if string ends with a null terminator.

Definition at line 189 of file CorelinkClient.h.

◆ getToken()

std::string Corelink::Client::getToken ( )
inlinestatic

Gets the current token string. (No actual use on client)

Returns
Current token value.

Gets the token assigned to the current session.

Returns
Token string.

Definition at line 104 of file CorelinkClient.h.

◆ listServerFunctions()

std::vector< std::string > Corelink::Client::listServerFunctions ( )
inlinestatic

Gets list of functions available on the server.

Returns
List of functions on server.

Definition at line 124 of file CorelinkClient.h.

◆ listStreams()

std::vector< int > Corelink::Client::listStreams ( const std::vector< std::string > &  workspaces = {},
const std::vector< std::string > &  types = {} 
)
inlinestatic

Gets the list of sender streams available on the server.

Parameters
workspacesList of workspaces to include in data. Leave empty for all.
typesList of types to include in data. Leave empty for all.
Returns
List of sender streamIDs.

Definition at line 202 of file CorelinkClient.h.

◆ listWorkspaces()

std::vector< std::string > Corelink::Client::listWorkspaces ( )
inlinestatic

Gets list of workspaces available on the server.

Returns
List of workspaces on server.

Definition at line 140 of file CorelinkClient.h.

◆ rmStream()

bool Corelink::Client::rmStream ( const STREAM_ID &  streamID)
inlinestatic

Destroys a receiver associated with this session and cleans it from the server.

Parameters
streamIDID of stream to remove from both server and client.

Definition at line 252 of file CorelinkClient.h.

◆ rmWorkspace()

bool Corelink::Client::rmWorkspace ( const std::string &  workspace)
inlinestatic

Tries to remove a workspace from the server.

Parameters
workspaceName of workspace to remove from server.
Returns
Success of removing workspace.

Definition at line 151 of file CorelinkClient.h.

◆ streamInfo()

StreamData Corelink::Client::streamInfo ( const int &  streamID)
inlinestatic

Gets information on a specific stream in the server.

Parameters
streamIDID to obtain information about.
Returns
Streamdata containing server side information on the stream (does not include sources, reference and some other members).

Definition at line 220 of file CorelinkClient.h.

◆ subscribe()

bool Corelink::Client::subscribe ( const STREAM_ID &  receiverID,
const STREAM_ID &  senderID 
)
inlinestatic

Subcribes a reciever to a new sender.

Parameters
receiverReciever stream to listen to new sender.
senderSender stream to listen to.
Returns
Success or failure upon subscribing to stream.

Definition at line 242 of file CorelinkClient.h.

◆ unsubscribe()

bool Corelink::Client::unsubscribe ( const STREAM_ID &  receiverID,
const STREAM_ID &  senderID 
)
inlinestatic

Unsubcribes a reciever from a sender.

Parameters
receiverReciever stream to stop listening to sender.
senderSender stream to stop listening to.
Returns
Success or failure upon unsubscribing from stream.

Definition at line 247 of file CorelinkClient.h.


The documentation for this class was generated from the following files: