Commit 82f7b507 authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In NumA++ :
- Implement Registry/Factory (as a draft) for Integrator.
parent 43542cc9
#ifndef INTEGRATOR_REGISTRY_H
#define INTEGRATOR_REGISTRY_H
/**
* @file IntegratorRegistry.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date June 29, 2016
* @version 1.0
*/
namespace NumA {
/**
* @class IntegratorRegistry
*
* @brief
*/
class IntegratorRegistry {
public:
/**
* Static function to be able to retrieve a unique instance pointer of this class anywhere in the code.
*
* @return a unique instance of this class
*/
static IntegratorRegistry* getInstance();
/**
* Default destructor
*/
virtual ~IntegratorRegistry();
unsigned int registerIntegrator(Integrator * pIntegrator);
/**
* Try to find stored object identified by its unique class identifier.
*
* @param classId
* @return reference to object in memory or throw an exception
*/
Integrator* get(unsigned int classId) const;
/**
* Try to find stored object identified by its class name.
*
* @param className
* @return reference to object in memory or throw an exception
*/
Integrator* get(const std::string &className) const;
private:
/**
* Private pointer of this class for a unique instance
*/
static IntegratorRegistry* m_pInstance;
/**
* Private default constructor for a unique instance
*/
IntegratorRegistry();
std::map<unsigned int, Integrator*> m_baseObjectList; ///< list of registered objects identified by their unique integer identifier
std::map<std::string, Integrator*> m_translateList; ///< list of registered objects identified by their class name.
};
} // namespace NumA
#endif /* INTEGRATOR_REGISTRY_H */
class Integrator {
public:
Integrator();
virtual ~Integrator();
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment