Skip to content

Commit

Permalink
[#210] Restructure examples as preparation for C binding
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed May 17, 2024
1 parent 874dcf2 commit c2c4a40
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 22 deletions.
4 changes: 2 additions & 2 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## How To Send Data Where The Size Is Unknown At Compilation-Time?

Take a look at the
[publish-subscribe dynamic data size example](examples/examples/publish_subscribe_dynamic_data_size).
[publish-subscribe dynamic data size example](examples/rust/publish_subscribe_dynamic_data_size).

The idea is to create a service based on a slice and define at runtime a `max_slice_len`. Then
samples up to a length of the max slice length can be allocated with `loan_slice{_uninit}`. When it
Expand All @@ -28,7 +28,7 @@ go out of scope. This is not the case when the application is:

iceoryx2 already provides a mechanism that registers a signal handler that
handles termination requests gracefully, see
[publish subscribe example](examples/examples/publish_subscribe) and
[publish subscribe example](examples/rust/publish_subscribe) and

```rust
while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) {
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
```

This example is a simplified version of the
[publish-subscribe example](examples/examples/publish_subscribe/). You can
[publish-subscribe example](examples/rust/publish_subscribe/). You can
execute it by opening two terminals and calling:

**Terminal 1:**
Expand Down Expand Up @@ -236,7 +236,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
```

This example is a simplified version of the
[event example](examples/examples/event/). You can
[event example](examples/rust/event/). You can
execute it by opening two terminals and calling:

**Terminal 1:**
Expand Down
20 changes: 10 additions & 10 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,47 @@ iceoryx2 = { workspace = true }
iceoryx2-bb-container = { workspace = true }

[lib]
name = "transmission_data"
path = "src/transmission_data.rs"
name = "examples_common"
path = "rust/_examples_common/lib.rs"

# complex data types

[[example]]
name = "complex_data_types"
path = "examples/complex_data_types/complex_data_types.rs"
path = "rust/complex_data_types/complex_data_types.rs"

# discovery

[[example]]
name = "discovery"
path = "examples/discovery/discovery.rs"
path = "rust/discovery/discovery.rs"

# event

[[example]]
name = "event_listener"
path = "examples/event/listener.rs"
path = "rust/event/listener.rs"

[[example]]
name = "event_notifier"
path = "examples/event/notifier.rs"
path = "rust/event/notifier.rs"

# publish_subscribe

[[example]]
name = "publish_subscribe_publisher"
path = "examples/publish_subscribe/publisher.rs"
path = "rust/publish_subscribe/publisher.rs"

[[example]]
name = "publish_subscribe_subscriber"
path = "examples/publish_subscribe/subscriber.rs"
path = "rust/publish_subscribe/subscriber.rs"

# publish_subscribe_dynamic_data

[[example]]
name = "publish_subscribe_dyn_publisher"
path = "examples/publish_subscribe_dynamic_data/publisher.rs"
path = "rust/publish_subscribe_dynamic_data/publisher.rs"

[[example]]
name = "publish_subscribe_dyn_subscriber"
path = "examples/publish_subscribe_dynamic_data/subscriber.rs"
path = "rust/publish_subscribe_dynamic_data/subscriber.rs"
12 changes: 6 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ they interact and exchange data.

| Name | Description |
|------|-------------|
| [complex data types](examples/complex_data_types) | Send zero-copy compatible versions of `Vec`, `String`, .... |
| [discovery](examples/discovery) | List all available services in a system. |
| [docker](examples/docker) | Communicate between different docker containers and the host. |
| [event](examples/event) | Exchanging event signals between multiple processes.|
| [publish subscribe](examples/publish_subscribe) | Communication between multiple processes with a [publish subscribe messaging pattern](https://en.wikipedia.org/wiki/Publish–subscribe_pattern). |
| [publish subscribe dynamic data](examples/publish_subscribe_dynamic_data) | Communication between multiple processes with a [publish subscribe messaging pattern](https://en.wikipedia.org/wiki/Publish–subscribe_pattern) and payload data that has a dynamic size. |
| [complex data types](rust/complex_data_types) | Send zero-copy compatible versions of `Vec`, `String`, .... |
| [discovery](rust/discovery) | List all available services in a system. |
| [docker](rust/docker) | Communicate between different docker containers and the host. |
| [event](rust/event) | Exchanging event signals between multiple processes.|
| [publish subscribe](rust/publish_subscribe) | Communication between multiple processes with a [publish subscribe messaging pattern](https://en.wikipedia.org/wiki/Publish–subscribe_pattern). |
| [publish subscribe dynamic data](rust/publish_subscribe_dynamic_data) | Communication between multiple processes with a [publish subscribe messaging pattern](https://en.wikipedia.org/wiki/Publish–subscribe_pattern) and payload data that has a dynamic size. |

14 changes: 14 additions & 0 deletions examples/rust/_examples_common/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2023 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available under the
// terms of the Apache Software License 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
// which is available at https://opensource.org/licenses/MIT.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT

mod transmission_data;
pub use transmission_data::TransmissionData;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use core::time::Duration;
use examples_common::TransmissionData;
use iceoryx2::prelude::*;
use transmission_data::TransmissionData;

const CYCLE_TIME: Duration = Duration::from_secs(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use core::time::Duration;
use examples_common::TransmissionData;
use iceoryx2::prelude::*;
use transmission_data::TransmissionData;

const CYCLE_TIME: Duration = Duration::from_secs(1);

Expand Down

0 comments on commit c2c4a40

Please sign in to comment.