fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::CloningFactory< T > Class Template Reference

The CloningFactory class is the base class for a factory whose objects are created from a registered object by calling the clone() method. More...

#include <CloningFactory.h>

Inheritance diagram for fl::CloningFactory< T >:
Collaboration diagram for fl::CloningFactory< T >:

Public Member Functions

 CloningFactory (const std::string &name="")
 
 CloningFactory (const CloningFactory &other)
 
CloningFactoryoperator= (const CloningFactory &other)
 
virtual ~CloningFactory ()
 
virtual std::string name () const
 Returns the name of the factory. More...
 
virtual void registerObject (const std::string &key, T object)
 Registers the object in the factory and assumes its ownership. More...
 
virtual void deregisterObject (const std::string &key)
 Deregisters the given object from the factory and deletes it. More...
 
virtual bool hasObject (const std::string &key) const
 Checks whether the factory has the given object registered. More...
 
virtual T getObject (const std::string &key) const
 Gets the object registered by the given key, not a clone of the object. More...
 
virtual T cloneObject (const std::string &key) const
 Creates a cloned object by executing the clone method on the registered object. More...
 
virtual std::vector< std::string > available () const
 Returns a vector of the available objects. More...
 
virtual std::map< std::string, T > & objects ()
 Gets the map of registered keys and objects. More...
 
virtual const std::map< std::string, T > & objects () const
 Gets an immutable map of registered keys and objects. More...
 

Detailed Description

template<typename T>
class fl::CloningFactory< T >

The CloningFactory class is the base class for a factory whose objects are created from a registered object by calling the clone() method.

Parameters
<T>is the class of the object to be cloned
Author
Juan Rada-Vilela, Ph.D.
See also
FactoryManager
Since
5.0

Definition at line 40 of file CloningFactory.h.

Constructor & Destructor Documentation

◆ CloningFactory() [1/2]

template<typename T >
fl::CloningFactory< T >::CloningFactory ( const std::string &  name = "")
inlineexplicit

Definition at line 115 of file CloningFactory.h.

◆ CloningFactory() [2/2]

template<typename T >
fl::CloningFactory< T >::CloningFactory ( const CloningFactory< T > &  other)
inline

Definition at line 120 of file CloningFactory.h.

◆ ~CloningFactory()

template<typename T >
fl::CloningFactory< T >::~CloningFactory ( )
inlinevirtual

Definition at line 152 of file CloningFactory.h.

Member Function Documentation

◆ available()

template<typename T >
std::vector< std::string > fl::CloningFactory< T >::available ( ) const
inlinevirtual

Returns a vector of the available objects.

Returns
a vector of the available objects

Definition at line 205 of file CloningFactory.h.

◆ cloneObject()

template<typename T >
T fl::CloningFactory< T >::cloneObject ( const std::string &  key) const
inlinevirtual

Creates a cloned object by executing the clone method on the registered object.

Parameters
keyis the unique name by which objects are registered
Returns
a cloned object by executing the clone method on the registered object

Definition at line 195 of file CloningFactory.h.

◆ deregisterObject()

template<typename T >
void fl::CloningFactory< T >::deregisterObject ( const std::string &  key)
inlinevirtual

Deregisters the given object from the factory and deletes it.

Parameters
keyis the unique name by which objects are registered

Definition at line 171 of file CloningFactory.h.

◆ getObject()

template<typename T >
T fl::CloningFactory< T >::getObject ( const std::string &  key) const
inlinevirtual

Gets the object registered by the given key, not a clone of the object.

Parameters
keyis the unique name by which objects are registered
Returns
the object registered by the given key

Definition at line 186 of file CloningFactory.h.

◆ hasObject()

template<typename T >
bool fl::CloningFactory< T >::hasObject ( const std::string &  key) const
inlinevirtual

Checks whether the factory has the given object registered.

Parameters
keyis the unique name by which objects are registered
Returns
whether the factory has the given object registered

Definition at line 180 of file CloningFactory.h.

◆ name()

template<typename T >
std::string fl::CloningFactory< T >::name ( ) const
inlinevirtual

Returns the name of the factory.

Returns
the name of the factory

Definition at line 161 of file CloningFactory.h.

◆ objects() [1/2]

template<typename T >
std::map< std::string, T > & fl::CloningFactory< T >::objects ( )
inlinevirtual

Gets the map of registered keys and objects.

Returns
the map of registered keys and objects

Definition at line 215 of file CloningFactory.h.

◆ objects() [2/2]

template<typename T >
const std::map< std::string, T > & fl::CloningFactory< T >::objects ( ) const
inlinevirtual

Gets an immutable map of registered keys and objects.

Returns
an immutable map of registered keys and objects

Definition at line 220 of file CloningFactory.h.

◆ operator=()

template<typename T >
CloningFactory< T > & fl::CloningFactory< T >::operator= ( const CloningFactory< T > &  other)
inline

Definition at line 131 of file CloningFactory.h.

◆ registerObject()

template<typename T>
void fl::CloningFactory< T >::registerObject ( const std::string &  key,
object 
)
inlinevirtual

Registers the object in the factory and assumes its ownership.

Parameters
keyis the unique name by which objects are registered
objectis the object to be cloned via a clone method

Definition at line 166 of file CloningFactory.h.


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