Skip to content

Commit e057249

Browse files
committed
fix(style): Use move semantics to pass std::strings
Signed-off-by: Steffen Vogel <[email protected]>
1 parent d3a4e54 commit e057249

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

include/villas/nodes/opal_orchestra/ddf.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ class Item {
3131
};
3232

3333
class DataItem : public Item {
34-
3534
public:
3635
// Config-time members.
3736
std::string name;
3837
SignalType type;
3938
unsigned short length;
4039
double defaultValue;
4140

42-
DataItem(const std::string &name) : name(name) {}
41+
explicit DataItem(std::string name) : name(std::move(name)) {}
4342

4443
static const unsigned int IDENTIFIER_NAME_LENGTH = 64;
4544

@@ -51,7 +50,7 @@ class BusItem : public Item {
5150
std::unordered_map<std::string, std::shared_ptr<Item>> items;
5251
std::string name;
5352

54-
BusItem(const std::string &name) : items(), name(name) {}
53+
explicit BusItem(std::string name) : items(), name(std::move(name)) {}
5554

5655
std::shared_ptr<DataItem> upsertItem(std::string_view path, bool &inserted);
5756

@@ -63,7 +62,7 @@ class DataSet {
6362
std::unordered_map<std::string, std::shared_ptr<Item>> items;
6463
std::string name;
6564

66-
DataSet(const std::string &name) : items(), name(name) {}
65+
explicit DataSet(std::string name) : items(), name(std::move(name)) {}
6766

6867
std::shared_ptr<DataItem> upsertItem(std::string_view path, bool &inserted);
6968

lib/nodes/opal_orchestra.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class OpalOrchestraMapping {
5353
unsigned int typeSize; // sizeof() of the signal type. See RTSignalType.
5454
unsigned short length;
5555

56-
OpalOrchestraMapping(std::shared_ptr<DataItem> item, const std::string &path)
57-
: item(item), path(path), signals(), signalList(), indices() {}
56+
OpalOrchestraMapping(std::shared_ptr<DataItem> item, std::string path)
57+
: item(item), path(std::move(path)), signals(), signalList(), indices() {}
5858

5959
void addSignal(Signal::Ptr signal, std::optional<unsigned> orchestraIdx) {
6060
if (!orchestraIdx) {

0 commit comments

Comments
 (0)