|
#ifndef __Conversion_Helper_H
#define __Conversion_Helper_H
#include "Conversion.h"
#include "Destroyer.h"
#include <string>
#include <vector>
using namespace std;
#ifndef null
#define null 0
#endif
class IConversion;
class ConversionHelper
{
// Methods
public:
static ConversionHelper* Instance()
{
// Uses "Lazy initialization"
if (!instance_)
{
instance_ = new ConversionHelper();
destroyer_.SetObject(instance_);
}
return instance_;
}
int ObjectsNumber () { return static_cast<int>(conversionObjects_.size()); }
void Add (IConversion* conversion);
void Remove (IConversion* conversion);
IConversion* Get (int index);
IConversion* Get (const string& name);
bool Exist (const string& name);
// Constructor
protected:
ConversionHelper () {}
private:
static ConversionHelper* instance_;
static Destroyer<ConversionHelper> destroyer_;
vector<IConversion*> conversionObjects_;
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
MSc in System Engineering from Tallinn Technical University, Estonia. Currently, I work in a hitech enterprise in Israel.