从之前industrial_robot_client的概述中,可以理解一些industrial_robot_client要实现的功能,从这里开始,就要正式开始分析并理解industrial_robot_client要实现的功能以及如何进行实现的,为之后的上层应用夯实基础。
UTILS
在utils对应的文件中,定义了5个实用的函数,用来检查变量之间是否在同一范围之内,并且经过前面那么多代码的理解,现在对于这样的文件相信看起来也不会太吃力。那么下面我们看一下不加注释的整个头文件的代码,从头文件中理解这些代码要实现什么样的功能。
#ifndef INDUSTRIAL_ROBOT_CLIENT_UTILS_H_
#define INDUSTRIAL_ROBOT_CLIENT_UTILS_H_
#include <vector>
#include <string>
#include <map>
namespace industrial_robot_client
{
namespace utils
{
bool isWithinRange(const std::vector<double> & lhs, const std::vector<double> & rhs,double full_range);
bool mapInsert(const std::string & key, double value, std::map<std::string, double> & mappings);
bool toMap(const std::vector<std::string> & keys, const std::vector<double> & values,std::map<std::string, double> & mappings);
bool isWithinRange(const std::vector<std::string> & keys, const std::map<std::string, double> & lhs,const std::map<std::string, double> & rhs, double full_range);
bool isWithinRange(const std::vector<std::string> & lhs_keys, const std::vector<double> & lhs_