Skip to content

Commit db95e91

Browse files
committed
Refs #21129: Uncrustify
Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent 78fc936 commit db95e91

16 files changed

Lines changed: 359 additions & 230 deletions

File tree

include/fastdds/rtps/common/BinaryProperty.h

Lines changed: 166 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -30,149 +30,189 @@ namespace rtps {
3030

3131
class BinaryProperty
3232
{
33-
public:
34-
35-
BinaryProperty() : propagate_(false) {}
36-
37-
BinaryProperty(const BinaryProperty& property) :
38-
name_(property.name_),
39-
value_(property.value_),
40-
propagate_(property.propagate_) {}
41-
42-
BinaryProperty(BinaryProperty&& property) :
43-
name_(std::move(property.name_)),
44-
value_(std::move(property.value_)),
45-
propagate_(property.propagate_) {}
46-
47-
BinaryProperty(const std::string& name,
48-
const std::vector<uint8_t>& value) :
49-
name_(name), value_(value) {}
50-
51-
BinaryProperty(std::string&& name,
52-
std::vector<uint8_t>&& value) :
53-
name_(std::move(name)), value_(std::move(value)) {}
54-
55-
BinaryProperty& operator=(const BinaryProperty& property)
56-
{
57-
name_ = property.name_;
58-
value_ = property.value_;
59-
propagate_ = property.propagate_;
60-
return *this;
61-
}
62-
63-
BinaryProperty& operator=(BinaryProperty&& property)
64-
{
65-
name_ = std::move(property.name_);
66-
value_ = std::move(property.value_);
67-
propagate_ = property.propagate_;
68-
return *this;
69-
}
70-
71-
bool operator==(const BinaryProperty& b) const
72-
{
73-
return (this->name_ == b.name_) &&
74-
(this->value_ == b.value_);
75-
}
76-
77-
void name(const std::string& name)
78-
{
79-
name_ = name;
80-
}
81-
82-
void name(std::string&& name)
83-
{
84-
name_ = std::move(name);
85-
}
86-
87-
const std::string& name() const
88-
{
89-
return name_;
90-
}
91-
92-
std::string& name()
93-
{
94-
return name_;
95-
}
96-
97-
void value(const std::vector<uint8_t>& value)
98-
{
99-
value_ = value;
100-
}
101-
102-
void value(std::vector<uint8_t>&& value)
103-
{
104-
value_ = std::move(value);
105-
}
106-
107-
const std::vector<uint8_t>& value() const
108-
{
109-
return value_;
110-
}
111-
112-
std::vector<uint8_t>& value()
113-
{
114-
return value_;
115-
}
116-
117-
void propagate(bool propagate)
118-
{
119-
propagate_ = propagate;
120-
}
121-
122-
bool propagate() const
123-
{
124-
return propagate_;
125-
}
126-
127-
bool& propagate()
128-
{
129-
return propagate_;
130-
}
131-
132-
private:
133-
134-
std::string name_;
135-
136-
std::vector<uint8_t> value_;
137-
138-
bool propagate_;
33+
public:
34+
35+
BinaryProperty()
36+
: propagate_(false)
37+
{
38+
}
39+
40+
BinaryProperty(
41+
const BinaryProperty& property)
42+
: name_(property.name_)
43+
, value_(property.value_)
44+
, propagate_(property.propagate_)
45+
{
46+
}
47+
48+
BinaryProperty(
49+
BinaryProperty&& property)
50+
: name_(std::move(property.name_))
51+
, value_(std::move(property.value_))
52+
, propagate_(property.propagate_)
53+
{
54+
}
55+
56+
BinaryProperty(
57+
const std::string& name,
58+
const std::vector<uint8_t>& value)
59+
: name_(name)
60+
, value_(value)
61+
{
62+
}
63+
64+
BinaryProperty(
65+
std::string&& name,
66+
std::vector<uint8_t>&& value)
67+
: name_(std::move(name))
68+
, value_(std::move(value))
69+
{
70+
}
71+
72+
BinaryProperty& operator =(
73+
const BinaryProperty& property)
74+
{
75+
name_ = property.name_;
76+
value_ = property.value_;
77+
propagate_ = property.propagate_;
78+
return *this;
79+
}
80+
81+
BinaryProperty& operator =(
82+
BinaryProperty&& property)
83+
{
84+
name_ = std::move(property.name_);
85+
value_ = std::move(property.value_);
86+
propagate_ = property.propagate_;
87+
return *this;
88+
}
89+
90+
bool operator ==(
91+
const BinaryProperty& b) const
92+
{
93+
return (this->name_ == b.name_) &&
94+
(this->value_ == b.value_);
95+
}
96+
97+
void name(
98+
const std::string& name)
99+
{
100+
name_ = name;
101+
}
102+
103+
void name(
104+
std::string&& name)
105+
{
106+
name_ = std::move(name);
107+
}
108+
109+
const std::string& name() const
110+
{
111+
return name_;
112+
}
113+
114+
std::string& name()
115+
{
116+
return name_;
117+
}
118+
119+
void value(
120+
const std::vector<uint8_t>& value)
121+
{
122+
value_ = value;
123+
}
124+
125+
void value(
126+
std::vector<uint8_t>&& value)
127+
{
128+
value_ = std::move(value);
129+
}
130+
131+
const std::vector<uint8_t>& value() const
132+
{
133+
return value_;
134+
}
135+
136+
std::vector<uint8_t>& value()
137+
{
138+
return value_;
139+
}
140+
141+
void propagate(
142+
bool propagate)
143+
{
144+
propagate_ = propagate;
145+
}
146+
147+
bool propagate() const
148+
{
149+
return propagate_;
150+
}
151+
152+
bool& propagate()
153+
{
154+
return propagate_;
155+
}
156+
157+
private:
158+
159+
std::string name_;
160+
161+
std::vector<uint8_t> value_;
162+
163+
bool propagate_;
139164
};
140165

141166
typedef std::vector<BinaryProperty> BinaryPropertySeq;
142167

143168
class BinaryPropertyHelper
144169
{
145-
public:
170+
public:
146171

147-
static size_t serialized_size(const BinaryProperty& binary_property, size_t current_alignment = 0)
172+
static size_t serialized_size(
173+
const BinaryProperty& binary_property,
174+
size_t current_alignment = 0)
175+
{
176+
if (binary_property.propagate())
148177
{
149-
if(binary_property.propagate())
150-
{
151-
size_t initial_alignment = current_alignment;
178+
size_t initial_alignment = current_alignment;
152179

153-
current_alignment += 4 + alignment(current_alignment, 4) + binary_property.name().size() + 1;
154-
current_alignment += 4 + alignment(current_alignment, 4) + binary_property.value().size();
180+
current_alignment += 4 + alignment(current_alignment, 4) + binary_property.name().size() + 1;
181+
current_alignment += 4 + alignment(current_alignment, 4) + binary_property.value().size();
155182

156-
return current_alignment - initial_alignment;
157-
}
158-
else
159-
return 0;
183+
return current_alignment - initial_alignment;
160184
}
161-
162-
static size_t serialized_size(const BinaryPropertySeq& binary_properties, size_t current_alignment = 0)
185+
else
163186
{
164-
size_t initial_alignment = current_alignment;
187+
return 0;
188+
}
189+
}
165190

166-
current_alignment += 4 + alignment(current_alignment, 4);
167-
for(auto binary_property = binary_properties.begin(); binary_property != binary_properties.end(); ++binary_property)
168-
current_alignment += serialized_size(*binary_property, current_alignment);
191+
static size_t serialized_size(
192+
const BinaryPropertySeq& binary_properties,
193+
size_t current_alignment = 0)
194+
{
195+
size_t initial_alignment = current_alignment;
169196

170-
return current_alignment - initial_alignment;
197+
current_alignment += 4 + alignment(current_alignment, 4);
198+
for (auto binary_property = binary_properties.begin(); binary_property != binary_properties.end();
199+
++binary_property)
200+
{
201+
current_alignment += serialized_size(*binary_property, current_alignment);
171202
}
172203

173-
private:
204+
return current_alignment - initial_alignment;
205+
}
206+
207+
private:
208+
209+
inline static size_t alignment(
210+
size_t current_alignment,
211+
size_t dataSize)
212+
{
213+
return (dataSize - (current_alignment % dataSize)) & (dataSize - 1);
214+
}
174215

175-
inline static size_t alignment(size_t current_alignment, size_t dataSize) { return (dataSize - (current_alignment % dataSize)) & (dataSize-1);}
176216
};
177217

178218
} //namespace rtps

include/fastdds/rtps/reader/ReaderDiscoveryInfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct ReaderDiscoveryInfo
3737

3838
//!Enum DISCOVERY_STATUS, four different status for discovered readers.
3939
//!@ingroup RTPS_MODULE
40+
// *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ;
41+
// at the end of the enum, which does not build.
4042
#if defined(_WIN32)
4143
enum FASTDDS_EXPORTED_API DISCOVERY_STATUS
4244
#else
@@ -48,7 +50,7 @@ struct ReaderDiscoveryInfo
4850
REMOVED_READER,
4951
IGNORED_READER
5052
};
51-
53+
// *INDENT-ON*
5254
ReaderDiscoveryInfo(
5355
const ReaderProxyData& data)
5456
: status(DISCOVERED_READER)

include/fastdds/rtps/resources/ResourceManagement.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@
2121
#define _FASTDDS_RTPS_RESOURCE_MANAGEMENT_H_
2222

2323

24-
namespace eprosima{
25-
namespace fastdds{
26-
namespace rtps{
24+
namespace eprosima {
25+
namespace fastdds {
26+
namespace rtps {
2727

2828
/**
2929
* Enum MemoryuManagementPolicy_t, indicated the way memory is managed in terms of dealing with CacheChanges
3030
*/
3131

32-
typedef enum MemoryManagementPolicy{
32+
typedef enum MemoryManagementPolicy
33+
{
3334
PREALLOCATED_MEMORY_MODE, //!< Preallocated memory. Size set to the data type maximum. Largest memory footprint but smallest allocation count.
3435
PREALLOCATED_WITH_REALLOC_MEMORY_MODE, //!< Default size preallocated, requires reallocation when a bigger message arrives. Smaller memory footprint at the cost of an increased allocation count.
3536
DYNAMIC_RESERVE_MEMORY_MODE, //< Dynamic allocation at the time of message arrival. Least memory footprint but highest allocation count.
@@ -38,7 +39,7 @@ typedef enum MemoryManagementPolicy{
3839

3940

4041
} // end namespaces
41-
}
42-
}
42+
} // namespace fastdds
43+
} // namespace eprosima
4344

4445
#endif /* _FASTDDS_RTPS_RESOURCE_MANAGEMENT_H_ */

include/fastdds/rtps/writer/WriterDiscoveryInfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct WriterDiscoveryInfo
3535

3636
//!Enum DISCOVERY_STATUS, four different status for discovered writers.
3737
//!@ingroup RTPS_MODULE
38+
// *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ;
39+
// at the end of the enum, which does not build.
3840
#if defined(_WIN32)
3941
enum FASTDDS_EXPORTED_API DISCOVERY_STATUS
4042
#else
@@ -46,7 +48,7 @@ struct WriterDiscoveryInfo
4648
REMOVED_WRITER,
4749
IGNORED_WRITER
4850
};
49-
51+
// *INDENT-ON*
5052
WriterDiscoveryInfo(
5153
const WriterProxyData& data)
5254
: status(DISCOVERED_WRITER)

0 commit comments

Comments
 (0)