Skip to content

Commit 07ad23f

Browse files
Merge pull request #1221 from sstsimulator/devel
Automatically Merged using SST Master Branch Merger
2 parents dd0c8f0 + 959eb59 commit 07ad23f

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

src/sst/core/eli/elementinfo.cc

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -135,31 +135,5 @@ ProvidesParams::init()
135135
}
136136
}
137137

138-
// ELI combine function for Attributes which don't have a description
139-
// field
140-
void
141-
combineEliInfo(std::vector<ElementInfoAttribute>& base, std::vector<ElementInfoAttribute>& add)
142-
{
143-
std::vector<ElementInfoAttribute> combined;
144-
// Add in any item that isn't already defined
145-
for ( auto x : add ) {
146-
bool add = true;
147-
for ( auto y : base ) {
148-
if ( !strcmp(x.name, y.name) ) {
149-
add = false;
150-
break;
151-
}
152-
}
153-
if ( add ) combined.emplace_back(x);
154-
}
155-
156-
// Now add all the locals. We will skip any one that has nullptr
157-
// in the description field
158-
for ( auto x : base ) {
159-
if ( x.value != nullptr ) { combined.emplace_back(x); }
160-
}
161-
base.swap(combined);
162-
}
163-
164138
} // namespace ELI
165139
} // namespace SST

src/sst/core/eli/elibase.h

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "sst/core/sst_types.h"
1616

17+
#include <algorithm>
1718
#include <cstring>
1819
#include <functional>
1920
#include <list>
@@ -88,7 +89,7 @@ namespace ELI {
8889

8990
// Function used to combine the parent and child ELI information.
9091
// This function only works for items that have a 'name' and a
91-
// 'description' field (which is all of them at time of function
92+
// 'description/value' field (which is all of them at time of function
9293
// writing). You can delete a parent's info by adding an entry in the
9394
// child with the same name and a nullptr in the description. Each
9495
// info item should include a macro of the format SST_ELI_DELETE_* to
@@ -98,34 +99,29 @@ namespace ELI {
9899
// the ElementInfo* classes have const data members so deleting from
99100
// the vector does not compile (copy constructor is deleted).
100101
template <typename T>
101-
static void
102-
combineEliInfo(std::vector<T>& base, std::vector<T>& add)
102+
void
103+
combineEliInfo(std::vector<T>& base, const std::vector<T>& add)
103104
{
104105
std::vector<T> combined;
105106
// Add in any item that isn't already defined
106-
for ( auto x : add ) {
107-
bool add = true;
108-
for ( auto y : base ) {
109-
if ( !strcmp(x.name, y.name) ) {
110-
add = false;
111-
break;
112-
}
113-
}
114-
if ( add ) combined.emplace_back(x);
107+
for ( auto& x : add ) {
108+
if ( std::none_of(base.begin(), base.end(), [&](auto& y) { return !strcmp(x.name, y.name); }) )
109+
combined.emplace_back(x);
115110
}
116111

117112
// Now add all the locals. We will skip any one that has nullptr
118113
// in the description field
119-
for ( auto x : base ) {
120-
if ( x.description != nullptr ) { combined.emplace_back(x); }
114+
for ( auto& x : base ) {
115+
if constexpr ( std::is_same_v<T, ElementInfoAttribute> ) {
116+
if ( x.value != nullptr ) combined.emplace_back(x);
117+
}
118+
else {
119+
if ( x.description != nullptr ) combined.emplace_back(x);
120+
}
121121
}
122122
base.swap(combined);
123123
}
124124

125-
// ELI combine function for Attributes which don't have a description
126-
// field
127-
void combineEliInfo(std::vector<ElementInfoAttribute>& base, std::vector<ElementInfoAttribute>& add);
128-
129125
struct LibraryLoader
130126
{
131127
virtual void load() = 0;

0 commit comments

Comments
 (0)