Skip to content

Commit

Permalink
change namespaces and regenerate types
Browse files Browse the repository at this point in the history
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
  • Loading branch information
Carlosespicur committed Jul 2, 2024
1 parent f9c9230 commit 83da20c
Show file tree
Hide file tree
Showing 34 changed files with 93 additions and 131 deletions.
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_subdirectory(cpp/content_filter)
add_subdirectory(cpp/custom_payload_pool)
add_subdirectory(cpp/dds)
add_subdirectory(cpp/delivery_mechanisms)
add_subdirectory(cpp/dds_security)
add_subdirectory(cpp/security)
add_subdirectory(cpp/hello_world)
add_subdirectory(cpp/rtps)
add_subdirectory(cpp/xtypes)
15 changes: 0 additions & 15 deletions examples/cpp/dds_security/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
#include "Application.hpp"

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

using namespace eprosima::fastdds::dds;

namespace eprosima {
namespace fastdds {
namespace examples {
namespace hello_world {
namespace security {

//! Factory method to create a publisher or subscriber
std::shared_ptr<Application> Application::make_app(
const CLIParser::hello_world_config& config,
const CLIParser::security_config& config,
const std::string& topic_name)
{
std::shared_ptr<Application> entity;
Expand All @@ -52,7 +52,7 @@ std::shared_ptr<Application> Application::make_app(
return entity;
}

} // namespace hello_world
} // namespace security
} // namespace examples
} // namespace fastdds
} // namespace eprosima
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
*/

#ifndef _FASTDDS_HELLO_WORLD_APPLICATION_HPP_
#define _FASTDDS_HELLO_WORLD_APPLICATION_HPP_
#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__APPLICATION_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__APPLICATION_HPP

#include <atomic>

Expand All @@ -27,7 +27,7 @@
namespace eprosima {
namespace fastdds {
namespace examples {
namespace hello_world {
namespace security {

class Application
{
Expand All @@ -44,13 +44,13 @@ class Application

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

} // namespace hello_world
} // namespace security
} // namespace examples
} // namespace fastdds
} // namespace eprosima

#endif /* _FASTDDS_HELLO_WORLD_APPLICATION_HPP_ */
#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__APPLICATION_HPP */
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
#include <cstdlib>
#include <iostream>
#include <cmath>

#include <fastdds/dds/log/Log.hpp>

#ifndef _FASTDDS_HELLO_WORLD_CLI_PARSER_HPP_
#define _FASTDDS_HELLO_WORLD_CLI_PARSER_HPP_
#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__CLI_PARSER_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__CLI_PARSER_HPP

namespace eprosima {
namespace fastdds {
namespace examples {
namespace hello_world {
namespace security {

using dds::Log;

Expand All @@ -50,7 +51,7 @@ class CLIParser
};

//! Configuration structure for the application
struct hello_world_config
struct security_config
{
CLIParser::EntityKind entity = CLIParser::EntityKind::UNDEFINED;
entity_config pub_config;
Expand All @@ -67,7 +68,7 @@ class CLIParser
static void print_help(
uint8_t return_code)
{
std::cout << "Usage: hello_world <entity> [options]" << std::endl;
std::cout << "Usage: security <entity> [options]" << std::endl;
std::cout << "" << std::endl;
std::cout << "Entities:" << std::endl;
std::cout << " publisher Run a publisher entity" << std::endl;
Expand All @@ -93,11 +94,11 @@ class CLIParser
*
* @warning This method finishes the execution of the program if the input arguments are invalid
*/
static hello_world_config parse_cli_options(
static security_config parse_cli_options(
int argc,
char* argv[])
{
hello_world_config config;
security_config config;

if (argc < 2)
{
Expand Down Expand Up @@ -283,9 +284,9 @@ class CLIParser

};

} // namespace hello_world
} // namespace security
} // namespace examples
} // namespace fastdds
} // namespace eprosima

#endif // _FASTDDS_HELLO_WORLD_CLI_PARSER_HPP_
#endif // FASTDDS_EXAMPLES_CPP_SECURITY__CLI_PARSER_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ message(STATUS "Configuring secure hello world example...")
file(GLOB SECURE_HELLO_WORLD_SOURCES_CXX "*.cxx")
file(GLOB SECURE_HELLO_WORLD_SOURCES_CPP "*.cpp")

add_executable(SecureHelloWorldExample ${SECURE_HELLO_WORLD_SOURCES_CXX} ${SECURE_HELLO_WORLD_SOURCES_CPP})
target_compile_definitions(SecureHelloWorldExample PRIVATE
add_executable(security ${SECURE_HELLO_WORLD_SOURCES_CXX} ${SECURE_HELLO_WORLD_SOURCES_CPP})
target_compile_definitions(security PRIVATE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
$<$<BOOL:${SHM_TRANSPORT_DEFAULT}>:SHM_TRANSPORT_BUILTIN> # Enable SHM as built-in transport
)
target_link_libraries(SecureHelloWorldExample fastdds fastcdr)
install(TARGETS SecureHelloWorldExample
RUNTIME DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/dds_security/SecureHelloWorldExample/${BIN_INSTALL_DIR})
target_link_libraries(security fastdds fastcdr)
install(TARGETS security
RUNTIME DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/security/${BIN_INSTALL_DIR})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/certs
DESTINATION examples/cpp/dds_security/SecureHelloWorldExample/${BIN_INSTALL_DIR})
DESTINATION examples/cpp/security/${BIN_INSTALL_DIR})
# Copy the XML files over to the build directory
file(GLOB_RECURSE XML_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.xml)
# for each xml file detected
Expand All @@ -61,10 +61,10 @@ foreach(XML_FILE_COMPLETE_PATH ${XML_FILES})
${CMAKE_CURRENT_BINARY_DIR}/${XML_FILE}.xml # to relative build path
COPYONLY)
install(FILES ${XML_FILE_COMPLETE_PATH}
DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/dds_security/SecureHelloWorldExample/${BIN_INSTALL_DIR})
DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/security/${BIN_INSTALL_DIR})
endforeach()

add_custom_command(TARGET SecureHelloWorldExample POST_BUILD
add_custom_command(TARGET security POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/certs
${PROJECT_BINARY_DIR}/certs)
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLD_HPP_
#define _FAST_DDS_GENERATED_HELLOWORLD_HPP_
#ifndef FAST_DDS_GENERATED__HELLOWORLD_HPP
#define FAST_DDS_GENERATED__HELLOWORLD_HPP

#include <cstdint>
#include <string>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP
#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP

#include "HelloWorld.hpp"

Expand All @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key(
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_
#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_
#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP
#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP

#include "HelloWorldCdrAux.hpp"

Expand Down Expand Up @@ -122,5 +122,5 @@ void serialize_key(
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_
#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* This file was generated by the tool fastddsgen.
*/

#include "HelloWorldPubSubTypes.h"
#include "HelloWorldPubSubTypes.hpp"

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/CdrSerialization.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
// limitations under the License.

/*!
* @file HelloWorldPubSubTypes.h
* @file HelloWorldPubSubTypes.hpp
* This header file contains the declaration of the serialization functions.
*
* This file was generated by the tool fastddsgen.
*/


#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_
#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_
#ifndef FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP
#define FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/dds/topic/TopicDataType.hpp>
#include <fastdds/rtps/common/InstanceHandle.h>
#include <fastdds/rtps/common/SerializedPayload.h>
#include <fastdds/utils/md5.h>
#include <fastdds/rtps/common/InstanceHandle.hpp>
#include <fastdds/rtps/common/SerializedPayload.hpp>
#include <fastdds/utils/md5.hpp>

#include "HelloWorld.hpp"

Expand Down Expand Up @@ -106,7 +106,7 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType
}

eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
Expand All @@ -124,10 +124,10 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType

#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE

MD5 m_md5;
eprosima::fastdds::MD5 m_md5;
unsigned char* m_keyBuffer;

};

#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_
#endif // FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP_
#define _FAST_DDS_GENERATED_HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP_
#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP
#define FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP

#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>

Expand Down Expand Up @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_HelloWorld_type_identifier(

#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

#endif // _FAST_DDS_GENERATED_HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP_
#endif // FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*
*/

#include "PublisherApp.hpp"

#include <condition_variable>
#include <stdexcept>

Expand All @@ -28,12 +26,15 @@
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>

#include "PublisherApp.hpp"
#include "HelloWorldPubSubTypes.hpp"

using namespace eprosima::fastdds::dds;

namespace eprosima {
namespace fastdds {
namespace examples {
namespace hello_world {
namespace security {

PublisherApp::PublisherApp(
const CLIParser::entity_config& config,
Expand Down Expand Up @@ -173,7 +174,7 @@ void PublisherApp::stop()
cv_.notify_one();
}

} // namespace hello_world
} // namespace security
} // namespace examples
} // namespace fastdds
} // namespace eprosima
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
*/

#ifndef _FASTDDS_HELLO_WORLD_PUBLISHER_APP_HPP_
#define _FASTDDS_HELLO_WORLD_PUBLISHER_APP_HPP_
#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP

#include <condition_variable>

Expand All @@ -28,14 +28,14 @@

#include "Application.hpp"
#include "CLIParser.hpp"
#include "HelloWorldPubSubTypes.h"
#include "HelloWorld.hpp"

using namespace eprosima::fastdds::dds;

namespace eprosima {
namespace fastdds {
namespace examples {
namespace hello_world {
namespace security {

class PublisherApp : public Application, public DataWriterListener
{
Expand Down Expand Up @@ -92,9 +92,9 @@ class PublisherApp : public Application, public DataWriterListener

};

} // namespace hello_world
} // namespace security
} // namespace examples
} // namespace fastdds
} // namespace eprosima

#endif /* _FASTDDS_HELLO_WORLD_PUBLISHER_APP_HPP_ */
#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP */
Loading

0 comments on commit 83da20c

Please sign in to comment.