Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
factory.h File Reference

Generic factory mechanism. More...

#include <geogram/basic/memory.h>
#include <geogram/basic/counted.h>
#include <string>
#include <map>
#include <vector>
#include <typeinfo>

Go to the source code of this file.

Classes

class  GEO::InstanceRepo
 Repository of unique instances. More...
 
class  GEO::Factory< FactoryCreator >
 Factory of typed objects. More...
 
struct  GEO::Factory< FactoryCreator >::RegisterCreator< ConcreteType >
 Helper class to register a creator. More...
 
struct  GEO::FactoryCreator0< Type >
 Factory creator without constructor arguments. More...
 
class  GEO::Factory0< Type >
 Factory for types without constructor arguments. More...
 
struct  GEO::FactoryCreator1< Type, Param1 >
 Factory creator with one argument. More...
 
class  GEO::Factory1< Type, Param1 >
 Factory for types with one constructor argument. More...
 

Namespaces

 GEO
 Global Vorpaline namespace.
 

Macros

#define geo_register_creator(FactoryType, ConcreteType, name)
 Helper macro to register a creator. More...
 

Detailed Description

Generic factory mechanism.

Definition in file factory.h.

Macro Definition Documentation

◆ geo_register_creator

#define geo_register_creator (   FactoryType,
  ConcreteType,
  name 
)
Value:
static FactoryType::RegisterCreator<ConcreteType> \
CPP_CONCAT(Factory_register_creator_, __LINE__) (name); \
geo_argused(CPP_CONCAT(Factory_register_creator_, __LINE__))

Helper macro to register a creator.

This declares a static instance of FactoryType::RegisterCreator to register a ConcreteType creator in FactoryType at program initialization time.

Usage example:
struct MyBaseClass { ... };
typedef Factory<MyBaseClass> MyFactory;
struct MyDerivedClass : MyBaseClass { ... };
geo_register_creator(MyFactory, MyDerivedClass, "my_derived_class");
#define geo_register_creator(FactoryType, ConcreteType, name)
Helper macro to register a creator.
Definition: factory.h:384
Parameters
[in]FactoryTypeidentifies the target Factory
[in]ConcreteTypethe type of the object to create
[in]namename of the ConcreteType creator in the Factory
See also
Factory::RegisterCreator

Definition at line 384 of file factory.h.