CLAM-Development
1.4.0
|
Factory usage example. More...
#include <Factory.hxx>
Classes | |
class | Creator |
Abstract class for Creator objects which are stored in the Factory::Registry. More... | |
struct | Pair |
class | Registry |
This class is an implementation class of the Factory. More... |
Public Types | |
typedef AbstractProductType | AbstractProduct |
typedef std::string | RegistryKey |
typedef std::list< Key > | Keys |
typedef std::list< std::string > | Values |
typedef std::list< Pair > | Pairs |
Public Member Functions | |
Factory () | |
~Factory () | |
AbstractProduct * | Create (const RegistryKey name) |
Gives ownership of the new created Product registered with the given name. | |
AbstractProduct * | CreateSafe (const RegistryKey name) throw (ErrFactory) |
Gives ownership of the new created Product registered with the given name. | |
void | Clear () |
void | AddCreator (const RegistryKey name, Creator *creator) |
void | AddCreatorWarningRepetitions (const RegistryKey name, Creator *creator) |
void | AddCreatorSafe (const RegistryKey name, Creator *creator) throw (ErrFactory) |
void | DeleteCreator (const RegistryKey name) |
void | GetRegisteredNames (std::list< std::string > &namesList) |
bool | KeyExists (const RegistryKey &key) |
bool | AttributeExists (const std::string &key, const std::string &attribute) |
Keys | GetKeys (const std::string &attribute, const std::string &value) |
Get all keys that have attribute==value in its metadata. | |
Keys | GetKeys () |
Get all keys in the factory. | |
Pairs | GetPairsFromKey (const std::string &key) |
Return all the metadata available for a product key. | |
Values | GetSetOfValues (const std::string &attribute) |
Get the set of all values present for a given metadata attribute. Example GetSetOfValues("category") could return ["modulators","generators","reverbs"] without repeated items. | |
Values | GetValuesFromAttribute (const std::string &key, const std::string &attribute) |
Return the list of values for a metadata attribute for a product key. | |
Value | GetValueFromAttribute (const std::string &key, const std::string &attribute) |
Return the value for a metadata attribute of product key. If multiple values exist returns the first value. | |
void | AddAttribute (const std::string &key, const std::string &attribute, const std::string &value) |
int | Count () |
Factory usage example.
To define a factory for your types you should create your own factory subclass.
You must define GetInstance() method in a .cxx
To automatically register concrete products into the factory at program loading time (before "main()" starts), declare a registrator object like this:
Definition at line 70 of file Factory.hxx.
typedef AbstractProductType CLAM::Factory< AbstractProductType >::AbstractProduct |
Definition at line 73 of file Factory.hxx.
typedef std::list<Key> CLAM::Factory< AbstractProductType >::Keys |
Definition at line 87 of file Factory.hxx.
typedef std::list<Pair> CLAM::Factory< AbstractProductType >::Pairs |
Definition at line 89 of file Factory.hxx.
typedef std::string CLAM::Factory< AbstractProductType >::RegistryKey |
Definition at line 74 of file Factory.hxx.
typedef std::list<std::string> CLAM::Factory< AbstractProductType >::Values |
Definition at line 88 of file Factory.hxx.
|
inline |
Definition at line 99 of file Factory.hxx.
|
inline |
Definition at line 100 of file Factory.hxx.
|
inline |
Definition at line 203 of file Factory.hxx.
Referenced by RunTimeLadspaLibraryLoader::SetupLibrary(), and RunTimeFaustLibraryLoader::SetupLibrary().
|
inline |
Definition at line 135 of file Factory.hxx.
|
inline |
Definition at line 145 of file Factory.hxx.
|
inline |
Definition at line 140 of file Factory.hxx.
Referenced by RunTimeLadspaLibraryLoader::SetupLibrary(), and RunTimeFaustLibraryLoader::SetupLibrary().
|
inline |
Definition at line 165 of file Factory.hxx.
Referenced by RunTimeFaustLibraryLoader::SetupLibrary().
|
inline |
Definition at line 130 of file Factory.hxx.
|
inline |
Definition at line 504 of file Factory.hxx.
|
inline |
Gives ownership of the new created Product registered with the given name.
It asserts that the name is in the registry.
Definition at line 112 of file Factory.hxx.
|
inline |
Gives ownership of the new created Product registered with the given name.
It throws an ErrFactory if the name isn't found in the registry.
Definition at line 124 of file Factory.hxx.
Referenced by CLAM::Network::AddProcessing(), and CLAM::ProcessingDefinitionAdapter::LoadFrom().
|
inline |
Definition at line 150 of file Factory.hxx.
Referenced by RunTimeLibraryLoader::ReLoad().
|
inline |
Get all keys that have attribute==value in its metadata.
Definition at line 171 of file Factory.hxx.
Referenced by RunTimeLibraryLoader::ReLoad().
|
inline |
Get all keys in the factory.
Definition at line 176 of file Factory.hxx.
Referenced by CLAM::Factory< Processing >::GetKeys().
|
inline |
Return all the metadata available for a product key.
Definition at line 181 of file Factory.hxx.
|
inline |
Definition at line 155 of file Factory.hxx.
|
inline |
Get the set of all values present for a given metadata attribute. Example GetSetOfValues("category") could return ["modulators","generators","reverbs"] without repeated items.
Definition at line 187 of file Factory.hxx.
Referenced by RunTimeLibraryLoader::GetUsedLibraries().
|
inline |
Return the value for a metadata attribute of product key. If multiple values exist returns the first value.
Definition at line 198 of file Factory.hxx.
|
inline |
Return the list of values for a metadata attribute for a product key.
Definition at line 192 of file Factory.hxx.
Referenced by CLAM::Factory< Processing >::GetValueFromAttribute().
|
inline |
Definition at line 160 of file Factory.hxx.