-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
- Loading branch information
1 parent
fbb9c0e
commit b2a2839
Showing
11 changed files
with
334 additions
and
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// 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 "ListenerSubscriberApp.hpp" | ||
#include "PublisherApp.hpp" | ||
#include "WaitsetSubscriberApp.hpp" | ||
|
||
using namespace eprosima::fastdds::dds; | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace examples { | ||
namespace hello_world { | ||
|
||
Application::Application() | ||
{ | ||
} | ||
|
||
void Application::run() | ||
{ | ||
} | ||
|
||
void Application::stop() | ||
{ | ||
} | ||
|
||
bool Application::is_stopped() | ||
{ | ||
return false; | ||
} | ||
|
||
//! Factory method to create a publisher or subscriber | ||
std::shared_ptr<Application> Application::make_app( | ||
const CLIParser::hello_world_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: | ||
if (config.sub_config.use_waitset) | ||
{ | ||
entity = std::make_shared<WaitsetSubscriberApp>(config.sub_config, topic_name); | ||
} | ||
else | ||
{ | ||
entity = std::make_shared<ListenerSubscriberApp>(config.sub_config, topic_name); | ||
} | ||
break; | ||
case CLIParser::EntityKind::UNDEFINED: | ||
default: | ||
throw std::runtime_error("Entity initialization failed"); | ||
break; | ||
} | ||
return entity; | ||
} | ||
|
||
} // namespace hello_world | ||
} // 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,61 @@ | ||
// 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_HELLO_WORLD_APPLICATION_HPP_ | ||
#define _FASTDDS_HELLO_WORLD_APPLICATION_HPP_ | ||
|
||
#include <atomic> | ||
|
||
#include "CLIParser.hpp" | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace examples { | ||
namespace hello_world { | ||
|
||
class Application | ||
{ | ||
public: | ||
|
||
Application(); | ||
|
||
//! Run entity (publisher or subscriber) | ||
virtual void run(); | ||
|
||
//! Trigger the end of execution | ||
virtual void stop(); | ||
|
||
//! Factory method to create a publisher or subscriber | ||
static std::shared_ptr<Application> make_app( | ||
const CLIParser::hello_world_config& config, | ||
const std::string& topic_name); | ||
|
||
private: | ||
|
||
//! Return the current state of execution | ||
virtual bool is_stopped(); | ||
|
||
}; | ||
|
||
} // namespace hello_world | ||
} // namespace examples | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
#endif /* _FASTDDS_HELLO_WORLD_APPLICATION_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
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.