Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TPARAMCONTAINER_INCLUDED
Toshihiro Shimizu 890ddd
#define TPARAMCONTAINER_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tparam.h"
Toshihiro Shimizu 890ddd
//#include "tfx.h"
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TPARAM_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TIStream;
Toshihiro Shimizu 890ddd
class TOStream;
Toshihiro Shimizu 890ddd
class TParamObserver;
Toshihiro Shimizu 890ddd
class TParam;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TParamVar
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	string m_name;
Toshihiro Shimizu 890ddd
	bool m_isHidden;
Toshihiro Shimizu 890ddd
	TParamObserver *m_paramObserver;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TParamVar(string name, bool hidden = false)
Toshihiro Shimizu 890ddd
		: m_name(name), m_isHidden(hidden), m_paramObserver(0) {}
Toshihiro Shimizu 890ddd
	virtual ~TParamVar() {}
Toshihiro Shimizu 890ddd
	virtual TParamVar *clone() const = 0;
Toshihiro Shimizu 890ddd
	string getName() const { return m_name; }
Toshihiro Shimizu 890ddd
	bool isHidden() const { return m_isHidden; }
Toshihiro Shimizu 890ddd
	void setIsHidden(bool hidden) { m_isHidden = hidden; }
Toshihiro Shimizu 890ddd
	virtual void setParam(TParam *param) = 0;
Toshihiro Shimizu 890ddd
	virtual TParam *getParam() const = 0;
Toshihiro Shimizu 890ddd
	void setParamObserver(TParamObserver *obs);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Toshihiro Shimizu 890ddd
class TParamVarT : public TParamVar
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TParamP m_var;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TParamVarT(string name, TParamP var, bool hidden = false)
Toshihiro Shimizu 890ddd
		: TParamVar(name, hidden), m_var(var)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	TParamVarT(string name, T *var, bool hidden = false)
Toshihiro Shimizu 890ddd
		: TParamVar(name, hidden), m_var(var)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void setParam(TParam *param)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_var = TParamP(param);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	virtual TParam *getParam() const { return m_var.getPointer(); }
Toshihiro Shimizu 890ddd
	TParamVar *clone() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return new TParamVarT<t>(getName(), m_var, isHidden());</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TParamContainer
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	class Imp;
Toshihiro Shimizu 890ddd
	Imp *m_imp;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TParamContainer();
Toshihiro Shimizu 890ddd
	~TParamContainer();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void add(TParamVar *var);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getParamCount() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isParamHidden(int index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *getParam(int index) const;
Toshihiro Shimizu 890ddd
	string getParamName(int index) const;
Toshihiro Shimizu 890ddd
	TParam *getParam(string name) const;
Toshihiro Shimizu 890ddd
	const TParamVar *getParamVar(int index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void unlink();
Toshihiro Shimizu 890ddd
	void link(const TParamContainer *src);
Toshihiro Shimizu 890ddd
	void copy(const TParamContainer *src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setParamObserver(TParamObserver *);
Toshihiro Shimizu 890ddd
	TParamObserver *getParamObserver() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TParamContainer(const TParamContainer &);
Toshihiro Shimizu 890ddd
	TParamContainer &operator=(const TParamContainer &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif