Coverage Report

Created: 2022-08-24 06:19

/src/Fast-DDS/include/fastrtps/attributes/PublisherAttributes.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 PublisherAttributes.h
17
 */
18
19
#ifndef PUBLISHERATTRIBUTES_H_
20
#define PUBLISHERATTRIBUTES_H_
21
22
#include <fastdds/rtps/resources/ResourceManagement.h>
23
24
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
25
#include <fastdds/rtps/attributes/PropertyPolicy.h>
26
#include <fastdds/rtps/attributes/WriterAttributes.h>
27
#include <fastdds/rtps/common/Locator.h>
28
#include <fastdds/rtps/common/Time_t.h>
29
#include <fastdds/rtps/flowcontrol/ThroughputControllerDescriptor.h>
30
#include <fastrtps/attributes/TopicAttributes.h>
31
#include <fastrtps/qos/WriterQos.h>
32
33
namespace eprosima {
34
namespace fastrtps {
35
36
/**
37
 * Class PublisherAttributes, used by the user to define the attributes of a Publisher.
38
 * @ingroup FASTRTPS_ATTRIBUTES_MODULE
39
 */
40
class PublisherAttributes
41
{
42
public:
43
44
44.0k
    PublisherAttributes() = default;
45
46
42.3k
    virtual ~PublisherAttributes() = default;
47
48
    bool operator ==(
49
            const PublisherAttributes& b) const
50
0
    {
51
0
        return (this->m_userDefinedID == b.m_userDefinedID) &&
52
0
               (this->m_entityID == b.m_entityID) &&
53
0
               (this->topic == b.topic) &&
54
0
               (this->qos == b.qos) &&
55
0
               (this->times == b.times) &&
56
0
               (this->unicastLocatorList == b.unicastLocatorList) &&
57
0
               (this->multicastLocatorList == b.multicastLocatorList) &&
58
0
               (this->remoteLocatorList == b.remoteLocatorList) &&
59
0
               (this->historyMemoryPolicy == b.historyMemoryPolicy) &&
60
0
               (this->properties == b.properties);
61
0
    }
62
63
    //! Topic Attributes for the Publisher
64
    TopicAttributes topic;
65
66
    //! QOS for the Publisher
67
    WriterQos qos;
68
69
    //! Writer Attributes
70
    rtps::WriterTimes times;
71
72
    //! Unicast locator list
73
    rtps::LocatorList_t unicastLocatorList;
74
75
    //! Multicast locator list
76
    rtps::LocatorList_t multicastLocatorList;
77
78
    //! Remote locator list
79
    rtps::LocatorList_t remoteLocatorList;
80
81
    //! The collection of external locators to use for communication.
82
    fastdds::rtps::ExternalLocators external_unicast_locators;
83
84
    //! Whether locators that don't match with the announced locators should be kept.
85
    bool ignore_non_matching_locators = false;
86
87
    //! Throughput controller
88
    rtps::ThroughputControllerDescriptor throughputController;
89
90
    //! Underlying History memory policy
91
    rtps::MemoryManagementPolicy_t historyMemoryPolicy = rtps::MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE;
92
93
    //! Properties
94
    rtps::PropertyPolicy properties;
95
96
    //! Allocation limits on the matched subscribers collections
97
    ResourceLimitedContainerConfig matched_subscriber_allocation;
98
99
    /**
100
     * Get the user defined ID
101
     * @return User defined ID
102
     */
103
    inline int16_t getUserDefinedID() const
104
0
    {
105
0
        return m_userDefinedID;
106
0
    }
107
108
    /**
109
     * Get the entity defined ID
110
     * @return Entity ID
111
     */
112
    inline int16_t getEntityID() const
113
0
    {
114
0
        return m_entityID;
115
0
    }
116
117
    /**
118
     * Set the user defined ID
119
     * @param id User defined ID to be set
120
     */
121
    inline void setUserDefinedID(
122
            uint8_t id)
123
0
    {
124
0
        m_userDefinedID = id;
125
0
    }
126
127
    /**
128
     * Set the entity ID
129
     * @param id Entity ID to be set
130
     */
131
    inline void setEntityID(
132
            uint8_t id)
133
0
    {
134
0
        m_entityID = id;
135
0
    }
136
137
private:
138
139
    //! User Defined ID, used for StaticEndpointDiscovery, default value -1.
140
    int16_t m_userDefinedID = -1;
141
    //! Entity ID, if the user want to specify the EntityID of the enpoint, default value -1.
142
    int16_t m_entityID = -1;
143
};
144
145
} // namespace fastrtps
146
} // namespace eprosima
147
148
#endif /* PUBLISHERATTRIBUTES_H_ */