Fast DDS  Version 3.0.1
Fast DDS
Loading...
Searching...
No Matches
PropertyPolicy.hpp
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
18#ifndef FASTDDS_RTPS_ATTRIBUTES__PROPERTYPOLICY_HPP
19#define FASTDDS_RTPS_ATTRIBUTES__PROPERTYPOLICY_HPP
20
21#include <fastdds/rtps/common/Property.hpp>
22#include <fastdds/rtps/common/BinaryProperty.hpp>
23#include <fastdds/fastdds_dll.hpp>
24
25namespace eprosima {
26namespace fastdds {
27namespace rtps {
28
30{
31public:
32
33 FASTDDS_EXPORTED_API PropertyPolicy()
34 {
35 }
36
37 FASTDDS_EXPORTED_API PropertyPolicy(
38 const PropertyPolicy& property_policy)
39 : properties_(property_policy.properties_)
40 , binary_properties_(property_policy.binary_properties_)
41 {
42 }
43
44 FASTDDS_EXPORTED_API PropertyPolicy(
45 PropertyPolicy&& property_policy)
46 : properties_(std::move(property_policy.properties_))
47 , binary_properties_(std::move(property_policy.binary_properties_))
48 {
49 }
50
51 FASTDDS_EXPORTED_API PropertyPolicy& operator =(
52 const PropertyPolicy& property_policy)
53 {
54 properties_ = property_policy.properties_;
55 binary_properties_ = property_policy.binary_properties_;
56 return *this;
57 }
58
59 FASTDDS_EXPORTED_API PropertyPolicy& operator =(
60 PropertyPolicy&& property_policy)
61 {
62 properties_ = std::move(property_policy.properties_);
63 binary_properties_ = std::move(property_policy.binary_properties_);
64 return *this;
65 }
66
67 FASTDDS_EXPORTED_API bool operator ==(
68 const PropertyPolicy& b) const
69 {
70 return (this->properties_ == b.properties_) &&
71 (this->binary_properties_ == b.binary_properties_);
72 }
73
74 FASTDDS_EXPORTED_API bool operator !=(
75 const PropertyPolicy& b) const
76 {
77 return !(*this == b);
78 }
79
81 FASTDDS_EXPORTED_API const PropertySeq& properties() const
82 {
83 return properties_;
84 }
85
87 FASTDDS_EXPORTED_API PropertySeq& properties()
88 {
89 return properties_;
90 }
91
93 FASTDDS_EXPORTED_API const BinaryPropertySeq& binary_properties() const
94 {
95 return binary_properties_;
96 }
97
99 FASTDDS_EXPORTED_API BinaryPropertySeq& binary_properties()
100 {
101 return binary_properties_;
102 }
103
104private:
105
106 PropertySeq properties_;
107
108 BinaryPropertySeq binary_properties_;
109};
110
112{
113public:
114
122 FASTDDS_EXPORTED_API static PropertyPolicy get_properties_with_prefix(
123 const PropertyPolicy& property_policy,
124 const std::string& prefix);
125
127 FASTDDS_EXPORTED_API static size_t length(
128 const PropertyPolicy& property_policy);
129
131 FASTDDS_EXPORTED_API static std::string* find_property(
132 PropertyPolicy& property_policy,
133 const std::string& name);
134
136 FASTDDS_EXPORTED_API static const std::string* find_property(
137 const PropertyPolicy& property_policy,
138 const std::string& name);
139
146 FASTDDS_EXPORTED_API static const Property* get_property(
147 const PropertyPolicy& property_policy,
148 const std::string& name);
149};
150
151} //namespace rtps
152} //namespace fastdds
153} //namespace eprosima
154
155#endif // FASTDDS_RTPS_ATTRIBUTES__PROPERTYPOLICY_HPP
Definition Property.hpp:31
Definition PropertyPolicy.hpp:112
static FASTDDS_EXPORTED_API std::string * find_property(PropertyPolicy &property_policy, const std::string &name)
Look for a property_policy by name.
static FASTDDS_EXPORTED_API const std::string * find_property(const PropertyPolicy &property_policy, const std::string &name)
Retrieves a property_policy by name.
static FASTDDS_EXPORTED_API const Property * get_property(const PropertyPolicy &property_policy, const std::string &name)
Retrieves a property by name.
static FASTDDS_EXPORTED_API size_t length(const PropertyPolicy &property_policy)
Get the length of the property_policy.
static FASTDDS_EXPORTED_API PropertyPolicy get_properties_with_prefix(const PropertyPolicy &property_policy, const std::string &prefix)
Returns only the properties whose name starts with the prefix.
Definition PropertyPolicy.hpp:30
FASTDDS_EXPORTED_API const PropertySeq & properties() const
Get properties.
Definition PropertyPolicy.hpp:81
FASTDDS_EXPORTED_API PropertyPolicy(PropertyPolicy &&property_policy)
Definition PropertyPolicy.hpp:44
FASTDDS_EXPORTED_API const BinaryPropertySeq & binary_properties() const
Get binary_properties.
Definition PropertyPolicy.hpp:93
FASTDDS_EXPORTED_API bool operator==(const PropertyPolicy &b) const
Definition PropertyPolicy.hpp:67
FASTDDS_EXPORTED_API PropertySeq & properties()
Set properties.
Definition PropertyPolicy.hpp:87
FASTDDS_EXPORTED_API PropertyPolicy(const PropertyPolicy &property_policy)
Definition PropertyPolicy.hpp:37
FASTDDS_EXPORTED_API BinaryPropertySeq & binary_properties()
Set binary_properties.
Definition PropertyPolicy.hpp:99
FASTDDS_EXPORTED_API PropertyPolicy & operator=(const PropertyPolicy &property_policy)
Definition PropertyPolicy.hpp:51
FASTDDS_EXPORTED_API bool operator!=(const PropertyPolicy &b) const
Definition PropertyPolicy.hpp:74
FASTDDS_EXPORTED_API PropertyPolicy()
Definition PropertyPolicy.hpp:33
std::vector< Property > PropertySeq
Definition Property.hpp:168
std::vector< BinaryProperty > BinaryPropertySeq
Definition BinaryProperty.hpp:166
eProsima namespace.
Definition EntityId_t.hpp:388