Coverage Report

Created: 2022-08-24 06:19

/src/Fast-DDS/include/fastrtps/attributes/SubscriberAttributes.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/**
16
 * @file SubscriberAttributes.h
17
 */
18
19
#ifndef SUBSCRIBERATTRIBUTES_H_
20
#define SUBSCRIBERATTRIBUTES_H_
21
22
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
23
#include <fastdds/rtps/attributes/PropertyPolicy.h>
24
#include <fastdds/rtps/attributes/ReaderAttributes.h>
25
#include <fastdds/rtps/common/Time_t.h>
26
#include <fastdds/rtps/common/Locator.h>
27
#include <fastdds/rtps/resources/ResourceManagement.h>
28
#include <fastrtps/attributes/TopicAttributes.h>
29
#include <fastrtps/qos/ReaderQos.h>
30
31
namespace eprosima {
32
namespace fastrtps {
33
34
/**
35
 * Class SubscriberAttributes, used by the user to define the attributes of a Subscriber.
36
 * @ingroup FASTRTPS_ATTRIBUTES_MODULE
37
 */
38
class SubscriberAttributes
39
{
40
public:
41
42
    //! Topic Attributes
43
    TopicAttributes topic;
44
45
    //! Reader QOs.
46
    ReaderQos qos;
47
48
    //! Times for a RELIABLE Reader
49
    rtps::ReaderTimes times;
50
51
    //! Unicast locator list
52
    rtps::LocatorList_t unicastLocatorList;
53
54
    //! Multicast locator list
55
    rtps::LocatorList_t multicastLocatorList;
56
57
    //! Remote locator list
58
    rtps::LocatorList_t remoteLocatorList;
59
60
    //! The collection of external locators to use for communication.
61
    fastdds::rtps::ExternalLocators external_unicast_locators;
62
63
    //! Whether locators that don't match with the announced locators should be kept.
64
    bool ignore_non_matching_locators = false;
65
66
    //! Expects Inline QOS
67
    bool expectsInlineQos = false;
68
69
    //! Underlying History memory policy
70
    rtps::MemoryManagementPolicy_t historyMemoryPolicy = rtps::PREALLOCATED_MEMORY_MODE;
71
72
    //! Properties
73
    rtps::PropertyPolicy properties;
74
75
    //! Matched publishers allocation limits
76
    ResourceLimitedContainerConfig matched_publisher_allocation;
77
78
40.0k
    SubscriberAttributes() = default;
79
80
38.3k
    virtual ~SubscriberAttributes() = default;
81
82
    bool operator ==(
83
            const SubscriberAttributes& b) const
84
0
    {
85
0
        return (this->topic == b.topic) &&
86
0
               (this->qos == b.qos) &&
87
0
               (this->times == b.times) &&
88
0
               (this->unicastLocatorList == b.unicastLocatorList) &&
89
0
               (this->multicastLocatorList == b.multicastLocatorList) &&
90
0
               (this->remoteLocatorList == b.remoteLocatorList) &&
91
0
               (this->historyMemoryPolicy == b.historyMemoryPolicy) &&
92
0
               (this->properties == b.properties);
93
0
    }
94
95
    bool operator !=(
96
            const SubscriberAttributes& b) const
97
0
    {
98
0
        return !(*this == b);
99
0
    }
100
101
    /**
102
     * Get the user defined ID
103
     * @return User defined ID
104
     */
105
    inline int16_t getUserDefinedID() const
106
0
    {
107
0
        return m_userDefinedID;
108
0
    }
109
110
    /**
111
     * Get the entity defined ID
112
     * @return Entity ID
113
     */
114
    inline int16_t getEntityID() const
115
0
    {
116
0
        return m_entityID;
117
0
    }
118
119
    /**
120
     * Set the user defined ID
121
     * @param id User defined ID to be set
122
     */
123
    inline void setUserDefinedID(
124
            uint8_t id)
125
0
    {
126
0
        m_userDefinedID = id;
127
0
    }
128
129
    /**
130
     * Set the entity ID
131
     * @param id Entity ID to be set
132
     */
133
    inline void setEntityID(
134
            uint8_t id)
135
0
    {
136
0
        m_entityID = id;
137
0
    }
138
139
private:
140
141
    //! User Defined ID, used for StaticEndpointDiscovery, default value -1.
142
    int16_t m_userDefinedID = -1;
143
144
    //! Entity ID, if the user want to specify the EntityID of the enpoint, default value -1.
145
    int16_t m_entityID = -1;
146
};
147
148
} /* namespace fastrtps */
149
} /* namespace eprosima */
150
151
#endif /* SUBSCRIBERPARAMS_H_ */