-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename catkin -> ws to avoid confusion.
- Loading branch information
Showing
65 changed files
with
733 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Deprecated, use namevalue2. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set (TGT_ARILES_VISITOR_LIB "${PROJECT_NAME}_visitor_${ARILES_VISITOR}") | ||
|
||
add_library(${TGT_ARILES_VISITOR_LIB} STATIC | ||
${ARILES_VISITOR_${ARILES_VISITOR}_DIR}/src/writer.cpp | ||
) | ||
|
||
include(ariles_install_component) |
104 changes: 104 additions & 0 deletions
104
ariles/extra_visitors/namevalue2/ariles2/visitors/namevalue2.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
@file | ||
@author Alexander Sherikov | ||
@copyright 2018-2024 Alexander Sherikov, Licensed under the Apache License, Version 2.0. | ||
(see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0) | ||
@brief | ||
*/ | ||
|
||
/** | ||
@defgroup namevalue2 NameValue2 | ||
@ingroup config | ||
@brief Generates a set of <std::string, double> pairs with flattened member names, | ||
e.g., <"ariles_class.class_member.real_member", 3.4>. | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
#define ARILES2_VISITOR_INCLUDED_namevalue2 | ||
|
||
#include <ariles2/internal/helpers.h> | ||
#include <ariles2/visitors/config.h> | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
|
||
namespace ariles2 | ||
{ | ||
namespace ns_namevalue2 | ||
{ | ||
class NameValueContainer | ||
{ | ||
public: | ||
virtual ~NameValueContainer() = default; | ||
|
||
virtual std::string &name(const std::size_t index) = 0; | ||
virtual double &value(const std::size_t index) = 0; | ||
virtual std::size_t size() const = 0; | ||
virtual void reserve(const std::size_t size) = 0; | ||
virtual void resize(const std::size_t size) = 0; | ||
}; | ||
|
||
|
||
/** | ||
* @brief Configuration writer class | ||
*/ | ||
class ARILES2_VISIBILITY_ATTRIBUTE Writer | ||
: public ariles2::write::Visitor, | ||
public serialization::NodeStackBase<serialization::Node<std::string>> | ||
{ | ||
protected: | ||
bool initialize_names_; | ||
std::size_t index_; | ||
std::shared_ptr<NameValueContainer> name_value_pairs_; | ||
|
||
const std::string separator_ = "."; | ||
const std::string bracket_left_ = "{"; | ||
const std::string bracket_right_ = "}"; | ||
|
||
|
||
public: | ||
explicit Writer(const std::shared_ptr<NameValueContainer> &container, const std::size_t reserve = 0); | ||
virtual void startRoot(const std::string &name, const Parameters ¶m); | ||
void flush(); | ||
virtual void startMap(const Parameters &, const std::size_t num_entries); | ||
virtual void startMapEntry(const std::string &map_name); | ||
virtual void endMapEntry(); | ||
virtual void endMap(); | ||
virtual bool startIteratedMap(const std::size_t /*num_entries*/, const Parameters &); | ||
virtual void startArray(const std::size_t size, const bool /*compact*/ = false); | ||
virtual void endArrayElement(); | ||
virtual void endArray(); | ||
|
||
|
||
#define ARILES2_BASIC_TYPE(type) void writeElement(const type &element, const Parameters &); | ||
|
||
CPPUT_MACRO_SUBSTITUTE(ARILES2_BASIC_NUMERIC_TYPES_LIST) | ||
|
||
#undef ARILES2_BASIC_TYPE | ||
|
||
|
||
void writeElement(const std::string &element, const Parameters ¶meters); | ||
virtual const Parameters &getDefaultParameters() const; | ||
}; | ||
} // namespace ns_namevalue2 | ||
} // namespace ariles2 | ||
|
||
|
||
namespace ariles2 | ||
{ | ||
/** | ||
* @brief NameValue2 visitor. | ||
* @ingroup namevalue2 | ||
*/ | ||
struct ARILES2_VISIBILITY_ATTRIBUTE namevalue2 | ||
{ | ||
using NameValueContainer = ns_namevalue2::NameValueContainer; | ||
using Writer = ns_namevalue2::Writer; | ||
}; | ||
} // namespace ariles2 |
Oops, something went wrong.