iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
port_pool.inl
1// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// SPDX-License-Identifier: Apache-2.0
17#ifndef IOX_POSH_ROUDI_PORT_POOL_INL
18#define IOX_POSH_ROUDI_PORT_POOL_INL
19
20namespace iox
21{
22namespace roudi
23{
24template <typename T, std::enable_if_t<std::is_same<T, iox::build::ManyToManyPolicy>::value>*>
25inline iox::popo::SubscriberPortData* PortPool::constructSubscriber(const capro::ServiceDescription& serviceDescription,
26 const RuntimeName_t& runtimeName,
27 const popo::SubscriberOptions& subscriberOptions,
28 const mepoo::MemoryInfo& memoryInfo) noexcept
29{
30 return m_portPoolData->m_subscriberPortMembers.insert(
31 serviceDescription,
32 runtimeName,
33 (subscriberOptions.queueFullPolicy == popo::QueueFullPolicy::DISCARD_OLDEST_DATA)
34 ? cxx::VariantQueueTypes::SoFi_MultiProducerSingleConsumer
35 : cxx::VariantQueueTypes::FiFo_MultiProducerSingleConsumer,
36 subscriberOptions,
37 memoryInfo);
38}
39
40template <typename T, std::enable_if_t<std::is_same<T, iox::build::OneToManyPolicy>::value>*>
41inline iox::popo::SubscriberPortData* PortPool::constructSubscriber(const capro::ServiceDescription& serviceDescription,
42 const RuntimeName_t& runtimeName,
43 const popo::SubscriberOptions& subscriberOptions,
44 const mepoo::MemoryInfo& memoryInfo) noexcept
45{
46 return m_portPoolData->m_subscriberPortMembers.insert(
47 serviceDescription,
48 runtimeName,
49 (subscriberOptions.queueFullPolicy == popo::QueueFullPolicy::DISCARD_OLDEST_DATA)
50 ? cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer
51 : cxx::VariantQueueTypes::FiFo_SingleProducerSingleConsumer,
52 subscriberOptions,
53 memoryInfo);
54}
55} // namespace roudi
56} // namespace iox
57
58#endif // IOX_POSH_ROUDI_PORT_POOL_INL