14 template <
class DataType>
28 template <
class DataType>
43 template <
class DataType>
58 template <
class DataType>
74 auto obj = GetFromMap<DataType>(name);
83 w = (DataType *)(
nullptr);
85 std::string actualName;
87 result = std::max(
GetFromProvider(name, w, actualName, provider), result);
91 auto objAfterCast = CastAndWrap<DataType>(name, actualName, std::move(w), provider);
109 return ObjectMap::GetObject<DataType>(name);
112 template <
class DataType>
121 if (actualName ==
"") {
163 auto obj = GetFromMap<DataType>(name);
173 result = _eventCache->GetCachedValue(name, w);
177 std::string actualName;
181 w = (DataType *)(
nullptr);
183 result = std::max(
GetFromProvider(name, w, actualName, provider), result);
188 auto objPtr = CastAndWrap<DataType>(name, actualName, std::move(w), provider);
207 objsAndAliasesInStore.reserve(objsAndAliasesInStore.size() + aliasesInStore.size());
208 objsAndAliasesInStore.insert(objsAndAliasesInStore.end(), std::make_move_iterator(aliasesInStore.begin()),
209 std::make_move_iterator(aliasesInStore.end()));
211 if (objsAndAliasesInStore.size() != 0) {
214 throw Retrieval::NotFound(
"Object \"" + name +
"\" is not found (most similar existing name/alias: \"" +
observer_ptr< DataType > GetObject(const std::string &name)
Provides a data object.
Definition: DataStore.hpp:156
Class describing a pointer to an object retrieved from an ObjectMap.
Definition: ObjPtr.h:31
std::unique_ptr< RemovedObjectsTracker > _remObjTracker
Definition: DataStore.h:387
Known object but not available at the moment.
A smart pointer not owning the wrapped object.
Definition: ObserverPtr.h:28
#define THROW_RETRIEVAL_EXC(retRes, objName)
Definition: RetrievalExceptions.h:50
bool IsAlgoProducedObject(const std::string nameOrAlias)
Checks if a given object is produced by an algorithm.
Definition: DataStore.cpp:89
RetrievalResult
Definition: RetrievalResult.h:16
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
Exception for unknown object.
Definition: RetrievalExceptions.h:39
Exception for generic error in object insertion procedure.
Definition: InsertionExceptions.h:57
void SetAlias(const std::string &objName, const std::string &objAlias)
Set an alias for the given object.
Definition: DataStore.cpp:37
ObjPtr< DataType > GetFromMap(const std::string &name)
Retrieves an object from the internal ObjectMap.
Definition: DataStore.hpp:108
RetrievalResult GetFromProvider(const std::string &name, ObjectWrapper &wrapper, std::string &actualName, observer_ptr< ObjectProducer > &provider)
Retrieves an object from the registered providers.
Definition: DataStore.cpp:176
Generic wrapper class.
Definition: ObjectWrapper.h:28
void AddObject(const std::string &name, DataType &obj, const observer_ptr< ObjectProducer > &producer=nullptr)
Adds an object to the map, storing also the producer.
Definition: DataStore.hpp:15
Base class for insertion exceptions.
Definition: InsertionExceptions.h:21
std::vector< std::string > GetObjects() const
Returns the names of the objects in the store.
Definition: DataStore.h:163
ObjPtr< DataType > CastAndWrap(const std::string &name, const std::string &actualName, ObjectWrapper &&wrapper, observer_ptr< ObjectProducer > provider)
Casts the wrapper to the template type, registers the object in the store and wraps it inside the ret...
Definition: DataStore.hpp:113
InsertionResult AddObject(const std::string &name, DataType &obj)
Adds an object to the map.
Definition: ObjectMap.h:245
void * wrapper_cast(ObjectWrapper &wrapper, const std::type_info &typeInfo, bool isConst)
Cast function to extract wrapped pointer from wrapper in a type-safe way.
Definition: WrapperCast.cpp:12
InsertionResult
Definition: InsertionResult.h:16
bool RemoveObject(const std::string &name, bool removeAliased=false)
Removes an object or an alias from the map.
Definition: ObjectMap.cpp:79
std::vector< std::string > GetAliases(const std::string &name="") const
Returns the aliases of the objects in the store.
Definition: DataStore.h:223
Object successfully inserted or already present.
observer_ptr< DataType > GetObject(const std::string &name)
Provides a data object.
Definition: DataStore.hpp:67
Object found but class does not match with requested.
Exception for known object but not available at the moment.
Definition: RetrievalExceptions.h:27
std::enable_if_t<!(is_pointer< typename Container::value_type >::value), std::string > FindSimilar(const std::string &str, const Container &cont)
Find a similar string inside a container.
Definition: StringUtils.hpp:22
#define THROW_INSERTION_EXC(insRes, objName)
Definition: InsertionExceptions.h:62
RetrievalResult _result
Definition: ObjPtr.h:114