TraveSim Adapters  0.1
Protobuf adapters for TraveSim project
vision_configurer.cpp
Go to the documentation of this file.
1 /**
2  * @file vision_configurer.cpp
3  *
4  * @author Lucas Haug <lucas.haug@thuneratz.org>
5  *
6  * @brief Configurer for the vision
7  *
8  * @date 06/2021
9  *
10  * @copyright MIT License - Copyright (c) 2021 ThundeRatz
11  *
12  */
13 
16 
17 /*****************************************
18  * Private Constants
19  *****************************************/
20 
21 #define VISION_CONFIGURER_NAMESPACE BASE_CONFIGURER_NAMESPACE "vision"
22 
23 namespace travesim {
24 /*****************************************
25  * Public Methods Bodies Definitions
26  *****************************************/
27 
30 }
31 
32 std::string VisionConfigurer::get_address(void) {
33  boost::recursive_mutex::scoped_lock scoped_lock(this->mutex);
34 
35  std::string address = this->config.multicast_address;
36 
38 
39  if (validation == IPValidation::VALID) {
40  return address;
41  } else {
42  ROS_ERROR_STREAM(get_error_msg(validation));
43 
44  return INVALID_ADDRESS;
45  }
46 }
47 
49  boost::recursive_mutex::scoped_lock scoped_lock(this->mutex);
50  return this->config.multicast_port;
51 }
52 
53 std::ostream& operator <<(std::ostream& output, const VisionConfigurer& vision_conf) {
54  output << "Vision Endpoint: " << vision_conf.config.multicast_address;
55  output << ":" << vision_conf.config.multicast_port << std::endl;
56  output << "Reset: " << ((vision_conf.config.reset || vision_conf.reconfigured) ? "True" : "False") << std::endl;
57 
58  return output;
59 }
60 }
uint16_t get_port(void)
Get the vision configured port.
#define MIN_MULTICAST_ADDRESS
IPValidation
Type used to validate a IP string.
VisionConfigurer class definition.
std::string get_error_msg(IPValidation error)
Get the error msg based on the validation type.
IPValidation check_valid_ip(std::string ip, std::string min_ip, std::string max_ip)
Checks if a IP is valid and is in the specified range.
Configurers utilitary funtions.
Configurer for the vision.
std::ostream & operator<<(std::ostream &output, const ReplacerConfigurer &repl_conf)
VisionConfigurer(void)
Construct a new VisionConfigurer object.
std::string get_address(void)
Get the vision configured address.
#define INVALID_ADDRESS
#define VISION_CONFIGURER_NAMESPACE
#define MAX_MULTICAST_ADDRESS