Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
#ifndef TPARAMCONTAINER_INCLUDED
Toshihiro Shimizu 890ddd
#define TPARAMCONTAINER_INCLUDED
Toshihiro Shimizu 890ddd
Shinya Kitaoka 262a92
#include <memory></memory>
Shinya Kitaoka 262a92
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
Shinya Kitaoka 120a6e
class DVAPI TParamVar {
Shinya Kitaoka 120a6e
  std::string m_name;
Shinya Kitaoka 120a6e
  bool m_isHidden;
Shinya Kitaoka 120a6e
  TParamObserver *m_paramObserver;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TParamVar(std::string name, bool hidden = false)
Shinya Kitaoka 120a6e
      : m_name(name), m_isHidden(hidden), m_paramObserver(0) {}
Shinya Kitaoka 120a6e
  virtual ~TParamVar() {}
Shinya Kitaoka 120a6e
  virtual TParamVar *clone() const = 0;
Shinya Kitaoka 120a6e
  std::string getName() const { return m_name; }
Shinya Kitaoka 120a6e
  bool isHidden() const { return m_isHidden; }
Shinya Kitaoka 120a6e
  void setIsHidden(bool hidden) { m_isHidden = hidden; }
Shinya Kitaoka 120a6e
  virtual void setParam(TParam *param)       = 0;
Shinya Kitaoka 120a6e
  virtual TParam *getParam() const           = 0;
Shinya Kitaoka 120a6e
  void setParamObserver(TParamObserver *obs);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka d1f6c4
class TParamVarT final : public TParamVar {
Shinya Kitaoka 120a6e
  TParamP m_var;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TParamVarT(std::string name, TParamP var, bool hidden = false)
Shinya Kitaoka 120a6e
      : TParamVar(name, hidden), m_var(var) {}
Shinya Kitaoka 120a6e
  TParamVarT(std::string name, T *var, bool hidden = false)
Shinya Kitaoka 120a6e
      : TParamVar(name, hidden), m_var(var) {}
Shinya Kitaoka 473e70
  void setParam(TParam *param) override { m_var = TParamP(param); }
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  TParam *getParam() const override { return m_var.getPointer(); }
Shinya Kitaoka 473e70
  TParamVar *clone() const override {
Shinya Kitaoka 120a6e
    return new TParamVarT<t>(getName(), m_var, isHidden());</t>
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TParamContainer {
Shinya Kitaoka 120a6e
  class Imp;
Shinya Kitaoka 120a6e
  std::unique_ptr<imp> m_imp;</imp>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TParamContainer();
Shinya Kitaoka 120a6e
  ~TParamContainer();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void add(TParamVar *var);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getParamCount() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isParamHidden(int index) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TParam *getParam(int index) const;
Shinya Kitaoka 120a6e
  std::string getParamName(int index) const;
Shinya Kitaoka 120a6e
  TParam *getParam(std::string name) const;
Shinya Kitaoka 120a6e
  const TParamVar *getParamVar(int index) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void unlink();
Shinya Kitaoka 120a6e
  void link(const TParamContainer *src);
Shinya Kitaoka 120a6e
  void copy(const TParamContainer *src);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setParamObserver(TParamObserver *);
Shinya Kitaoka 120a6e
  TParamObserver *getParamObserver() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TParamContainer(const TParamContainer &);
Shinya Kitaoka 120a6e
  TParamContainer &operator=(const TParamContainer &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif