Skip to content

Commit

Permalink
Example refactor: RTPS (#5086)
Browse files Browse the repository at this point in the history
* Refs #21280: Move rtps/Registered example in /rtps_entities

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add application and main

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add cliparser

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Change name, guard and extension

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Remove old files

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Reader application refactor

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Writer application refactor

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Make Reader compatible with HelloWorld Publisher and deserialize message

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Make reader compatible with helloworld

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Make writer compatible with helloworld

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add isFull check

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add tests

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Change on writer matched api after rebase

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add readme file

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add the idl file in the rtps folder

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Update version.md

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Apply suggestion

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Uncrustify

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Move increase sent sample inside add_change

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add missing override

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Change folder name and delete rtps old folder

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Add override

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #21280: Remove unused private variable

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

---------

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
  • Loading branch information
elianalf authored Jul 23, 2024
1 parent fec5777 commit c2dc6d2
Show file tree
Hide file tree
Showing 38 changed files with 1,677 additions and 1,564 deletions.
56 changes: 56 additions & 0 deletions examples/cpp/rtps/Application.cpp
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.cpp
*
*/

#include "Application.hpp"

#include "CLIParser.hpp"
#include "ReaderApp.hpp"
#include "WriterApp.hpp"

namespace eprosima {
namespace fastdds {
namespace examples {
namespace rtps {

//! Factory method to create a publisher or subscriber
std::shared_ptr<Application> Application::make_app(
const CLIParser::rtps_config& config,
const std::string& topic_name)
{
std::shared_ptr<Application> entity;
switch (config.entity)
{
case CLIParser::EntityKind::WRITER:
entity = std::make_shared<WriterApp>(config, topic_name);
break;
case CLIParser::EntityKind::READER:
entity = std::make_shared<ReaderApp>(config, topic_name);
break;
case CLIParser::EntityKind::UNDEFINED:
default:
throw std::runtime_error("Entity initialization failed");
break;
}
return entity;
}

} // namespace rtps
} // namespace examples
} // namespace fastdds
} // namespace eprosima
54 changes: 54 additions & 0 deletions examples/cpp/rtps/Application.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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_EXAMPLES_CPP_RTPS__APPLICATION_HPP
#define FASTDDS_EXAMPLES_CPP_RTPS__APPLICATION_HPP

#include "CLIParser.hpp"

namespace eprosima {
namespace fastdds {
namespace examples {
namespace rtps {

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::rtps_config& config,
const std::string& topic_name);
};

} // namespace rtps
} // namespace examples
} // namespace fastdds
} // namespace eprosima

#endif // FASTDDS_EXAMPLES_CPP_RTPS__APPLICATION_HPP
52 changes: 0 additions & 52 deletions examples/cpp/rtps/AsSocket/CMakeLists.txt

This file was deleted.

4 changes: 0 additions & 4 deletions examples/cpp/rtps/AsSocket/README.txt

This file was deleted.

98 changes: 0 additions & 98 deletions examples/cpp/rtps/AsSocket/TestReaderSocket.cpp

This file was deleted.

78 changes: 0 additions & 78 deletions examples/cpp/rtps/AsSocket/TestReaderSocket.h

This file was deleted.

Loading

0 comments on commit c2dc6d2

Please sign in to comment.