Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GeometryFactory Class Reference

The abstract factory class for creating objects in the Geometry family. More...

#include <geometry.h>

Public Types

typedef Geometry *(* GeoCreateFunc )()
 Defines a function pointer pointing to a function which creates objects in the Geometry family.
 

Public Member Functions

void registerGeometry (std::string name, GeoCreateFunc func)
 Registers (links) the geometry name name with the function func for creating objects in the Geometry family. More...
 

Static Public Member Functions

static GeometryFactoryinstance ()
 Returns reference to a Singleton object of class GeometryFactory. More...
 

This function creates an object of the class linked to the

Parameters
[in]namethe name linked to a specific class in the Geometry family via the registrerGeometry member function
Returns
A Geometry * pointer pointing to an object of a specific class in the Geometry family

Example usage:

Geometry* newGeometry = factory.createGeometry(name);
GeometrycreateGeometry (std::string name)
 

Detailed Description

The abstract factory class for creating objects in the Geometry family.

Author
Chen, Hsin-Chiang (morri.nosp@m.sche.nosp@m.n2008.nosp@m.@gma.nosp@m.il.co.nosp@m.m)
Version
1.0
Date
2014/08/08

Created on: 2014/06/07

Member Function Documentation

GeometryFactory & GeometryFactory::instance ( )
static

Returns reference to a Singleton object of class GeometryFactory.

Parameters
None
Returns
Reference to a static object of class GeometryFactory

Example usage:

Note
This function is implemented based on the lazy Singleton design pattern; therefore, only one GeometryFactory instance is allowed in each program
void GeometryFactory::registerGeometry ( std::string  name,
GeoCreateFunc  func 
)

Registers (links) the geometry name name with the function func for creating objects in the Geometry family.

After registration, name can be used as an argument in the createGeometry member function for creating objects of the linked type in the Geometry family

Parameters
[in]namethe geometry name
[in]functhe function pointer pointing to the function that creates objects of a specific type in the Geometry family
Returns
None
Note
Instead of using this function directly, consider using the GeometryRegistrar class for the purpose of linking a geometry name and a specific class in the Geometry family. The function is kept public in case one wants to use it directly

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