-
Notifications
You must be signed in to change notification settings - Fork 6
msg: basics
Salvo Virga edited this page Sep 22, 2018
·
4 revisions
simple_msgs contains the definitions for basic messages types that can be sent over the network.
Their interfaces are straightforward:
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.
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.
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.
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.
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".