12#ifndef WSFOBJECTTYPELIST_HPP
13#define WSFOBJECTTYPELIST_HPP
15#include "wsf_export.h"
48 template<
typename DEFAULT_TYPE>
51 return new DEFAULT_TYPE;
60 template<
typename FACTORY_LIST>
63 const FACTORY_LIST& aList = *((FACTORY_LIST*)aListPtr);
64 for (
typename FACTORY_LIST::const_iterator i = aList.begin(); i != aList.end(); ++i)
66 WsfObject* newObjectPtr = (*i)(aTypeName);
67 if (newObjectPtr !=
nullptr)
93 static_assert(std::is_base_of<WsfObject, T>::value,
"Add requires a WsfObject");
94 return AddP(aId, std::move(aDefinitionPtr));
104 static_assert(std::is_base_of<WsfObject, T>::value,
"AddCoreType requires a WsfObject");
105 if (
AddP(aId, std::move(aDefinitionPtr)))
120 static_assert(std::is_base_of<WsfObject, ObjectType>::value,
"Type does not support Clone()");
121 return static_cast<T*
>(
CloneP(aId));
138 typePtrVec.push_back(
static_cast<ObjectType*
>(it->second.get()));
149 for (TypeMap::const_iterator iter =
mTypeMap.begin(); iter !=
mTypeMap.end(); ++iter)
151 aListOfPtrs.push_back(
static_cast<ObjectType*
>(iter->second.get()));
160 for (TypeMap::const_iterator iter =
mTypeMap.begin(); iter !=
mTypeMap.end(); ++iter)
164 aListOfPtrs.push_back(
static_cast<ObjectType*
>(iter->second.get()));
193 template<
typename FACTORY_LIST>
202 template<
typename DEFAULT_TYPE>
217 result.mIsCommandProcessed =
LoadTypeP(aInput, loadedObjectPtr);
218 result.mObjectTypePtr =
static_cast<ObjectType*
>(loadedObjectPtr);
232 return LoadComponentP(aInput, aPlatform, aIsAdding, aRole,
true,
true);
237 return LoadComponentP(aInput, aPlatform, aIsAdding, aRole,
false,
true);
242 return LoadComponentP(aInput, aPlatform, aIsAdding, aRole,
false,
false);
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
TypeMap mTypeMap
Definition WsfObjectTypeListBase.hpp:156
bool DeleteComponentP(UtInput &aInput, WsfPlatform &aPlatform, int aRole, bool aIsNamed)
Definition WsfObjectTypeList.cpp:304
virtual WsfObject * FindP(WsfStringId aId) const
Definition WsfObjectTypeList.cpp:136
bool AddP(WsfStringId aId, std::unique_ptr< WsfObject > aDefinitionPtr)
Definition WsfObjectTypeList.cpp:84
WsfObject * CloneP(WsfStringId aId) const
Definition WsfObjectTypeList.cpp:118
unsigned int mFlags
Definition WsfObjectTypeListBase.hpp:163
bool LoadTypeP(UtInput &aInput, WsfObject *&aLoadedObjectPtr)
Definition WsfObjectTypeList.cpp:164
std::set< WsfStringId > mCoreTypes
Definition WsfObjectTypeListBase.hpp:161
WsfObject *(* mCreateSingularTypeFunction)()
Definition WsfObjectTypeListBase.hpp:167
WsfObject *(* mFactoryCreateFunction)(void *aListPtr, const std::string &aTypeName)
Definition WsfObjectTypeListBase.hpp:168
@ cSINGULAR_BASE_TYPE
Definition WsfObjectTypeListBase.hpp:101
void * mFactoryPtr
Definition WsfObjectTypeListBase.hpp:170
bool LoadComponentP(UtInput &aInput, WsfPlatform &aPlatform, bool aIsAdding, int aRole, bool aIsNamed, bool aIsEditable)
Definition WsfObjectTypeList.cpp:350
WsfObject *(* mFactoryCreateDefault)()
Definition WsfObjectTypeListBase.hpp:169
WsfObjectTypeListBase(const WsfObjectTypeListBase &)=delete
Definition WsfObjectTypeList.hpp:42
ObjectPtrList GetCoreTypes() const
Returns a list of core types, i.e. types added via AddCoreType.
Definition WsfObjectTypeList.hpp:130
T * Find(WsfStringId aId) const override
Definition WsfObjectTypeList.hpp:127
void SetObjectFactory(const FACTORY_LIST *aFactoryListPtr)
Definition WsfObjectTypeList.hpp:194
bool LoadNamedComponent(UtInput &aInput, WsfPlatform &aPlatform, bool aIsAdding, int aRole)
Definition WsfObjectTypeList.hpp:230
void GetCurrentTypes(ObjectPtrList &aListOfPtrs) const
Definition WsfObjectTypeList.hpp:145
static WsfObject * FactoryCreateFunction(void *aListPtr, const std::string &aTypeName)
Definition WsfObjectTypeList.hpp:61
virtual LoadResult LoadType(UtInput &aInput)
Definition WsfObjectTypeList.hpp:213
std::vector< SensorErrorModelBase * > ObjectPtrList
Definition WsfObjectTypeList.hpp:45
bool AddCoreType(WsfStringId aId, std::unique_ptr< T > aDefinitionPtr)
Definition WsfObjectTypeList.hpp:102
bool DeleteUnnamedComponent(UtInput &aInput, WsfPlatform &aPlatform, int aRole)
Definition WsfObjectTypeList.hpp:250
SensorErrorModelBase ObjectType
Definition WsfObjectTypeList.hpp:44
void SetSingularBaseType()
Definition WsfObjectTypeList.hpp:186
bool DeleteNamedComponent(UtInput &aInput, WsfPlatform &aPlatform, int aRole)
Definition WsfObjectTypeList.hpp:245
static WsfObject * CreateFunction()
Definition WsfObjectTypeList.hpp:54
static WsfObject * CreateDefaultFunction()
Definition WsfObjectTypeList.hpp:49
bool InitializeTypeP(WsfObject *aObjectPtr) override
Definition WsfObjectTypeList.hpp:257
bool ProcessInput(UtInput &aInput) override
Definition WsfObjectTypeList.hpp:222
void GetCurrentUserTypes(ObjectPtrList &aListOfPtrs) const
Returns the list of types defined by the user (no core / builtin types).
Definition WsfObjectTypeList.hpp:156
bool LoadUnnamedComponent(UtInput &aInput, WsfPlatform &aPlatform, bool aIsAdding, int aRole)
Definition WsfObjectTypeList.hpp:235
bool Add(WsfStringId aId, std::unique_ptr< T > aDefinitionPtr)
Definition WsfObjectTypeList.hpp:91
WsfObjectTypeList(WsfScenario &aScenario, const std::string &aBlockName)
Definition WsfObjectTypeList.hpp:81
bool LoadUnnamedComponentWithoutEdit(UtInput &aInput, WsfPlatform &aPlatform, bool aIsAdding, int aRole)
Definition WsfObjectTypeList.hpp:240
void SetObjectFactoryDefault()
Definition WsfObjectTypeList.hpp:203
T * Clone(WsfStringId aId) const override
Definition WsfObjectTypeList.hpp:118
virtual bool InitializeType(ObjectType *aTypePtr)
Definition WsfObjectTypeList.hpp:224
WsfObjectTypeList(WsfScenario &aScenario, unsigned int aFlags, const std::string &aBlockName)
Definition WsfObjectTypeList.hpp:76
bool IsType(WsfStringId aTypeName) const
Definition WsfObjectTypeList.hpp:169
Definition WsfObject.hpp:40
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
ObjectType * mObjectTypePtr
The object loaded. Null if no object was loaded.
Definition WsfObjectTypeList.hpp:183
LoadResult()
Definition WsfObjectTypeList.hpp:174
bool mIsCommandProcessed
Definition WsfObjectTypeList.hpp:181