retdec
|
Implementation of the Object Factory design pattern. More...
Go to the source code of this file.
Classes | |
class | retdec::llvmir2hll::DefaultFactoryError< ObjectIDType, AbstractObject > |
Handles the "Unknown Type" error in an object factory. More... | |
class | retdec::llvmir2hll::Factory< AbstractObject, ObjectIDType, ObjectCreator, FactoryErrorPolicy > |
Implementation of a generic object factory. More... | |
Namespaces | |
retdec | |
retdec::llvmir2hll | |
Macros | |
#define | REGISTER_AT_FACTORY(objectId, objectIdVarName, factory, createFunc) |
Registers an object with objectId at factory. More... | |
Implementation of the Object Factory design pattern.
The implementation is based on the following book:
#define REGISTER_AT_FACTORY | ( | objectId, | |
objectIdVarName, | |||
factory, | |||
createFunc | |||
) |
Registers an object with objectId at factory.
objectId | Identifier of the object. |
objectIdVarName | Name of the variable used to hold objectId. |
factory | Name of the factory. |
createFunc | Function to be used for creating objects. |
For example, the following code snippet registers a Python HLL writer:
This macro creates a const std::string
constant in an anonymous namespace named objectIdVarName whose value is objectId. It is supposed to be used only in implementation files (i.e. .cpp files).