Skip to content

Commit

Permalink
iox-eclipse-iceoryx#252 added skeleton files for posh runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Eltzschig <christian.eltzschig2@de.bosch.com>
  • Loading branch information
elfenpiff committed Aug 19, 2020
1 parent c9109ae commit 5090d9a
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 32 deletions.
3 changes: 2 additions & 1 deletion iceoryx_binding_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ set(${PROJECT_NAME}_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake
#
add_library(${PROJECT_NAME}
STATIC
source/subscriber.cpp
source/binding_c_subscriber.cpp
source/binding_c_posh_runtime.cpp
)
add_library(${PROJECT_NAMESPACE}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

Expand Down
8 changes: 8 additions & 0 deletions iceoryx_binding_c/cmake/iceoryx_binding_cConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
########## dummyConfig.cmake to be able to use find_package with the source tree ##########
#

if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED)
message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "")
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2020 by Robert Bosch GmbH. 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.

#ifndef IOX_BINDING_C_INTERNAL_BINDING_C_POSH_RUNTIME_HPP_
#define IOX_BINDING_C_INTERNAL_BINDING_C_POSH_RUNTIME_HPP_

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef IOX_BINDING_C_INTERNAL_BINDING_C_SUBSCRIBER_HPP_
#define IOX_BINDING_C_INTERNAL_BINDING_C_SUBSCRIBER_HPP_

#include "iceoryx_posh/internal/popo/ports/subscriber_port_data.hpp"
#include "iceoryx_posh/mepoo/chunk_header.hpp"

Expand All @@ -21,3 +24,5 @@ using ChunkHeader = iox::mepoo::ChunkHeader;
extern "C" {
#include "iceoryx_binding_c/subscriber.h"
}

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) 2020 by Robert Bosch GmbH. 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.

#ifndef IOX_BINDING_C_INTERNAL_C2CPP_BRIDGE_HPP_
#define IOX_BINDING_C_INTERNAL_C2CPP_BRIDGE_HPP_

#ifdef __cplusplus
#include <cstdint>

#define CLASS
#define ENUM
#else
#include <stdbool.h>
#include <stdint.h>

#define CLASS struct
#define ENUM enum
#endif

#endif
20 changes: 20 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/posh_runtime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2020 by Robert Bosch GmbH. 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.

#ifndef IOX_BINDING_C_INTERNAL_C2CPP_BRIDGE_H_
#define IOX_BINDING_C_INTERNAL_C2CPP_BRIDGE_H_

#include "internal/c2cpp_bridge.h"

#endif
32 changes: 2 additions & 30 deletions iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,8 @@
#ifndef IOX_BINDING_C_SUBSCRIBER_H_
#define IOX_BINDING_C_SUBSCRIBER_H_


#ifdef __cplusplus
#include <cstdint>

#define CLASS
#define ENUM
#else
#include <stdbool.h>
#include <stdint.h>

#define CLASS struct
#define ENUM enum
#endif

enum subscriber_SubscriptionState
{
NOT_SUBSCRIBED = 0,
SUBSCRIBE_REQUESTED,
SUBSCRIBED,
UNSUBSCRIBE_REQUESTED,
WAIT_FOR_OFFER
};

enum subscriber_AllocateError
{
SUCCESS,
TOO_MANY_CHUNKS_HELD_IN_PARALLEL,
NO_CHUNK_RECEIVED,
INTERNAL_ERROR,
};
#include "iceoryx_binding_c/internal/c2cpp_bridge.h"
#include "iceoryx_binding_c/types.h"

CLASS SubscriberPortData* subscriber_new();
void subscriber_delete(CLASS SubscriberPortData* const self);
Expand Down
36 changes: 36 additions & 0 deletions iceoryx_binding_c/include/iceoryx_binding_c/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2020 by Robert Bosch GmbH. 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.

#ifndef IOX_BINDING_C_TYPES_H_
#define IOX_BINDING_C_TYPES_H_

enum subscriber_SubscriptionState
{
NOT_SUBSCRIBED = 0,
SUBSCRIBE_REQUESTED,
SUBSCRIBED,
UNSUBSCRIBE_REQUESTED,
WAIT_FOR_OFFER
};

enum subscriber_AllocateError
{
SUCCESS,
TOO_MANY_CHUNKS_HELD_IN_PARALLEL,
NO_CHUNK_RECEIVED,
INTERNAL_ERROR,
};


#endif
14 changes: 14 additions & 0 deletions iceoryx_binding_c/source/binding_c_posh_runtime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2020 by Robert Bosch GmbH. 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.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "iceoryx_binding_c/internal/subscriber.hpp"
#include "iceoryx_binding_c/internal/binding_c_subscriber.hpp"
#include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp"

using namespace iox;
Expand Down

0 comments on commit 5090d9a

Please sign in to comment.