diff --git a/iceoryx_binding_c/CMakeLists.txt b/iceoryx_binding_c/CMakeLists.txt index 47f54821de..739972ffd7 100644 --- a/iceoryx_binding_c/CMakeLists.txt +++ b/iceoryx_binding_c/CMakeLists.txt @@ -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}) diff --git a/iceoryx_binding_c/cmake/iceoryx_binding_cConfig.cmake b/iceoryx_binding_c/cmake/iceoryx_binding_cConfig.cmake new file mode 100644 index 0000000000..1f0f2dbfcf --- /dev/null +++ b/iceoryx_binding_c/cmake/iceoryx_binding_cConfig.cmake @@ -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() diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_posh_runtime.hpp b/iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_posh_runtime.hpp new file mode 100644 index 0000000000..d2e986f5eb --- /dev/null +++ b/iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_posh_runtime.hpp @@ -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 diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/internal/subscriber.hpp b/iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_subscriber.hpp similarity index 88% rename from iceoryx_binding_c/include/iceoryx_binding_c/internal/subscriber.hpp rename to iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_subscriber.hpp index d7e69feabc..8ff740b7d7 100644 --- a/iceoryx_binding_c/include/iceoryx_binding_c/internal/subscriber.hpp +++ b/iceoryx_binding_c/include/iceoryx_binding_c/internal/binding_c_subscriber.hpp @@ -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" @@ -21,3 +24,5 @@ using ChunkHeader = iox::mepoo::ChunkHeader; extern "C" { #include "iceoryx_binding_c/subscriber.h" } + +#endif diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/internal/c2cpp_bridge.h b/iceoryx_binding_c/include/iceoryx_binding_c/internal/c2cpp_bridge.h new file mode 100644 index 0000000000..e2ea04c131 --- /dev/null +++ b/iceoryx_binding_c/include/iceoryx_binding_c/internal/c2cpp_bridge.h @@ -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 + +#define CLASS +#define ENUM +#else +#include +#include + +#define CLASS struct +#define ENUM enum +#endif + +#endif diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/posh_runtime.h b/iceoryx_binding_c/include/iceoryx_binding_c/posh_runtime.h new file mode 100644 index 0000000000..74c2dae5e9 --- /dev/null +++ b/iceoryx_binding_c/include/iceoryx_binding_c/posh_runtime.h @@ -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 diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h b/iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h index 33ba311654..6cc8fd62a6 100644 --- a/iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h +++ b/iceoryx_binding_c/include/iceoryx_binding_c/subscriber.h @@ -15,36 +15,8 @@ #ifndef IOX_BINDING_C_SUBSCRIBER_H_ #define IOX_BINDING_C_SUBSCRIBER_H_ - -#ifdef __cplusplus -#include - -#define CLASS -#define ENUM -#else -#include -#include - -#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); diff --git a/iceoryx_binding_c/include/iceoryx_binding_c/types.h b/iceoryx_binding_c/include/iceoryx_binding_c/types.h new file mode 100644 index 0000000000..76ccedb65d --- /dev/null +++ b/iceoryx_binding_c/include/iceoryx_binding_c/types.h @@ -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 diff --git a/iceoryx_binding_c/source/binding_c_posh_runtime.cpp b/iceoryx_binding_c/source/binding_c_posh_runtime.cpp new file mode 100644 index 0000000000..f95d2c83f4 --- /dev/null +++ b/iceoryx_binding_c/source/binding_c_posh_runtime.cpp @@ -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. + diff --git a/iceoryx_binding_c/source/subscriber.cpp b/iceoryx_binding_c/source/binding_c_subscriber.cpp similarity index 98% rename from iceoryx_binding_c/source/subscriber.cpp rename to iceoryx_binding_c/source/binding_c_subscriber.cpp index 4954332acb..d70df9b7c4 100644 --- a/iceoryx_binding_c/source/subscriber.cpp +++ b/iceoryx_binding_c/source/binding_c_subscriber.cpp @@ -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;