-
Notifications
You must be signed in to change notification settings - Fork 16
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: Irene Bandera <irenebandera@eprosima.com>
- Loading branch information
Showing
31 changed files
with
337 additions
and
456 deletions.
There are no files selected for viewing
340 changes: 231 additions & 109 deletions
340
controller/controller_tool/ddstypes/v1/DdsRecorderCommand/DdsRecorderCommand.cxx
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 |
---|---|---|
@@ -1,112 +1,234 @@ | ||
// Copyright 2016 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 DdsRecorderCommand.cxx | ||
* This source file contains the definition of the described types in the IDL file. | ||
* | ||
* This file was generated by the tool gen. | ||
*/ | ||
|
||
#ifdef _WIN32 | ||
// Remove linker warning LNK4221 on Visual Studio | ||
namespace { | ||
char dummy; | ||
} // namespace | ||
#endif // _WIN32 | ||
|
||
#include "DdsRecorderCommand.h" | ||
#include <fastcdr/Cdr.h> | ||
|
||
cmake_minimum_required(VERSION 3.16.3) | ||
#include <fastcdr/exceptions/BadParamException.h> | ||
using namespace eprosima::fastcdr::exception; | ||
|
||
# SWIG: use standard target name. | ||
if(POLICY CMP0078) | ||
cmake_policy(SET CMP0078 NEW) | ||
endif() | ||
#include <utility> | ||
|
||
#define DdsRecorderCommand_max_cdr_typesize 520ULL; | ||
#define DdsRecorderCommand_max_key_cdr_typesize 0ULL; | ||
|
||
# SWIG: use SWIG_MODULE_NAME property. | ||
if(POLICY CMP0086) | ||
cmake_policy(SET CMP0086 NEW) | ||
endif() | ||
|
||
############################################################################### | ||
# Library for types defined in DdsRecorderCommand IDL | ||
############################################################################### | ||
|
||
message(STATUS "Configuring python wrapper for types in DdsRecorderCommand...") | ||
|
||
############################################################################### | ||
# Type library on C++ | ||
|
||
project(DdsRecorderCommand) | ||
|
||
find_package(fastcdr REQUIRED) | ||
find_package(fastrtps REQUIRED) | ||
|
||
|
||
set(${PROJECT_NAME}_FILES | ||
DdsRecorderCommand.cxx | ||
DdsRecorderCommandPubSubTypes.cxx | ||
) | ||
|
||
include_directories() | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
#Create library for C++ types | ||
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_FILES}) | ||
if(WIN32) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT) | ||
endif(WIN32) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC fastcdr fastrtps) | ||
|
||
############################################################################### | ||
# Python bindings for type | ||
|
||
find_package(SWIG REQUIRED) | ||
include(${SWIG_USE_FILE}) | ||
set(CMAKE_SWIG_FLAGS "") | ||
|
||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED) | ||
set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}) | ||
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) | ||
set(PYTHON_LIBRARIES ${Python3_LIBRARIES}) | ||
|
||
include_directories(${PYTHON_INCLUDE_PATH}) | ||
|
||
set(${PROJECT_NAME}_MODULE | ||
DdsRecorderCommandWrapper | ||
) | ||
|
||
set(${PROJECT_NAME}_MODULE_FILES | ||
${PROJECT_NAME}.i | ||
) | ||
|
||
SET_SOURCE_FILES_PROPERTIES( | ||
${${PROJECT_NAME}_MODULE_FILES} | ||
PROPERTIES CPLUSPLUS ON | ||
USE_TARGET_INCLUDE_DIRECTORIES TRUE | ||
) | ||
|
||
include_directories( | ||
${PROJECT_SOURCE_DIR} | ||
) | ||
|
||
SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE} | ||
TYPE SHARED | ||
LANGUAGE python | ||
SOURCES ${${PROJECT_NAME}_MODULE_FILES}) | ||
|
||
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64) | ||
endif() | ||
|
||
SWIG_LINK_LIBRARIES(${${PROJECT_NAME}_MODULE} | ||
Python3::Module | ||
fastrtps | ||
${PROJECT_NAME} | ||
) | ||
|
||
# Find the installation path | ||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" | ||
OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE) | ||
file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH}) | ||
SET (PYTHON_MODULE_PATH | ||
${_REL_PYTHON_MODULE_PATH} | ||
) | ||
|
||
# Install | ||
install(TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION bin/ | ||
LIBRARY DESTINATION lib/ | ||
ARCHIVE DESTINATION lib/ | ||
) | ||
install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}) | ||
get_property(support_files TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_SUPPORT_FILES) | ||
install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}) | ||
DdsRecorderCommand::DdsRecorderCommand() | ||
{ | ||
// string m_command | ||
m_command =""; | ||
// string m_args | ||
m_args =""; | ||
|
||
} | ||
|
||
DdsRecorderCommand::~DdsRecorderCommand() | ||
{ | ||
|
||
|
||
} | ||
|
||
DdsRecorderCommand::DdsRecorderCommand( | ||
const DdsRecorderCommand& x) | ||
{ | ||
m_command = x.m_command; | ||
m_args = x.m_args; | ||
} | ||
|
||
DdsRecorderCommand::DdsRecorderCommand( | ||
DdsRecorderCommand&& x) noexcept | ||
{ | ||
m_command = std::move(x.m_command); | ||
m_args = std::move(x.m_args); | ||
} | ||
|
||
DdsRecorderCommand& DdsRecorderCommand::operator =( | ||
const DdsRecorderCommand& x) | ||
{ | ||
|
||
m_command = x.m_command; | ||
m_args = x.m_args; | ||
|
||
return *this; | ||
} | ||
|
||
DdsRecorderCommand& DdsRecorderCommand::operator =( | ||
DdsRecorderCommand&& x) noexcept | ||
{ | ||
|
||
m_command = std::move(x.m_command); | ||
m_args = std::move(x.m_args); | ||
|
||
return *this; | ||
} | ||
|
||
bool DdsRecorderCommand::operator ==( | ||
const DdsRecorderCommand& x) const | ||
{ | ||
|
||
return (m_command == x.m_command && m_args == x.m_args); | ||
} | ||
|
||
bool DdsRecorderCommand::operator !=( | ||
const DdsRecorderCommand& x) const | ||
{ | ||
return !(*this == x); | ||
} | ||
|
||
size_t DdsRecorderCommand::getMaxCdrSerializedSize( | ||
size_t current_alignment) | ||
{ | ||
static_cast<void>(current_alignment); | ||
return DdsRecorderCommand_max_cdr_typesize; | ||
} | ||
|
||
size_t DdsRecorderCommand::getCdrSerializedSize( | ||
const DdsRecorderCommand& data, | ||
size_t current_alignment) | ||
{ | ||
(void)data; | ||
size_t initial_alignment = current_alignment; | ||
|
||
|
||
current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.command().size() + 1; | ||
|
||
current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.args().size() + 1; | ||
|
||
|
||
return current_alignment - initial_alignment; | ||
} | ||
|
||
void DdsRecorderCommand::serialize( | ||
eprosima::fastcdr::Cdr& scdr) const | ||
{ | ||
|
||
scdr << m_command.c_str(); | ||
scdr << m_args.c_str(); | ||
|
||
} | ||
|
||
void DdsRecorderCommand::deserialize( | ||
eprosima::fastcdr::Cdr& dcdr) | ||
{ | ||
|
||
dcdr >> m_command; | ||
dcdr >> m_args; | ||
} | ||
|
||
/*! | ||
* @brief This function copies the value in member command | ||
* @param _command New value to be copied in member command | ||
*/ | ||
void DdsRecorderCommand::command( | ||
const std::string& _command) | ||
{ | ||
m_command = _command; | ||
} | ||
|
||
/*! | ||
* @brief This function moves the value in member command | ||
* @param _command New value to be moved in member command | ||
*/ | ||
void DdsRecorderCommand::command( | ||
std::string&& _command) | ||
{ | ||
m_command = std::move(_command); | ||
} | ||
|
||
/*! | ||
* @brief This function returns a constant reference to member command | ||
* @return Constant reference to member command | ||
*/ | ||
const std::string& DdsRecorderCommand::command() const | ||
{ | ||
return m_command; | ||
} | ||
|
||
/*! | ||
* @brief This function returns a reference to member command | ||
* @return Reference to member command | ||
*/ | ||
std::string& DdsRecorderCommand::command() | ||
{ | ||
return m_command; | ||
} | ||
/*! | ||
* @brief This function copies the value in member args | ||
* @param _args New value to be copied in member args | ||
*/ | ||
void DdsRecorderCommand::args( | ||
const std::string& _args) | ||
{ | ||
m_args = _args; | ||
} | ||
|
||
/*! | ||
* @brief This function moves the value in member args | ||
* @param _args New value to be moved in member args | ||
*/ | ||
void DdsRecorderCommand::args( | ||
std::string&& _args) | ||
{ | ||
m_args = std::move(_args); | ||
} | ||
|
||
/*! | ||
* @brief This function returns a constant reference to member args | ||
* @return Constant reference to member args | ||
*/ | ||
const std::string& DdsRecorderCommand::args() const | ||
{ | ||
return m_args; | ||
} | ||
|
||
/*! | ||
* @brief This function returns a reference to member args | ||
* @return Reference to member args | ||
*/ | ||
std::string& DdsRecorderCommand::args() | ||
{ | ||
return m_args; | ||
} | ||
|
||
|
||
size_t DdsRecorderCommand::getKeyMaxCdrSerializedSize( | ||
size_t current_alignment) | ||
{ | ||
static_cast<void>(current_alignment); | ||
return DdsRecorderCommand_max_key_cdr_typesize; | ||
} | ||
|
||
bool DdsRecorderCommand::isKeyDefined() | ||
{ | ||
return false; | ||
} | ||
|
||
void DdsRecorderCommand::serializeKey( | ||
eprosima::fastcdr::Cdr& scdr) const | ||
{ | ||
(void) scdr; | ||
} |
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
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.