-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example refactor: Custom payload pool (#4889)
* Refs #21094: Change folder name and delete old folder Signed-off-by: elianalf <[email protected]> * Refs #21094: Refactor of the main Signed-off-by: elianalf <[email protected]> * Refs #21094: Add CLI Parser Signed-off-by: elianalf <[email protected]> * Refs #21094: Publisher refactor Signed-off-by: elianalf <[email protected]> * Refs #21094: Subscriber refactor Signed-off-by: elianalf <[email protected]> * Refs #21094: Change example name and fix interval parsing Signed-off-by: elianalf <[email protected]> * Refs #21094: Add test Signed-off-by: elianalf <[email protected]> * Refs #21094: Update version.md Signed-off-by: elianalf <[email protected]> * Refs #21094: Apply suggestions: Use HelloWOrld instead of CUstomPayloadPoolData Signed-off-by: elianalf <[email protected]> * Refs #21094: Apply suggestions Signed-off-by: elianalf <[email protected]> * Refs #21094: Update ReadMe file Signed-off-by: elianalf <[email protected]> * Refs #21094: Uncrustify Signed-off-by: elianalf <[email protected]> * Refs #21094: Split test Signed-off-by: elianalf <[email protected]> * Refs #21094: Fix compilation error in Windows Signed-off-by: elianalf <[email protected]> --------- Signed-off-by: elianalf <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,620 additions
and
1,299 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
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 "PublisherApp.hpp" | ||
#include "SubscriberApp.hpp" | ||
|
||
using namespace eprosima::fastdds::dds; | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace examples { | ||
namespace custom_payload_pool { | ||
|
||
//! Factory method to create a publisher or subscriber | ||
std::shared_ptr<Application> Application::make_app( | ||
const CLIParser::custom_payload_pool_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 custom_payload_pool | ||
} // namespace examples | ||
} // namespace fastdds | ||
} // 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
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_CUSTOM_PAYLOAD_POOL_APPLICATION_HPP_ | ||
#define _FASTDDS_CUSTOM_PAYLOAD_POOL_APPLICATION_HPP_ | ||
|
||
#include <atomic> | ||
|
||
#include "CLIParser.hpp" | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace examples { | ||
namespace custom_payload_pool { | ||
|
||
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::custom_payload_pool_config& config, | ||
const std::string& topic_name); | ||
}; | ||
|
||
} // namespace custom_payload_pool | ||
} // namespace examples | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
#endif /* _FASTDDS_CUSTOM_PAYLOAD_POOL_APPLICATION_HPP_ */ |
Oops, something went wrong.