CommunicationParameters Class Reference

Holds the communication parameter to configure the connection between senders and receiver. More...

Types

enum class  COMM_TYPE
 Lists the different types of communications available for Fusion module. More...
 

Functions

 CommunicationParameters ()
 Default constructor. All the parameters are set to their default and optimized values. More...
 
void setForSharedMemory ()
 Setup the communication to used shared memory for intra process workflow, senders and receiver in different threads. More...
 
void setForLocalNetwork (int port)
 Setup local Network connection information, sender side, only the port is required. More...
 
void setForLocalNetwork (std::string ip_address, int port)
 Setup local Network connection information, receiver side, need the edge device IP and the port. More...
 
int getPort () const
 This function returns the comm port used for streaming the data. More...
 
std::string getIpAddress () const
 This function returns the IP address of the sender. More...
 
COMM_TYPE getType () const
 This function returns the type of the used communication. More...
 
bool save (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Loads a set of parameters from the values contained in a previously saved file. More...
 
bool encode (String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string. More...
 
bool decode (const String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Fill the structure from the serialized json object contained in the input string. More...
 
bool operator== (const CommunicationParameters &param1) const
 Comparison operator ==. More...
 
bool operator!= (const CommunicationParameters &param1) const
 Comparison operator !=. More...
 

Detailed Description

Holds the communication parameter to configure the connection between senders and receiver.

Enumeration

◆ COMM_TYPE

enum COMM_TYPE
strong

Lists the different types of communications available for Fusion module.

Enumerator
LOCAL_NETWORK 

The sender and receiver are on the same local network and communicate by RTP.
The communication can be affected by the local network load.

INTRA_PROCESS 

Both sender and receiver are declared by the same process and can be in different threads.
This type of communication is optimized.

Constructor and Destructor

◆ CommunicationParameters()

Default constructor. All the parameters are set to their default and optimized values.

Functions

◆ setForSharedMemory()

void setForSharedMemory ( )

Setup the communication to used shared memory for intra process workflow, senders and receiver in different threads.

◆ setForLocalNetwork() [1/2]

void setForLocalNetwork ( int  port)

Setup local Network connection information, sender side, only the port is required.

◆ setForLocalNetwork() [2/2]

void setForLocalNetwork ( std::string  ip_address,
int  port 
)

Setup local Network connection information, receiver side, need the edge device IP and the port.

◆ getPort()

int getPort ( ) const
inline

This function returns the comm port used for streaming the data.

Returns
the port

◆ getIpAddress()

std::string getIpAddress ( ) const
inline

This function returns the IP address of the sender.

Returns
the IP address

◆ getType()

COMM_TYPE getType ( ) const
inline

This function returns the type of the used communication.

Returns
the COMM_TYPE of the communication used

◆ save()

bool save ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if the file was successfully saved, otherwise false.
Warning
For security reasons, the file must not already exist.
In case a file already exists, the method will return false and existing file will not be updated.

◆ load()

bool load ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not detected).
Returns
True if the file was successfully loaded, otherwise false.

◆ encode()

bool encode ( String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string.

Parameters
serialized_contentoutput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if file was successfully saved, otherwise false.

◆ decode()

bool decode ( const String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Fill the structure from the serialized json object contained in the input string.

Parameters
serialized_contentinput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if the decoding was successful, otherwise false.

◆ operator==()

bool operator== ( const CommunicationParameters param1) const

Comparison operator ==.

Parameters
CommunicationParametersto compare
Returns
true if the two struct are identical

◆ operator!=()

bool operator!= ( const CommunicationParameters param1) const

Comparison operator !=.

Parameters
CommunicationParametersto compare
Returns
true if the two struct are different