File: c_notification_info.cpp

package info (click to toggle)
iceoryx 2.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,260 kB
  • sloc: cpp: 94,127; ansic: 1,443; sh: 1,436; python: 1,377; xml: 80; makefile: 61
file content (95 lines) | stat: -rw-r--r-- 3,181 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright (c) 2020 - 2022 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

#include "iceoryx_binding_c/internal/cpp2c_subscriber.hpp"
#include "iceoryx_posh/popo/notification_info.hpp"
#include "iceoryx_posh/popo/untyped_client.hpp"
#include "iceoryx_posh/popo/untyped_server.hpp"
#include "iceoryx_posh/popo/user_trigger.hpp"
#include "iceoryx_posh/runtime/service_discovery.hpp"

using namespace iox;
using namespace iox::popo;
using namespace iox::runtime;

extern "C" {
#include "iceoryx_binding_c/notification_info.h"
}

#include <type_traits>

uint64_t iox_notification_info_get_notification_id(iox_notification_info_t const self)
{
    return self->getNotificationId();
}

bool iox_notification_info_does_originate_from_subscriber(iox_notification_info_t const self,
                                                          iox_sub_t const subscriber)
{
    return self->doesOriginateFrom(subscriber);
}

bool iox_notification_info_does_originate_from_user_trigger(iox_notification_info_t const self,
                                                            iox_user_trigger_t const user_trigger)
{
    return self->doesOriginateFrom(user_trigger);
}

bool iox_notification_info_does_originate_from_client(iox_notification_info_t const self, iox_client_t const client)
{
    return self->doesOriginateFrom(client);
}

bool iox_notification_info_does_originate_from_server(iox_notification_info_t const self, iox_server_t const server)
{
    return self->doesOriginateFrom(server);
}

bool iox_notification_info_does_originate_from_service_discovery(iox_notification_info_t const self,
                                                                 iox_service_discovery_t const serviceDiscovery)
{
    return self->doesOriginateFrom(serviceDiscovery);
}

iox_sub_t iox_notification_info_get_subscriber_origin(iox_notification_info_t const self)
{
    return self->getOrigin<cpp2c_Subscriber>();
}

iox_user_trigger_t iox_notification_info_get_user_trigger_origin(iox_notification_info_t const self)
{
    return self->getOrigin<UserTrigger>();
}

iox_client_t iox_notification_info_get_client_origin(iox_notification_info_t const self)
{
    return self->getOrigin<UntypedClient>();
}

iox_server_t iox_notification_info_get_server_origin(iox_notification_info_t const self)
{
    return self->getOrigin<UntypedServer>();
}

iox_service_discovery_t iox_notification_info_get_service_discovery_origin(iox_notification_info_t const self)
{
    return self->getOrigin<ServiceDiscovery>();
}

void iox_notification_info_call(iox_notification_info_t const self)
{
    (*self)();
}