Skip to content
Salvo Virga edited this page Sep 22, 2018 · 4 revisions

simple_msgs - Basic Types

simple_msgs contains the definitions for basic messages types that can be sent over the network.

Their interfaces are straightforward:

Bool

simple_msgs::Bool my_bool; // Default ctor initializes with 'false'.
my_bool.set(true); // Set the Bool to true.
auto current_value = my_bool.get(); // correct_value is now true.

Int

simple_msgs::Int my_int{5}; // Initialize the Int to 5.
my_int.set(10); // Set the Int to 10.
auto current_value = my_int.get() // current_value is 10.

Float

simple_msgs::Float my_float; // Initialize the Float to 0.0.
my_float.set(2.5); // Set the Float to 2.5.
auto current_value = my_float.get() // current_value is 2.5.

Double

simple_msgs::Double my_double{1.0}; // Initialize the Double to 1.0.
my_double.set(55.0); // Set the Double to 55.0.
auto current_value = my_double.get() // current_value is 55.0.

String

simple_msgs::String my_string{"some text"}; // Initialize the String to "some text".
my_string.set("another text"); // Set the String to "another text".
auto current_value = my_string.get() // current_value is "another text".