33 template <
class CommonBaseT,
class ClassT>
39 "The class has to inherit the common base class");
48 template <
class MemberType>
50 const std::string& name);
53 template <
class BaseClassType>
73 const CommonBaseT* ptr);
81 std::vector<std::function<void(
const ClassType*,
T&)>> functions;
83 for (std::size_t idxEntr = 0; idxEntr <
GetEntries().size(); ++idxEntr)
85 for (std::size_t idxField = 0;
86 idxField <
GetEntries().at(idxEntr).getNumberOfFields();
89 functions.emplace_back(
90 [idxEntr, idxField](
const ClassType* classptr,
T& out)
102 KeyValueVector<std::string, Entry> entries;
103 std::set<std::string> addedBases;
110 template <
class CommonBaseT,
class ClassT>
111 template <
class MemberType>
112 typename ClassMemberInfo<CommonBaseT, ClassT>::template EntryConfigurator<ClassT>
114 const std::string& name)
118 entries.add(name,
Entry(name, ptr));
119 return entries.at(name);
122 template <
class CommonBaseT,
class ClassT>
123 template <
class BaseClassType>
133 "The base class has to inherit the common base class");
135 "The base class has to be a base class");
137 "The base class has must not be the class");
139 std::set<std::string> basesAddedInCall;
146 if (!addedBases.count(e.getClassName()))
149 <<
"Adding the base class '" << GetTypeString<BaseClassType>()
150 <<
"' adds an entry for the member '" << e.getMemberName()
151 <<
"' which already was added by class '"
152 << entries.at(e.getMemberName()).getClassName() <<
"'";
153 basesAddedInCall.emplace(e.getClassName());
154 entries.add(e.getMemberName(), e);
157 addedBases.insert(basesAddedInCall.begin(), basesAddedInCall.end());
160 template <
class CommonBaseT,
class ClassT>
161 std::vector<std::string>
165 std::vector<std::string> dataFieldNames;
166 dataFieldNames.reserve(GetNumberOfDataFields());
169 for (std::size_t i = 0; i < e.getNumberOfFields(); ++i)
171 dataFieldNames.emplace_back(e.getFieldName(i));
175 return dataFieldNames;
178 template <
class CommonBaseT,
class ClassT>
179 std::map<std::string, VariantBasePtr>
181 const CommonBaseT* ptr)
184 std::map<std::string, VariantBasePtr> result;
185 for (
const auto& e : GetEntries().
values())
187 auto newMap = e.toVariants(timestamp, ptr);
188 for (
auto& elem : newMap)
190 if (result.count(elem.first))
192 throw std::invalid_argument{
193 "mergeMaps: newMap would override values from oldMap"};
196 for (
auto& elem : newMap)
198 result[elem.first] = elem.second;
205 template <
class CommonBaseT,
class ClassT>
213 template <
class CommonBaseT,
class ClassT>
217 return GetTypeString<ClassType>();
220 template <
class CommonBaseT,
class ClassT>
224 return GetInstance().entries;
227 template <
class CommonBaseT,
class ClassT>
232 static const std::size_t numberOfDataFields = []
237 n += e.getNumberOfFields();
241 return numberOfDataFields;
244 template <
class CommonBaseT,
class ClassT>
251 static const auto convert = MakeConverter<bool>();
256 template <
class CommonBaseT,
class ClassT>
263 static const auto convert = MakeConverter<Ice::Byte>();
268 template <
class CommonBaseT,
class ClassT>
275 static const auto convert = MakeConverter<Ice::Short>();
280 template <
class CommonBaseT,
class ClassT>
287 static const auto convert = MakeConverter<Ice::Int>();
292 template <
class CommonBaseT,
class ClassT>
299 static const auto convert = MakeConverter<Ice::Long>();
304 template <
class CommonBaseT,
class ClassT>
311 static const auto convert = MakeConverter<Ice::Float>();
316 template <
class CommonBaseT,
class ClassT>
323 static const auto convert = MakeConverter<Ice::Double>();
328 template <
class CommonBaseT,
class ClassT>
335 static const auto convert = MakeConverter<std::string>();
340 template <
class CommonBaseT,
class ClassT>
341 const std::type_info&
347 std::vector<const std::type_info*>
data;
349 for (std::size_t idxEntr = 0; idxEntr < GetEntries().size(); ++idxEntr)
351 const Entry& e = GetEntries().at(idxEntr);
352 for (std::size_t idxField = 0;
353 idxField < GetEntries().at(idxEntr).getNumberOfFields();