Skip to content

Commit

Permalink
iox-eclipse-iceoryx#495 Merge remote-tracking branch 'upstream/master…
Browse files Browse the repository at this point in the history
…' into iox-eclipse-iceoryx#495-bugfix-gcc-5-compatibility

Signed-off-by: Hintz Martin (XC-AD/ESB5) <[email protected]>
  • Loading branch information
marthtz committed May 12, 2021
2 parents fb5a7ba + 006941f commit 5503df4
Show file tree
Hide file tree
Showing 83 changed files with 2,931 additions and 183 deletions.
9 changes: 7 additions & 2 deletions iceoryx_posh/.clang-tidy → .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
Checks: '-*, readability-identifier-naming'
Checks: '-*,readability-*,performance-*,hicpp-*,cppcoreguidelines-*,concurrency-*,clang-analyzer-*,cert-*,bugprone-*'
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.MethodCase, value: camelBack }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.MemberPrefix, value: m_ }
- { key: readability-identifier-naming.MemberCase, value: camelBack }
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-function-size.LineThreshold, value: 200 }
- { key: readability-function-size.StatementThreshold, value: 200 }
- { key: readability-function-size.BranchThreshold, value: 10 }
- { key: readability-function-size.ParameterThreshold, value: 3 }
11 changes: 6 additions & 5 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# codecov yaml
comment: yes # do not comment PR with the result
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: yes # only post the comment if coverage changes
require_changes: yes
require_base: no
require_head: yes

coverage:
range: 70..100
range: 70..100

status:
project:
Expand All @@ -19,8 +19,9 @@ coverage:
default:
enabled: yes
target: 70%
threshold: 2%
changes: yes
threshold: 2%
base: auto
changes: no

parsers:
gcov:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: Colcon build
name: Iceoryx Integrationtests

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Iceoryx Dependencies
run: |
sudo apt install -y apt-transport-https
sudo apt update && sudo apt install -y cmake libacl1-dev libncurses5-dev pkg-config
sudo apt update && sudo apt install -y cmake libacl1-dev libncurses5-dev pkg-config ros-foxy-ros-testing
mkdir -p src/iceoryx
cd $GITHUB_WORKSPACE/src/iceoryx
Expand All @@ -48,7 +48,16 @@ jobs:
sudo sed -i '41 c\"'c'", "'cc'", "'cpp'", "'cxx'", "'h'", "'hh'", "'hpp'", "'hxx'", "'inl'", "'sh'"' /opt/ros/foxy/lib/python3.8/site-packages/ament_copyright/main.py
ament_copyright --exclude LICENSE CONTRIBUTING.md tools/apache2_header.txt
- name: Build & Test
- name: Build
run: |
source /opt/ros/foxy/setup.bash
cd $GITHUB_WORKSPACE
colcon build
- name: Test Execution
run: |
source /opt/ros/foxy/setup.bash
source $GITHUB_WORKSPACE/install/setup.bash
cd $GITHUB_WORKSPACE
colcon test --packages-select iceoryx_integrationtest
colcon test-result --all --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ clangd/
site/
doc/website/API-reference/
*.project
__pycache__
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

[![Build & Test](https://github.com/eclipse-iceoryx/iceoryx/workflows/Build%20&%20Test/badge.svg?branch=master)](https://github.com/eclipse-iceoryx/iceoryx/actions)
[![Colcon build](https://github.com/eclipse-iceoryx/iceoryx/workflows/Colcon%20build/badge.svg?branch=master)](https://github.com/eclipse-iceoryx/iceoryx/actions)
[![Integrationtests](https://github.com/eclipse-iceoryx/iceoryx/workflows/Iceoryx%20Integrationtests/badge.svg?branch=master)](https://github.com/eclipse-iceoryx/iceoryx/actions)
[![Gitter](https://badges.gitter.im/eclipse-iceoryx/iceoryx.svg)](https://gitter.im/eclipse/iceoryx)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov](https://codecov.io/gh/eclipse-iceoryx/iceoryx/branch/master/graph/badge.svg?branch=master)](https://codecov.io/gh/eclipse-iceoryx/iceoryx?branch=master)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Intermediate examples

{! ./../iceoryx_examples/callbacks/README.md !}
{! ./../iceoryx_examples/callbacks_in_c/README.md !}
{! ./../iceoryx_examples/waitset/README.md !}
{! ./../iceoryx_examples/waitset_in_c/README.md !}
{! ./../iceoryx_examples/singleprocess/README.md !}
9 changes: 6 additions & 3 deletions iceoryx_binding_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ set(${PROJECT_NAME}_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake
########## build building-block library ##########
#
add_library(${PROJECT_NAME}
source/c_user_trigger.cpp
source/c_publisher.cpp
source/c_event_info.cpp
source/c_listener.cpp
source/c_node.cpp
source/c_publisher.cpp
source/c_runtime.cpp
source/c_subscriber.cpp
source/c_event_info.cpp
source/c_user_trigger.cpp
source/c_wait_set.cpp
source/c_chunk.cpp
source/cpp2c_enum_translation.cpp
source/cpp2c_publisher.cpp
source/cpp2c_subscriber.cpp
source/cpp2c_service_description_translation.cpp
)
add_library(${PROJECT_NAMESPACE}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

Expand All @@ -76,6 +78,7 @@ target_include_directories(${PROJECT_NAME}
if(NOT (WIN32 OR QNX))
target_link_libraries(${PROJECT_NAME}
PUBLIC
stdc++
pthread
PRIVATE
iceoryx_posh::iceoryx_posh
Expand Down
7 changes: 7 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,12 @@ enum iox_WaitSetResult
WaitSetResult_SUCCESS
};

enum iox_ListenerResult
{
ListenerResult_LISTENER_FULL,
ListenerResult_EVENT_ALREADY_ATTACHED,
ListenerResult_UNDEFINED_ERROR,
ListenerResult_SUCCESS
};

#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -22,6 +23,7 @@
#include "iceoryx_posh/iceoryx_posh_types.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_receiver.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_sender.hpp"
#include "iceoryx_posh/popo/listener.hpp"
#include "iceoryx_posh/popo/wait_set.hpp"

namespace cpp2c
Expand All @@ -30,6 +32,7 @@ iox_SubscribeState SubscribeState(const iox::SubscribeState value);
iox_ChunkReceiveResult ChunkReceiveResult(const iox::popo::ChunkReceiveResult value);
iox_AllocationResult AllocationResult(const iox::popo::AllocationError value);
iox_WaitSetResult WaitSetResult(const iox::popo::WaitSetError value);
iox_ListenerResult ListenerResult(const iox::popo::ListenerError value);
} // namespace cpp2c

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_BINDING_C_CPP2C_SERVICE_DESCRIPTION_TRANSLATION_HPP
#define IOX_BINDING_C_CPP2C_SERVICE_DESCRIPTION_TRANSLATION_HPP

#include "iceoryx_binding_c/service_description.h"
#include "iceoryx_posh/capro/service_description.hpp"

iox_service_description_t
TranslateServiceDescription(const iox::capro::ServiceDescription& serviceDescription) noexcept;

#endif

82 changes: 82 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/listener.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright (c) 2021 Apex.AI Inc. All rights reserved.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_BINDING_C_LISTENER_H
#define IOX_BINDING_C_LISTENER_H

#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/subscriber.h"
#include "iceoryx_binding_c/types.h"
#include "iceoryx_binding_c/user_trigger.h"

typedef CLASS Listener* iox_listener_t;


/// @brief initializes a listener struct from a storage struct pointer
/// @param[in] self pointer to raw memory which can hold a listener
/// @return an initialized iox_listener_t
iox_listener_t iox_listener_init(iox_listener_storage_t* self);

/// @brief after using an iox_listener_t it must be cleaned up with this function
/// @param[in] self the listener which should be deinitialized
void iox_listener_deinit(iox_listener_t const self);

/// @brief Attaches a subscriber event to the listener
/// @param[in] self listener to which the event should be attached to
/// @param[in] subscriber subscriber which emits the event
/// @param[in] subscriberEvent the event which should trigger the listener
/// @param[in] callback the callback which is called when an event triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
void (*callback)(iox_sub_t));

/// @brief Attaches a user trigger to the listener
/// @param[in] self listener to which the event should be attached to
/// @param[in] userTrigger user trigger which emits the event
/// @param[in] callback the callback which is called when the user trigger triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void (*callback)(iox_user_trigger_t));

/// @brief Detaches a subscriber event from the listener
/// @param[in] self listener from which the event should be detached
/// @param[in] subscriber the subscriber which emits the event
/// @param[in] subscriberEvent the subscriber event which is registered at the listener
void iox_listener_detach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent);

/// @brief Detaches a user trigger from the listener
/// @param[in] self listener from which the event should be detached
/// @param[in] userTrigger the user trigger which emits the event
void iox_listener_detach_user_trigger_event(iox_listener_t const self, iox_user_trigger_t const userTrigger);


/// @brief Returns the size, the number of attached events of a listener.
/// @param[in] self listener where the size should be acquired
/// @return the size of the listener
uint64_t iox_listener_size(iox_listener_t const self);

/// @brief Returns the capacity of a listener (how many events can be attached).
/// @param[in] self listener where the capacity should be acquired
/// @return the capacity of the listener
uint64_t iox_listener_capacity(iox_listener_t const self);

#endif
5 changes: 5 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/service_description.h"
#include "iceoryx_binding_c/types.h"

/// @brief publisher handle
Expand Down Expand Up @@ -116,4 +117,8 @@ bool iox_pub_is_offered(iox_pub_t const self);
/// @return true if there are subscribers otherwise false
bool iox_pub_has_subscribers(iox_pub_t const self);

/// @brief returns the service description of the publisher
/// @param[in] self handle to the publisher
/// @return the service description
iox_service_description_t iox_pub_get_service_description(iox_pub_t const self);
#endif
33 changes: 33 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/service_description.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_BINDING_C_SERVICE_DESCRIPTION_H
#define IOX_BINDING_C_SERVICE_DESCRIPTION_H

#include <stdint.h>

typedef struct
{
uint16_t serviceId;
uint16_t instanceId;
uint16_t eventId;

char serviceString[100U];
char instanceString[100U];
char eventString[100U];
} iox_service_description_t;

#endif
5 changes: 5 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/service_description.h"
#include "iceoryx_binding_c/types.h"

/// @brief Subscriber handle
Expand Down Expand Up @@ -117,4 +118,8 @@ bool iox_sub_has_chunks(iox_sub_t const self);
/// @return true if there are lost chunks due to overflowing queue, otherwise false
bool iox_sub_has_lost_chunks(iox_sub_t const self);

/// @brief returns the service description of the subscriber
/// @param[in] self handle to the subscriber
/// @return the service description
iox_service_description_t iox_sub_get_service_description(iox_sub_t const self);
#endif
12 changes: 11 additions & 1 deletion iceoryx_binding_c/include/iceoryx_binding_c/types.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2020 - 2021 Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -66,4 +67,13 @@ struct iox_pub_storage_t_
};
typedef struct iox_pub_storage_t_ iox_pub_storage_t;

struct iox_listener_storage_t_
{
// the value of the array size is the result of the following formula:
// sizeof(WaitSet) / 8
uint64_t do_not_touch_me[2567];
};
typedef struct iox_listener_storage_t_ iox_listener_storage_t;


#endif
4 changes: 3 additions & 1 deletion iceoryx_binding_c/include/iceoryx_binding_c/wait_set.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2020 - 2021 Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -22,6 +23,7 @@
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/subscriber.h"
#include "iceoryx_binding_c/types.h"
#include "iceoryx_binding_c/user_trigger.h"

#include <time.h>

Expand Down
Loading

0 comments on commit 5503df4

Please sign in to comment.