Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::StandardFactory< T, FactoryObject, Key, Args > Class Template Reference

#include <inviwo/core/util/factory.h>

+ Inheritance diagram for inviwo::StandardFactory< T, FactoryObject, Key, Args >:

Public Member Functions

virtual std::unique_ptr< T > create (Key key, Args... args) const override
 
virtual bool hasKey (Key key) const override
 
- Public Member Functions inherited from inviwo::Factory< T, K, Args >
virtual std::unique_ptr< T > create (K key, Args... args) const =0
 
virtual std::shared_ptr< T > createShared (K key, Args... args) const
 
 Factory (const Factory &)=delete
 
 Factory (Factory &&)=default
 
virtual bool hasKey (K key) const =0
 
Factoryoperator= (const Factory &)=delete
 
Factoryoperator= (Factory &&)=default
 
- Public Member Functions inherited from inviwo::FactoryRegister< FactoryObject, Key, LookUpKey >
FactoryObject * getFactoryObject (LookUpKey key) const
 
std::vector< Key > getKeys () const
 
auto getKeyView () const
 
auto getValueView () const
 
bool hasKey (LookUpKey key) const
 
virtual bool registerObject (FactoryObject *obj)
 
virtual bool unRegisterObject (FactoryObject *obj)
 
- Public Member Functions inherited from inviwo::Observable< T >
void addObserver (T *observer)
 
bool isObservedBy (T *observer) const
 
 Observable (const Observable< T > &other)
 
 Observable (Observable< T > &&other) noexcept
 
Observable< T > & operator= (const Observable< T > &other)
 
Observable< T > & operator= (Observable< T > &&other) noexcept
 
void removeObserver (T *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 

Additional Inherited Members

- Protected Member Functions inherited from inviwo::FactoryObservable< FactoryObject >
void notifyObserversOnRegister (FactoryObject *p)
 
void notifyObserversOnUnRegister (FactoryObject *p)
 
- Protected Member Functions inherited from inviwo::Observable< T >
template<typename C >
void forEachObserver (C callback)
 
- Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
 
void removeObservationHelper (Observer *observer)
 
- Protected Attributes inherited from inviwo::FactoryRegister< FactoryObject, Key, LookUpKey >
std::map< Key, FactoryObject *, std::less<> > map_
 

Detailed Description

template<typename T, typename FactoryObject, typename Key = std::string_view, typename... Args>
class inviwo::StandardFactory< T, FactoryObject, Key, Args >

Standard setup of Factory using factory objects to create an instance. The factory will use a FactoryRegister of FactoryObject and factoryKeyType<Key>. This indirection allows std::string_view to be used as key where as the FactoryRegister will store strings for the keys.

Template Parameters
TThe object created
FactoryObjectAn object with a function std::unique_ptr<T> create(Args...) that can create objects of type T with constructor T(Args...). FactoryObject would usually be a "factory object". A getClassIdentifier() function is also required for registration.
KeyModels a key used to look up T
ArgsA variadic list of arguments passed to T on construction

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