The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::ResourceSet Class Reference

Set of published ResourceFactories which can be referenced by name. More...

#include <ResourceFactory.hpp>

Public Types

typedef std::map< std::string, std::unique_ptr< sparta::ResourceFactoryBase > > ResourceFactoryMap
 

Public Member Functions

template<typename ResourceFactoryT >
void addResourceFactory ()
 Add a resource factory by its template type.
 
sparta::ResourceFactoryBasegetResourceFactory (const std::string &name)
 Returns a ResourceFactory with the given resource type name.
 
bool hasResource (const std::string &name) const noexcept
 Checks for a resource with the given resource type name.
 
std::string renderResources (bool one_per_line=true)
 Returns a string containing all resource names known by this object separated by newlines.
 
ResourceFactoryMap::const_iterator begin () const
 Get a constant begin iterator to the ResourceSet.
 
ResourceFactoryMap::const_iterator end () const
 Get a constant end iterator to the ResourceSet.
 

Detailed Description

Set of published ResourceFactories which can be referenced by name.

Definition at line 323 of file ResourceFactory.hpp.

Member Typedef Documentation

◆ ResourceFactoryMap

typedef std::map<std::string, std::unique_ptr<sparta::ResourceFactoryBase> > sparta::ResourceSet::ResourceFactoryMap

Definition at line 327 of file ResourceFactory.hpp.

Member Function Documentation

◆ addResourceFactory()

template<typename ResourceFactoryT >
void sparta::ResourceSet::addResourceFactory ( )
inline

Add a resource factory by its template type.

Template Parameters
ResourceFactoryTType of factory to add
Precondition
This type of factory must not have been added to this ResourceSet
Postcondition
An instantiation of ResourceFactoryT will be held inside this ResourceSet and cab be looked up by it's name

Definition at line 337 of file ResourceFactory.hpp.

◆ begin()

ResourceFactoryMap::const_iterator sparta::ResourceSet::begin ( ) const
inline

Get a constant begin iterator to the ResourceSet.

Returns an interator to an internal std::pair: first is the name of the factory, second is the pointer to the factory.

Definition at line 373 of file ResourceFactory.hpp.

◆ end()

ResourceFactoryMap::const_iterator sparta::ResourceSet::end ( ) const
inline

Get a constant end iterator to the ResourceSet.

Definition at line 380 of file ResourceFactory.hpp.

◆ getResourceFactory()

sparta::ResourceFactoryBase * sparta::ResourceSet::getResourceFactory ( const std::string &  name)

Returns a ResourceFactory with the given resource type name.

Exceptions
SpartaExceptionif resource with given name cannot be found
Note
Use renderResources to show all resources

◆ hasResource()

bool sparta::ResourceSet::hasResource ( const std::string &  name) const
noexcept

Checks for a resource with the given resource type name.

Returns
true if resource with given name is found, false otherwise

◆ renderResources()

std::string sparta::ResourceSet::renderResources ( bool  one_per_line = true)

Returns a string containing all resource names known by this object separated by newlines.

Parameters
one_per_lineNewline between each resource in output. If false, uses commas

The documentation for this class was generated from the following file: