23 template <
typename ObjectTypeBasePtr>
50 template <
typename ObjectTypeBasePtr, LibraryObjectFactoryPtrType<ObjectTypeBasePtr>...>
73 template <
typename ObjectTypeBasePtr>
88 : ObjectFactoryPtr(ObjectFactoryPtr), ConfigFactoryPtr(ConfigFactoryPtr),
89 Name(Name), Category(Category)
106 template <
typename ObjectTypeBasePtr,
107 typename ObjFactories,
108 typename ConfFactories,
110 typename ObjCategories
122 template <
typename ObjectTypeBasePtr,
144 std::sort(Entries.begin(), Entries.end(), [](
const auto& a,
const auto& b) constexpr {
145 using ct = std::char_traits<char>;
148 const auto CategoryDiff = ct::compare(a.Category, b.Category,
149 std::min(ct::length(a.Category), ct::length(b.Category)));
152 if (CategoryDiff == 0)
153 return std::lexicographical_compare(a.Name, a.Name + ct::length(a.Name),
154 b.Name, b.Name + ct::length(b.Name));
156 return CategoryDiff < 0;
167 constexpr
const auto&
GetLibrary() const noexcept {
return Entries; }
175 return std::vector<LibraryEntry<ObjectTypeBasePtr>>(Entries.cbegin(), Entries.cend());
182 std::array<LibraryEntry<ObjectTypeBasePtr>,
sizeof...(ObjFactories)> Entries;
191 template <
typename... HardwareAdapterTypes>
193 HardwareAdapterPtrType,
194 LibraryObjectFactoryParamList<HardwareAdapterPtrType, &MakeHardwareAdapter<HardwareAdapterTypes>...>,
195 LibraryConfigFactoryParamList<&MakeHardwareAdapterConfig<HardwareAdapterTypes>...>,
196 LibraryStringParamList<&HardwareAdapterTypes::Name...>,
197 LibraryStringParamList<&HardwareAdapterTypes::Category...>
212 template <
typename... InstrumentTypes>
215 LibraryObjectFactoryParamList<InstrumentPtrType, &MakeInstrument<InstrumentTypes>...>,
216 LibraryConfigFactoryParamList<&MakeInstrumentConfig<InstrumentTypes>...>,
217 LibraryStringParamList<&InstrumentTypes::Name...>,
218 LibraryStringParamList<&InstrumentTypes::Category...>
233 template <
typename... ModuleTypes>
236 LibraryObjectFactoryParamList<ModulePtrType, &MakeModule<ModuleTypes>...>,
237 LibraryConfigFactoryParamList<&MakeModuleConfig<ModuleTypes>...>,
238 LibraryStringParamList<&ModuleTypes::Name...>,
239 LibraryStringParamList<&ModuleTypes::Category...>
257 template <
typename LibraryVectorT>
259 const std::string& Category,
const std::string& Name)
261 auto Result = std::find_if(LibraryVector.cbegin(), LibraryVector.cend(),
262 [&Category, &Name](
const auto& LibEntry) {
263 return Category == std::string(LibEntry.Category) && Name == std::string(LibEntry.Name);
266 if (Result == LibraryVector.cend())
268 +
") has not been found in the given library vector.");
Implementation of DynExp hardware adapter objects.
Implementation of DynExp instrument objects.
Implementation of DynExp module objects.
Represents a hardware adapter library to generate instances of classes derived from DynExp::HardwareA...
Represents an instrument library to generate instances of classes derived from DynExp::InstrumentBase...
constexpr LibraryBase()
Constructs a library and fills its entry array from its type information. The entry array is sorted i...
constexpr const auto & GetLibrary() const noexcept
Returns the library entry array.
auto ToVector() const
Converts the library entries to a std::vector.
Represents a module library to generate instances of classes derived from DynExp::ModuleBase.
static std::string CategoryAndNameToStr(const std::string &Category, const std::string &Name)
Builds a string from an Object's category and name to allow the user to identify an Object's type.
Thrown when a requested ressource does not exist.
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::vector< LibraryEntry< InstrumentPtrType > > InstrumentLibraryVectorType
Alias for the vector type containing entries of a instrument library.
std::vector< LibraryEntry< HardwareAdapterPtrType > > HardwareAdapterLibraryVectorType
Alias for the vector type containing entries of a hardware adapter library.
const char * LibraryStringType
String type used for library entry descriptors.
ObjectTypeBasePtr(*)(const std::thread::id, ParamsBasePtrType &&) LibraryObjectFactoryPtrType
Alias for a factory function pointer type that instantiates library entries to create DynExp objects ...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
LibraryStringType(*)() LibraryStringParamPtrType
Pointer to a DynExp object's static constexpr function returning a string literal....
std::shared_ptr< ConfiguratorBase > ConfiguratorBasePtrType
Alias for a pointer to the configurator base class ConfiguratorBase.
ConfiguratorBasePtrType(*)() LibraryConfigFactoryPtrType
Alias for a factory function pointer type that creates a configurator for a specific library entry....
const LibraryVectorT::value_type & FindInLibraryVector(const LibraryVectorT &LibraryVector, const std::string &Category, const std::string &Name)
Finds an entry in a library vector by category and name.
std::vector< LibraryEntry< ModulePtrType > > ModuleLibraryVectorType
Alias for the vector type containing entries of a module library.
Represents the base class for a library containing library entries (DynExp::LibraryEntry).
Type consisting of function pointer types returning configurators for DynExp objects....
Type consisting of function pointer types instantiating DynExp objects. Refer to DynExp::LibraryObjec...
Type consisting of function pointer types returning string literals. Refer to DynExp::LibraryStringPa...
Accumulates include statements to provide a precompiled header.
Represents an entry in the library.
constexpr LibraryEntry(const LibraryObjectFactoryPtrType< ObjectTypeBasePtr > ObjectFactoryPtr, const LibraryConfigFactoryPtrType ConfigFactoryPtr, const LibraryStringType Name, const LibraryStringType Category) noexcept
Constructs a library entry.
LibraryConfigFactoryPtrType ConfigFactoryPtr
Refer to LibraryEntry::LibraryEntry()
LibraryStringType Category
Refer to LibraryEntry::LibraryEntry()
LibraryObjectFactoryPtrType< ObjectTypeBasePtr > ObjectFactoryPtr
Refer to LibraryEntry::LibraryEntry()
LibraryStringType Name
Refer to LibraryEntry::LibraryEntry()