Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TEXTERNFX_H
Toshihiro Shimizu 890ddd
#define TEXTERNFX_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tbasefx.h"
Toshihiro Shimizu 890ddd
#include "trasterfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TFX_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
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TExternFx : public TBaseRasterFx {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TExternFx() { setName(L"ExternFx"); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static TExternFx *create(std::string name);
Shinya Kitaoka 120a6e
  void getNames(std::vector<std::string> &names);</std::string>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TExternalProgramFx : public TExternFx {
Shinya Kitaoka 120a6e
  FX_DECLARATION(TExternalProgramFx)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  class Port {
Shinya Kitaoka 120a6e
  public:
Shinya Kitaoka 120a6e
    std::string m_name;
Shinya Kitaoka 120a6e
    TRasterFxPort *m_port;  // n.b. la porta di output ha m_port=0
Shinya Kitaoka 120a6e
    std::string m_ext;  // estensione del file in cui si legge/scrive l'immagine
Shinya Kitaoka 120a6e
    Port() : m_name(), m_port(0), m_ext() {}
Shinya Kitaoka 120a6e
    Port(std::string name, std::string ext, TRasterFxPort *port)
Shinya Kitaoka 120a6e
        : m_name(name), m_port(port), m_ext(ext) {}
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::map<std::string, port=""> m_ports;</std::string,>
Shinya Kitaoka 120a6e
  // std::map<std::string, tparamp=""> m_params;</std::string,>
Shinya Kitaoka 120a6e
  std::vector<tparamp> m_params;</tparamp>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFilePath m_executablePath;
Shinya Kitaoka 120a6e
  std::string m_args;
Shinya Kitaoka 120a6e
  std::string m_externFxName;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TExternalProgramFx(std::string name);
Shinya Kitaoka 120a6e
  TExternalProgramFx();
Shinya Kitaoka 120a6e
  ~TExternalProgramFx();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void initialize(std::string name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual TFx *clone(bool recursive = true) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info);
Shinya Kitaoka 120a6e
  void doCompute(TTile &tile, double frame, const TRenderSettings &ri);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool canHandle(const TRenderSettings &info, double frame) { return false; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setExecutable(TFilePath fp, std::string args) {
Shinya Kitaoka 120a6e
    m_executablePath = fp;
Shinya Kitaoka 120a6e
    m_args           = args;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void addPort(std::string portName, std::string ext, bool isInput);
Shinya Kitaoka 120a6e
  // void addParam(string paramName, const TParamP ¶m);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void loadData(TIStream &is);
Shinya Kitaoka 120a6e
  void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setExternFxName(std::string name) { m_externFxName = name; }
Shinya Kitaoka 120a6e
  std::string getExternFxName() const { return m_externFxName; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  // not implemented
Shinya Kitaoka 120a6e
  TExternalProgramFx(const TExternalProgramFx &);
Shinya Kitaoka 120a6e
  TExternalProgramFx &operator=(const TExternalProgramFx &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif