Skip to content
Snippets Groups Projects
Commit 9d62e73f authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Merge branch 'category' into 'master'

Rename NodeBase node_class -> node_category, and getGategory()

See merge request mobile_robotics/wolf!222
parents 6d1c3c91 3cee997b
No related branches found
No related tags found
1 merge request!222Rename NodeBase node_class -> node_category, and getGategory()
Pipeline #2275 passed
......@@ -13,7 +13,7 @@ namespace wolf {
*
* - A unique ID. The class implements the ID factory.
*
* - A unique class name, strictly within this range of possibilities:
* - A unique category name, strictly within this range of possibilities:
* - "BASE" -- should not be used
* - "PROBLEM"
* - "HARDWARE"
......@@ -27,7 +27,7 @@ namespace wolf {
* - "MAP"
* - "LANDMARK"
*
* - A unique type, which is a subclass of the above. The list here cannot be exhaustive, but a few examples follow:
* - A unique type, which is a subcategory of the above. The list here cannot be exhaustive, but a few examples follow:
* - "Camera"
* - "LIDAR 2D"
* - "Point 3D"
......@@ -63,17 +63,17 @@ class NodeBase
ProblemWPtr problem_ptr_;
unsigned int node_id_; ///< Node id. It is unique over the whole Wolf Tree
std::string node_class_; ///< Text label identifying the class of node ("SENSOR", "FEATURE", etc)
std::string node_type_; ///< Text label identifying the type or subclass of node ("Pin Hole", "Point 2D", etc)
std::string node_category_; ///< Text label identifying the category of node ("SENSOR", "FEATURE", etc)
std::string node_type_; ///< Text label identifying the type or subcategory of node ("Pin Hole", "Point 2D", etc)
std::string node_name_; ///< Text label identifying each specific object ("left camera", "LIDAR 1", "PointGrey", "Andrew", etc)
public:
NodeBase(const std::string& _class, const std::string& _type = "Undefined", const std::string& _name = "");
NodeBase(const std::string& _category, const std::string& _type = "Undefined", const std::string& _name = "");
virtual ~NodeBase() = default;
unsigned int nodeId() const;
std::string getClass() const;
std::string getCategory() const;
std::string getType() const;
std::string getName() const;
......@@ -90,10 +90,10 @@ class NodeBase
namespace wolf{
inline NodeBase::NodeBase(const std::string& _class, const std::string& _type, const std::string& _name) :
inline NodeBase::NodeBase(const std::string& _category, const std::string& _type, const std::string& _name) :
problem_ptr_(), // nullptr
node_id_(++node_id_count_),
node_class_(_class),
node_category_(_category),
node_type_(_type),
node_name_(_name)
{
......@@ -105,9 +105,9 @@ inline unsigned int NodeBase::nodeId() const
return node_id_;
}
inline std::string NodeBase::getClass() const
inline std::string NodeBase::getCategory() const
{
return node_class_;
return node_category_;
}
inline std::string NodeBase::getType() const
......
......@@ -14,7 +14,7 @@ struct NodeBase::Serializer {
template <class Archive>
static void serialize(Archive& ar, NodeBase& o, std::uint32_t const /*version*/)
{
ar( cereal::make_nvp("node_class_", o.node_class_) );
ar( cereal::make_nvp("node_class_", o.node_category_) );
ar( cereal::make_nvp("node_type_", o.node_type_) );
ar( cereal::make_nvp("node_name_", o.node_name_) );
ar( cereal::make_nvp("node_id_", o.node_id_) );
......@@ -29,7 +29,7 @@ struct NodeBase::Serializer {
static void load_and_construct( Archive& ar, cereal::construct<wolf::NodeBase>& construct,
std::uint32_t const /*version*/ )
{
decltype(std::declval<wolf::NodeBase>().getClass()) nb_class;
decltype(std::declval<wolf::NodeBase>().getCategory()) nb_class;
decltype(std::declval<wolf::NodeBase>().getType()) nb_type;
decltype(std::declval<wolf::NodeBase>().getName()) nb_name;
......
......@@ -27,9 +27,9 @@ public:
const std::string path_to_io = "/tmp/";
decltype(std::declval<wolf::NodeBase>().getClass()) nb_class = "Foo";
decltype(std::declval<wolf::NodeBase>().getClass()) nb_type = "Bar";
decltype(std::declval<wolf::NodeBase>().getClass()) nb_name = "Dummy";
decltype(std::declval<wolf::NodeBase>().getCategory()) nb_class = "Foo";
decltype(std::declval<wolf::NodeBase>().getCategory()) nb_type = "Bar";
decltype(std::declval<wolf::NodeBase>().getCategory()) nb_name = "Dummy";
decltype(std::declval<wolf::NodeBase>().nodeId()) id;
......@@ -60,7 +60,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBaseXML)
ASSERT_NO_THROW( xml_archive( nb ) );
ASSERT_EQ(nb.getClass(), nb_class);
ASSERT_EQ(nb.getCategory(), nb_class);
ASSERT_EQ(nb.getType(), nb_type);
ASSERT_EQ(nb.getName(), nb_name);
ASSERT_EQ(nb.nodeId(), id);
......@@ -92,7 +92,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBasePtrXML)
ASSERT_NO_THROW( xml_archive( nb ) );
ASSERT_EQ(nb->getClass(), nb_class);
ASSERT_EQ(nb->getCategory(), nb_class);
ASSERT_EQ(nb->getType(), nb_type);
ASSERT_EQ(nb->getName(), nb_name);
ASSERT_EQ(nb->nodeId(), id);
......@@ -128,7 +128,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBaseJSON)
ASSERT_NO_THROW( json_archive( nb ) );
ASSERT_EQ(nb.getClass(), nb_class);
ASSERT_EQ(nb.getCategory(), nb_class);
ASSERT_EQ(nb.getType(), nb_type);
ASSERT_EQ(nb.getName(), nb_name);
ASSERT_EQ(nb.nodeId(), id);
......@@ -159,7 +159,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBasePtrJSON)
ASSERT_NO_THROW( json_archive( nb ) );
ASSERT_EQ(nb->getClass(), nb_class);
ASSERT_EQ(nb->getCategory(), nb_class);
ASSERT_EQ(nb->getType(), nb_type);
ASSERT_EQ(nb->getName(), nb_name);
ASSERT_EQ(nb->nodeId(), id);
......@@ -195,7 +195,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBaseBinary)
ASSERT_NO_THROW( bin_archive( nb ) );
ASSERT_EQ(nb.getClass(), nb_class);
ASSERT_EQ(nb.getCategory(), nb_class);
ASSERT_EQ(nb.getType(), nb_type);
ASSERT_EQ(nb.getName(), nb_name);
ASSERT_EQ(nb.nodeId(), id);
......@@ -226,7 +226,7 @@ TEST_F(WolfTestCerealSerializationNodeBase, CerealSerializationNodeBasePtrBinary
ASSERT_NO_THROW( bin_archive( nb ) );
ASSERT_EQ(nb->getClass(), nb_class);
ASSERT_EQ(nb->getCategory(), nb_class);
ASSERT_EQ(nb->getType(), nb_type);
ASSERT_EQ(nb->getName(), nb_name);
ASSERT_EQ(nb->nodeId(), id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment