00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FSF_CLASS_FACTORIES_H
00030 #define FSF_CLASS_FACTORIES_H
00031
00032 #include <string>
00033
00034
00035
00036
00037
00038
00039 #include "FsfFilter.h"
00040
00041 namespace fsf{
00042
00046 class CClassFactoryBase{
00047 private:
00048 std::string m_strName;
00049 std::string m_strAuthor;
00050 std::string m_strThanks;
00051 public:
00053
00054
00055 CClassFactoryBase() {}
00057 CClassFactoryBase(const std::string& strName) { m_strName=strName; }
00059 CClassFactoryBase(const std::string& strName, const std::string& strAuthor) { m_strName=strName; m_strAuthor=strAuthor; }
00061 CClassFactoryBase(const std::string& strName, const std::string& strAuthor, const std::string& strThanks) { m_strName=strName; m_strAuthor=strAuthor; m_strThanks=strThanks; }
00063 CClassFactoryBase(const CClassFactoryBase &rhs) { m_strName=rhs.m_strName; m_strAuthor=rhs.m_strAuthor; m_strThanks=rhs.m_strThanks; }
00065 virtual ~CClassFactoryBase() {}
00066
00068
00069
00070 void getName(std::string &str) const { str.assign(m_strName); }
00072 void getAuthor(std::string &str) const { str.assign(m_strAuthor); }
00074 void getThanks(std::string &str) const { str.assign(m_strThanks); }
00076
00078
00079
00080
00081
00082 virtual void *instantiate()=0;
00084 };
00085
00088 class CNodeFactoryBase : public CClassFactoryBase {
00089 public:
00091
00092
00093 CNodeFactoryBase() : CClassFactoryBase() {}
00095 CNodeFactoryBase(const std::string& strName) : CClassFactoryBase(strName) {}
00097 CNodeFactoryBase(const std::string& strName, const std::string& strAuthor) : CClassFactoryBase(strName,strAuthor) {}
00099 CNodeFactoryBase(const std::string& strName, const std::string& strAuthor, const std::string& strThanks) : CClassFactoryBase(strName,strAuthor,strThanks) {}
00101 CNodeFactoryBase(const CNodeFactoryBase &rhs) : CClassFactoryBase(rhs) {}
00103
00105
00106
00107
00108 virtual CPassiveFilterBase* makePassiveFilter(const std::string &str)=0;
00111 virtual CActiveFilterBase* makeActiveFilter(const std::string &str)=0;
00113 };
00114
00115
00118 template <class N> class CNodeFactory : public CNodeFactoryBase {
00119 public:
00121
00122
00123 CNodeFactory() : CNodeFactoryBase() {}
00125 CNodeFactory(const std::string& strName) : CNodeFactoryBase(strName) {}
00127 CNodeFactory(const std::string& strName, const std::string& strAuthor) : CNodeFactoryBase(strName,strAuthor) {}
00129 CNodeFactory(const std::string& strName, const std::string& strAuthor, const std::string& strThanks) : CNodeFactoryBase(strName,strAuthor,strThanks) {}
00131 CNodeFactory(const CNodeFactory &rhs) : CNodeFactoryBase(rhs) {}
00133
00135
00136
00137 virtual void* instantiate() { return new N; }
00139 virtual CPassiveFilterBase* makePassiveFilter(const std::string &str) { return new CPassiveFilter<N>(str); }
00141 virtual CActiveFilterBase* makeActiveFilter(const std::string &str) { return new CActiveFilter<N>(str); }
00143 };
00144
00147 class CCellFactoryBase : public CClassFactoryBase {
00148 public:
00150
00151
00152 CCellFactoryBase() : CClassFactoryBase() {}
00154 CCellFactoryBase(const std::string& strName) : CClassFactoryBase(strName) {}
00156 CCellFactoryBase(const std::string& strName, const std::string& strAuthor) : CClassFactoryBase(strName,strAuthor) {}
00158 CCellFactoryBase(const std::string& strName, const std::string& strAuthor, const std::string& strThanks) : CClassFactoryBase(strName,strAuthor,strThanks) {}
00160 CCellFactoryBase(const CCellFactoryBase &rhs) : CClassFactoryBase(rhs) {}
00162 };
00163
00166 template <class C> class CCellFactory : public CCellFactoryBase {
00167 public:
00169
00170 CCellFactory() : CCellFactoryBase() {}
00171 CCellFactory(const std::string& strName) : CCellFactoryBase(strName) {}
00172 CCellFactory(const std::string& strName, const std::string& strAuthor) : CCellFactoryBase(strName,strAuthor) {}
00173 CCellFactory(const std::string& strName, const std::string& strAuthor, const std::string& strThanks) : CCellFactoryBase(strName,strAuthor,strThanks) {}
00174 CCellFactory(const CCellFactory &rhs) : CCellFactoryBase(rhs) {}
00176
00178
00179
00180 virtual void* instantiate() { return new C; }
00182 };
00183
00184 }
00185
00186 #endif // FSF_CLASS_FACTORIES_H