Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20823] Example refactor: Content filter #4859

Merged
merged 29 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8da571d
Refs #20823: Copy ContentFilteredTopicExample files to content_filtering
elianalf May 20, 2024
6094a3e
Refs #20823: Change file names and CMakeList structure
elianalf May 20, 2024
1a9f1e5
Refs #20823: Add CLI parser
elianalf May 20, 2024
4545829
Refs #20823: Add application hpp and cpp
elianalf May 21, 2024
9c86d6c
Refs #20823: Create publisher application
elianalf May 21, 2024
9a26dcd
Refs #20823: Create subscriber application
elianalf May 23, 2024
2392683
Refs #20823: Add test
elianalf May 23, 2024
bf1ecd4
Refs #Refs 20823: Rename folder to content_filter
elianalf May 28, 2024
6ab1e13
Refs #20823 Add customizable lower bound and upper bound arguments to…
elianalf May 28, 2024
df118d1
Refs #20823: Add changes to version.md
elianalf May 28, 2024
52a5059
Refs #20823: Initialize interval in publisher
elianalf Jun 3, 2024
8147cd7
Refs #20823: Apply suggestion
elianalf Jun 5, 2024
cbcfebc
Refs #20823: Apply suggestion: Update Readme.md
elianalf Jun 5, 2024
37f55b9
Refs #20823: Add option none filter
elianalf Jun 6, 2024
07a03a5
Refs #20823: Set datareader and datawriter qos to meet the condition …
elianalf Jun 6, 2024
386711d
Refs #20823: Apply suggestions: Add filtering on the writer side
elianalf Jun 10, 2024
96c9974
Refs #20823: Uncrustify
elianalf Jun 10, 2024
db4bab5
Refs #20823: Change guard name and custom filter classes name
elianalf Jun 11, 2024
f7bdff4
Refs #20823 Apply suggestions
elianalf Jun 11, 2024
60e37dc
Refs #20823: Update ReadMe
elianalf Jun 11, 2024
45259f1
Refs #20823: Add new arguments to set a custom filter expression and …
elianalf Jun 11, 2024
6d85676
Refs #20823: add transient and ralible as arguments
elianalf Jun 11, 2024
ba9928f
Refs #20823: Split and modify test
elianalf Jun 11, 2024
77b52f0
Refs #20823: uncrustify
elianalf Jun 11, 2024
5d9028b
Refs #20823: Solve windows warning
elianalf Jun 12, 2024
8a4411b
Refs #20823: Remove argument --reliable --transient-local
elianalf Jun 12, 2024
0e6a0e5
Refs #20823: Add the right includes
elianalf Jun 12, 2024
62dd37e
Refs #20823: Remove folders that were added during the rebase
elianalf Jun 14, 2024
4dac17a
Refs #20823: Add license
elianalf Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# limitations under the License.

set(fastdds_FOUND TRUE)

add_subdirectory(cpp/configuration)
add_subdirectory(cpp/content_filter)
add_subdirectory(cpp/custom_payload_pool)
add_subdirectory(cpp/dds)
add_subdirectory(cpp/hello_world)
Expand Down
58 changes: 58 additions & 0 deletions examples/cpp/content_filter/Application.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2024 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.

/**
* @file Application.cpp
*
*/

#include "Application.hpp"

#include "CLIParser.hpp"
#include "SubscriberApp.hpp"
#include "PublisherApp.hpp"

using namespace eprosima::fastdds::dds;

namespace eprosima {
namespace fastdds {
namespace examples {
namespace content_filter {

//! Factory method to create a publisher or subscriber
std::shared_ptr<Application> Application::make_app(
const CLIParser::content_filter_config& config,
const std::string& topic_name)
{
std::shared_ptr<Application> entity;
switch (config.entity)
{
case CLIParser::EntityKind::PUBLISHER:
entity = std::make_shared<PublisherApp>(config.pub_config, topic_name);
break;
case CLIParser::EntityKind::SUBSCRIBER:
entity = std::make_shared<SubscriberApp>(config.sub_config, topic_name);
break;
case CLIParser::EntityKind::UNDEFINED:
default:
throw std::runtime_error("Entity initialization failed");
break;
}
return entity;
}

} // namespace content_filter
} // namespace examples
} // namespace fastdds
} // namespace eprosima
56 changes: 56 additions & 0 deletions examples/cpp/content_filter/Application.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2024 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.

/**
* @file Application.hpp
*
*/

#ifndef _FASTDDS_CONTENT_FILTER_APPLICATION_HPP_
#define _FASTDDS_CONTENT_FILTER_APPLICATION_HPP_

#include <atomic>

#include "CLIParser.hpp"

namespace eprosima {
namespace fastdds {
namespace examples {
namespace content_filter {

class Application
{
public:

//! Virtual destructor
virtual ~Application() = default;

//! Run application
virtual void run() = 0;

//! Trigger the end of execution
virtual void stop() = 0;

//! Factory method to create applications based on configuration
static std::shared_ptr<Application> make_app(
const CLIParser::content_filter_config& config,
const std::string& topic_name);
};

} // namespace content_filter
} // namespace examples
} // namespace fastdds
} // namespace eprosima

#endif /* _FASTDDS_CONTEN_FILTER_APPLICATION_HPP_ */
Loading