Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move publisher and subscriber get_keyexpr implementation from impl.hxx to api.hxx #87

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,35 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
path: zenoh-cpp

- name: install zenoh-cpp
shell: bash
run: |
mkdir -p build_install && cd build_install
cmake ../install -DCMAKE_INSTALL_PREFIX=~/local
cmake ../zenoh-cpp/install -DCMAKE_INSTALL_PREFIX=~/local
cmake --install .

- name: make examples
shell: bash
run: |
mkdir -p build && cd build
cmake ..
cmake ../zenoh-cpp
cmake --build . --target examples

- name: make examples with zenoh-cpp as subbroject
shell: bash
run: |
mkdir -p build_examples_subproj && cd build_examples_subproj
cmake ../examples -DCMAKE_BUILD_TYPE=Debug
cmake ../zenoh-cpp/examples -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug

- name: make examples with zenoh-cpp as installed package
shell: bash
run: |
mkdir -p build_examples_findproj && cd build_examples_findproj
cmake ../examples -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local -DZENOHCXX_SOURCE=PACKAGE
cmake ../zenoh-cpp/examples -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local -DZENOHCXX_SOURCE=PACKAGE
cmake --build . --config Release

- name: make tests
Expand All @@ -62,6 +64,28 @@ jobs:
cd build
ctest

# build zenoh-c and standalone project that needs zenoh-cpp and zenoh-c
# probably this belongs in a different action yaml
- name: get zenoh-c
uses: actions/checkout@v3
with:
repository: eclipse-zenoh/zenoh-c
path: zenoh-c

- name: install zenoh-c
shell: bash
run: |
mkdir -p zenohc_build_install && cd zenohc_build_install
cmake ../zenoh-c -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --target install --config Release

- name: make standalone example with zenoh-cpp as installed package
shell: bash
run: |
mkdir -p build_examples_standalone_findproj && cd build_examples_standalone_findproj
cmake ../zenoh-cpp/examples/standalone -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --config Release

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand Down
9 changes: 9 additions & 0 deletions examples/standalone/CMakeLists.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly repeats functionality of tests https://github.com/eclipse-zenoh/zenoh-cpp/tree/main/examples/simple
Though I like the name 'standalone' and agree that example in 'simple' can be made a bit more simple

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project(zenoh_foo)

find_package(zenohc REQUIRED)
find_package(zenohcxx REQUIRED)

add_executable(foo main.cpp foo.cpp)
target_link_libraries(foo zenohcxx::zenohc::lib)
set_property(TARGET foo PROPERTY CXX_STANDARD 17)
4 changes: 4 additions & 0 deletions examples/standalone/foo.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's the purpose of this additional .cpp file? Also all other files in project have .cxx extension

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A, ok, I see, that's to test the linker error on multiple include. Anyway better to mention this explicitly and do this in tests instead of examples.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <iostream>
#include <zenohc.hxx>

#include "foo.hpp"
6 changes: 6 additions & 0 deletions examples/standalone/foo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef FOO_HXX
#define FOO_HXX

#include "zenohc.hxx"

#endif // FOO_HXX
10 changes: 10 additions & 0 deletions examples/standalone/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <iostream>

#include <zenohc.hxx>

#include "foo.hpp"

int main()
{
return 0;
}
4 changes: 2 additions & 2 deletions include/zenohcxx/api.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,7 @@ class Subscriber : public Owned<::z_owned_subscriber_t> {
#ifdef __ZENOHCXX_ZENOHC
/// @brief Get the key expression of the subscriber
/// @return ``zenoh::KeyExpr`` value
z::KeyExpr get_keyexpr() const;
z::KeyExpr get_keyexpr() const { return ::z_subscriber_keyexpr(loan()); }
#endif
};

Expand Down Expand Up @@ -1701,7 +1701,7 @@ class Publisher : public Owned<::z_owned_publisher_t> {
#ifdef __ZENOHCXX_ZENOHC
/// @brief Get the key expression of the publisher
/// @return ``zenoh::KeyExpr`` value
z::KeyExpr get_keyexpr() const;
z::KeyExpr get_keyexpr() const { return ::z_publisher_keyexpr(loan()); }
#endif

#ifdef __ZENOHCXX_ZENOHC
Expand Down
8 changes: 0 additions & 8 deletions include/zenohcxx/impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,6 @@ inline bool z::Publisher::put_owned_impl(z::Payload&& payload, const z::Publishe

#endif

#ifdef __ZENOHCXX_ZENOHC
z::KeyExpr z::Publisher::get_keyexpr() const { return ::z_publisher_keyexpr(loan()); }
#endif

#ifdef __ZENOHCXX_ZENOHC
z::KeyExpr z::Subscriber::get_keyexpr() const { return ::z_subscriber_keyexpr(loan()); }
#endif

inline bool scout(z::ScoutingConfig&& config, ClosureHello&& callback, ErrNo& error) {
auto c = config.take();
auto cb = callback.take();
Expand Down
Loading