9 #ifndef OBJECTPRODUCER_H_ 10 #define OBJECTPRODUCER_H_ 145 std::shared_ptr<Representation>
_repr;
152 template <
typename C>
154 std::string objStore)
155 :
name{std::move(objName)},
category{std::move(objCategory)},
store{std::move(objStore)} {
157 for (
auto &alias : objAliases) {
159 aliases.emplace(std::move(alias));
164 template <
typename C>
167 const std::string routineName(
"ObjectProducer::DeclareProducedObject");
170 throw BadName(routineName +
": no name given for produced object");
173 throw BadCategory(routineName +
": bad category for produced object " + name);
176 ProducedObject declaredObj(std::move(name), std::move(category),
"", std::move(store));
177 auto objIter = std::find(
_repr->objs.begin(),
_repr->objs.end(), declaredObj);
178 auto &effectiveObj = (objIter !=
_repr->objs.end() ? *objIter : declaredObj);
179 for (
auto &alias : aliases) {
181 effectiveObj.aliases.emplace(std::move(alias));
184 if (objIter ==
_repr->objs.end()) {
185 _repr->objs.emplace_back(declaredObj);
192 #ifndef OBJECTPRODUCER_CPP 194 std::set<std::string> objAliases, std::string objStore);
196 std::string objAlias, std::string objStore);
198 const char *objAlias, std::string objStore);
201 std::set<std::string> alias, std::string
store);
Exception class for bad object category.
Definition: ObjectProducer.h:88
const ProducedObjects & GetProducedObjects() const
Getter method for produced objects.
Definition: ObjectProducer.h:102
std::string store
Definition: ObjectProducer.h:45
Exception(std::string msg="")
Definition: Exception.h:31
void DeclareProducedObject(std::string name, ObjectCategory category, C aliases, std::string store)
Declare a produced objects.
Definition: ObjectProducer.h:165
bool operator==(const ProducedObject &rhs) const
Comparison operator.
Definition: ObjectProducer.h:58
virtual ~ObjectProducer()
Destructor.
Definition: ObjectProducer.h:35
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
bool SetDisabled(bool disabled=true)
Disables/enables the producer.
Definition: ObjectProducer.h:118
Descriptor structure for a produced object.
Definition: ObjectProducer.h:41
std::vector< ProducedObject > ProducedObjects
Type for container of produced objects.
Definition: ObjectProducer.h:93
std::shared_ptr< Representation > & GetRepresentation()
Definition: ObjectProducer.h:142
ProducedObjects objs
Definition: ObjectProducer.h:138
Definition: ObjectProducer.h:136
std::set< std::string > aliases
Definition: ObjectProducer.h:44
ObjectProducer()
Constructor.
Definition: ObjectProducer.cpp:17
ObjectCategory category
Definition: ObjectProducer.h:43
ObjectCategory
Category of objects.
Definition: ObjectCategory.h:17
Exception class for bad object name.
Definition: ObjectProducer.h:84
std::string name
Definition: ObjectProducer.h:42
Interface for a class which produced data objects.
Definition: ObjectProducer.h:29
Status
Aliases for memory occupation levels.
Definition: Memory.h:23
ProducedObject()
Definition: ObjectProducer.h:46
Definition: Exception.h:24
bool _disabled
Definition: ObjectProducer.h:146
virtual std::vector< std::string > FreeObjects(const std::vector< std::string > &objs, Memory::Status memStatus)
Free the memory for given objects.
Definition: ObjectProducer.cpp:82
ObjectProducer(const std::shared_ptr< Representation > &impl)
Definition: ObjectProducer.h:141
std::shared_ptr< Representation > _repr
Definition: ObjectProducer.h:145