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

#include <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, std::string_view, Args... >
virtual std::unique_ptr< T > create (std::string_view key, Args... args) const =0
 
virtual std::shared_ptr< T > createShared (std::string_view key, Args... args) const
 
- Public Member Functions inherited from inviwo::FactoryBase
 FactoryBase (const FactoryBase &)=delete
 
FactoryBaseoperator= (const FactoryBase &)=delete
 
 FactoryBase (FactoryBase &&)=default
 
FactoryBaseoperator= (FactoryBase &&)=default
 
virtual bool hasKey (std::string_view key) const =0
 
- Public Member Functions inherited from inviwo::FactoryRegister< FactoryObject, factoryKeyType< std::string_view >, std::string_view >
virtual bool registerObject (FactoryObject *obj)
 
virtual bool unRegisterObject (FactoryObject *obj)
 
bool hasKey (std::string_view key) const
 
std::vector< factoryKeyType< std::string_view > > getKeys () const
 
auto getKeyView () const
 
FactoryObject * getFactoryObject (std::string_view key) const
 
- Public Member Functions inherited from inviwo::Observable< FactoryObserver< FactoryObject > >
 Observable (const Observable< FactoryObserver< FactoryObject > > &other)
 
 Observable (Observable< FactoryObserver< FactoryObject > > &&other) noexcept
 
Observable< FactoryObserver< FactoryObject > > & operator= (const Observable< FactoryObserver< FactoryObject > > &other)
 
Observable< FactoryObserver< FactoryObject > > & operator= (Observable< FactoryObserver< FactoryObject > > &&other) noexcept
 
void addObserver (FactoryObserver< FactoryObject > *observer)
 
void removeObserver (FactoryObserver< FactoryObject > *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 
- Public Member Functions inherited from inviwo::ObservableInterface

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< FactoryObserver< FactoryObject > >
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, factoryKeyType< std::string_view >, std::string_view >
std::map< factoryKeyType< std::string_view >, 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: