Skip to content

Commit 078b245

Browse files
committed
clang tidy + CMakeLists.txt fix
1 parent bfc0538 commit 078b245

File tree

7 files changed

+33
-21
lines changed

7 files changed

+33
-21
lines changed

app/sys/sys_core/src/connection/remote_connection.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,10 @@ namespace eCAL
144144
}
145145
}
146146

147-
eCAL::ServiceResponseVecT service_response_vec;
148147
constexpr int timeout_ms = 1000;
149148

150149
auto client_instances = sys_client_service_.GetClientInstances();
151-
for (auto& client_instance : client_instances)
150+
for (auto& client_instance : client_instances)
152151
{
153152
// TODO: We need to filter for pid as well in the future?
154153
// Currently empty hostname means "all hosts"

lang/python/core/src/ecal_wrap.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ namespace
979979
PyDict_SetItemString(topicDict, "tdatatype_descriptor", val); Py_DECREF(val);
980980

981981
PyObject* layerList = PyList_New(0);
982-
for (auto layer : topic.transport_layer)
982+
for (const auto& layer : topic.transport_layer)
983983
{
984984
PyObject* layerDict = PyDict_New();
985985
PyList_Append(layerList, layerDict); Py_DECREF(layerDict);
@@ -1144,7 +1144,7 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/)
11441144
PyObject* methodsDict = PyDict_New();
11451145
PyDict_SetItemString(serviceDict, "methods", methodsDict); Py_DECREF(methodsDict);
11461146

1147-
for (const auto method : service.methods)
1147+
for (const auto& method : service.methods)
11481148
{
11491149
val = Py_BuildValue("s", method.method_name.c_str());
11501150
PyDict_SetItemString(methodsDict, "mname", val); Py_DECREF(val);
@@ -1207,7 +1207,7 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/)
12071207
PyObject* methodsDict = PyDict_New();
12081208
PyDict_SetItemString(clientDict, "methods", methodsDict); Py_DECREF(methodsDict);
12091209

1210-
for (const auto method : client.methods)
1210+
for (const auto& method : client.methods)
12111211
{
12121212
val = Py_BuildValue("s", method.method_name.c_str());
12131213
PyDict_SetItemString(methodsDict, "mname", val); Py_DECREF(val);

serialization/protobuf/protobuf/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ target_sources(protobuf_core
7777
FILES
7878
include/ecal/msg/protobuf/client.h
7979
include/ecal/msg/protobuf/client_instance.h
80-
include/ecal/msg/protobuf/client_types_response.h
80+
include/ecal/msg/protobuf/client_typed_response.h
8181
include/ecal/msg/protobuf/dynamic_json_subscriber.h
8282
include/ecal/msg/protobuf/dynamic_publisher.h
8383
include/ecal/msg/protobuf/dynamic_subscriber.h

serialization/protobuf/protobuf/include/ecal/msg/protobuf/client.h

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,20 @@ namespace eCAL
7777
{
7878
}
7979

80-
// Delete copy constructor and assignment operator.
80+
/**
81+
* @brief Destructor.
82+
**/
83+
~CServiceClient() override = default;
84+
85+
/**
86+
* @brief CServiceClients are non-movable.
87+
**/
88+
CServiceClient(CServiceClient&& other) = delete;
89+
CServiceClient& operator=(CServiceClient&& other) = delete;
90+
91+
/**
92+
* @brief CServiceClients are non-copyable.
93+
**/
8194
CServiceClient(const CServiceClient&) = delete;
8295
CServiceClient& operator=(const CServiceClient&) = delete;
8396

@@ -119,7 +132,7 @@ namespace eCAL
119132
std::pair<bool, TMsgServiceResponseVecT<ResponseT>> CallWithResponse( const std::string& method_name_, const google::protobuf::Message& request_,
120133
int timeout_ = DEFAULT_TIME_ARGUMENT) const
121134
{
122-
bool all_success = true;
135+
bool overall_success = true;
123136
TMsgServiceResponseVecT<ResponseT> responses;
124137

125138
// Get all client instances.
@@ -130,10 +143,10 @@ namespace eCAL
130143
responses.push_back(std::move(ret.second));
131144
if (!ret.first)
132145
{
133-
all_success = false;
146+
overall_success = false;
134147
}
135148
}
136-
return std::pair<bool, TMsgServiceResponseVecT<ResponseT>>(all_success, responses);
149+
return std::pair<bool, TMsgServiceResponseVecT<ResponseT>>(overall_success, responses);
137150
}
138151

139152
/**
@@ -149,7 +162,7 @@ namespace eCAL
149162
std::pair<bool, ServiceResponseVecT> CallWithResponse(const std::string& method_name_, const google::protobuf::Message& request_,
150163
int timeout_ = DEFAULT_TIME_ARGUMENT) const
151164
{
152-
bool all_success = true;
165+
bool overall_success = true;
153166
ServiceResponseVecT responses;
154167

155168
// Get all client instances.
@@ -160,10 +173,10 @@ namespace eCAL
160173
responses.push_back(std::move(ret.second));
161174
if (!ret.first)
162175
{
163-
all_success = false;
176+
overall_success = false;
164177
}
165178
}
166-
return std::pair<bool, ServiceResponseVecT>(all_success, responses);
179+
return std::pair<bool, ServiceResponseVecT>(overall_success, responses);
167180
}
168181

169182
/**
@@ -268,7 +281,7 @@ namespace eCAL
268281
U temp_instance;
269282
const google::protobuf::ServiceDescriptor* service_descriptor = temp_instance.GetDescriptor();
270283

271-
if (!service_descriptor)
284+
if (service_descriptor == nullptr)
272285
{
273286
throw std::runtime_error("Failed to retrieve service descriptor.");
274287
}
@@ -280,10 +293,10 @@ namespace eCAL
280293
for (int i = 0; i < service_descriptor->method_count(); ++i)
281294
{
282295
const google::protobuf::MethodDescriptor* method_descriptor = service_descriptor->method(i);
283-
std::string method_name = method_descriptor->name();
296+
const std::string& method_name = method_descriptor->name();
284297

285-
std::string request_type_name = method_descriptor->input_type()->name();
286-
std::string response_type_name = method_descriptor->output_type()->name();
298+
const std::string& request_type_name = method_descriptor->input_type()->name();
299+
const std::string& response_type_name = method_descriptor->output_type()->name();
287300

288301
std::string request_type_descriptor;
289302
std::string response_type_descriptor;

serialization/protobuf/protobuf/include/ecal/msg/protobuf/client_instance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace eCAL
5555
class CClientInstance
5656
{
5757
public:
58-
// Constructors
58+
// Constructor
5959
CClientInstance(eCAL::CClientInstance&& base_instance_) noexcept
6060
: m_instance(std::move(base_instance_))
6161
{

serialization/protobuf/samples/services/math_client/src/math_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int main()
8484
eCAL::Initialize("math client");
8585

8686
// Create a math service client using the protobuf service type MathService.
87-
eCAL::protobuf::CServiceClient<MathService> math_client(OnClientState);
87+
const eCAL::protobuf::CServiceClient<MathService> math_client(OnClientState);
8888

8989
// Wait until the client is connected to at least one service.
9090
while (eCAL::Ok() && !math_client.IsConnected())

serialization/protobuf/samples/services/ping_client/src/ping_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main()
3333
eCAL::Initialize("ping client");
3434

3535
// create ping service client
36-
eCAL::protobuf::CServiceClient<PingService> ping_client("ping service");
36+
const eCAL::protobuf::CServiceClient<PingService> ping_client("ping service");
3737

3838
// waiting for service
3939
while (eCAL::Ok() && !ping_client.IsConnected())
@@ -56,7 +56,7 @@ int main()
5656
{
5757
std::cout << std::endl << "PingService::Ping method called with message : " << ping_request.message() << std::endl;
5858

59-
for (auto service_response : ping_response.second)
59+
for (const auto& service_response : ping_response.second)
6060
{
6161
switch (service_response.call_state)
6262
{

0 commit comments

Comments
 (0)