-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom forwarding routes feature (#56)
* Add custom forwarding routes feature Signed-off-by: Juan López Fernández <[email protected]> * Unittests for the routes' configuration YamlReader Signed-off-by: tempate <[email protected]> * Fix compilation warning Signed-off-by: Juan Lopez Fernandez <[email protected]> * Uncrustify Signed-off-by: tempate <[email protected]> * Apply suggestions Signed-off-by: Juan Lopez Fernandez <[email protected]> * NIT changes Signed-off-by: Juan Lopez Fernandez <[email protected]> * Do TODOs Signed-off-by: Juan Lopez Fernandez <[email protected]> * Apply suggestion Signed-off-by: Juan Lopez Fernandez <[email protected]> --------- Signed-off-by: Juan López Fernández <[email protected]> Signed-off-by: tempate <[email protected]> Signed-off-by: Juan Lopez Fernandez <[email protected]> Co-authored-by: tempate <[email protected]>
- Loading branch information
1 parent
225de1d
commit 8af9525
Showing
21 changed files
with
1,104 additions
and
65 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
71 changes: 71 additions & 0 deletions
71
ddspipe_core/include/ddspipe_core/configuration/RoutesConfiguration.hpp
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,71 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <map> | ||
#include <set> | ||
|
||
#include <cpp_utils/Formatter.hpp> | ||
|
||
#include <ddspipe_core/configuration/IConfiguration.hpp> | ||
#include <ddspipe_core/types/participant/ParticipantId.hpp> | ||
|
||
#include <ddspipe_core/library/library_dll.h> | ||
|
||
namespace eprosima { | ||
namespace ddspipe { | ||
namespace core { | ||
|
||
/** | ||
* Configuration structure encapsulating the forwarding routes of a \c DdsPipe instance. | ||
*/ | ||
struct RoutesConfiguration : public IConfiguration | ||
{ | ||
|
||
using RoutesMap = std::map<types::ParticipantId, std::set<types::ParticipantId>>; | ||
|
||
///////////////////////// | ||
// CONSTRUCTORS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI RoutesConfiguration() = default; | ||
|
||
///////////////////////// | ||
// METHODS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI virtual bool is_valid( | ||
utils::Formatter& error_msg) const noexcept override; | ||
|
||
DDSPIPE_CORE_DllAPI bool is_valid( | ||
utils::Formatter& error_msg, | ||
std::map<types::ParticipantId, bool> participant_ids) const noexcept; | ||
|
||
///////////////////////// | ||
// OPERATORS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI RoutesMap operator () () const; | ||
|
||
///////////////////////// | ||
// VARIABLES | ||
///////////////////////// | ||
|
||
RoutesMap routes {}; | ||
}; | ||
|
||
} /* namespace core */ | ||
} /* namespace ddspipe */ | ||
} /* namespace eprosima */ |
72 changes: 72 additions & 0 deletions
72
ddspipe_core/include/ddspipe_core/configuration/TopicRoutesConfiguration.hpp
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,72 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <set> | ||
|
||
#include <cpp_utils/Formatter.hpp> | ||
#include <cpp_utils/memory/Heritable.hpp> | ||
|
||
#include <ddspipe_core/configuration/IConfiguration.hpp> | ||
#include <ddspipe_core/configuration/RoutesConfiguration.hpp> | ||
#include <ddspipe_core/types/topic/dds/DistributedTopic.hpp> | ||
|
||
#include <ddspipe_core/library/library_dll.h> | ||
|
||
namespace eprosima { | ||
namespace ddspipe { | ||
namespace core { | ||
|
||
/** | ||
* Configuration structure encapsulating the forwarding routes of a \c DdsPipe instance for a set of topics. | ||
*/ | ||
struct TopicRoutesConfiguration : public IConfiguration | ||
{ | ||
|
||
using TopicRoutesMap = std::map<utils::Heritable<types::DistributedTopic>, RoutesConfiguration>; | ||
|
||
///////////////////////// | ||
// CONSTRUCTORS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI TopicRoutesConfiguration() = default; | ||
|
||
///////////////////////// | ||
// METHODS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI virtual bool is_valid( | ||
utils::Formatter& error_msg) const noexcept override; | ||
|
||
DDSPIPE_CORE_DllAPI bool is_valid( | ||
utils::Formatter& error_msg, | ||
std::map<types::ParticipantId, bool> participant_ids) const noexcept; | ||
|
||
///////////////////////// | ||
// OPERATORS | ||
///////////////////////// | ||
|
||
DDSPIPE_CORE_DllAPI TopicRoutesMap operator () () const; | ||
|
||
///////////////////////// | ||
// VARIABLES | ||
///////////////////////// | ||
|
||
TopicRoutesMap topic_routes {}; | ||
}; | ||
|
||
} /* namespace core */ | ||
} /* namespace ddspipe */ | ||
} /* namespace eprosima */ |
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
Oops, something went wrong.