I want to track a global variable that I am passing into an API function. I found that one could do it using a class:
template <class T>
class MonitoredVariable
{
public:
    MonitoredVariable() {}
    MonitoredVariable(const T& value) : m_value(value) {}
    //T operator T() const { return m_value; }
    const MonitoredVariable& operator = (const T& value)
    {
        PlugIn::gResultOut << "value changed " << std::endl;
        m_value = value;
        return *this;
    }
private:
    T m_value;
};
The API function takes variables as
bool APIFunction(double time, bool *is_done, double *fraction_done);
The following gives me an error:
ImagePtr Im;
bool is_done;
MonitoredVariable<double*> fraction_done;
bool frameready = Im->APIFunction(2.1, *is_done, fraction_done);
ERROR:
    error C2664: cannot convert argument 3 from 'MonitoredVariable<double *>' to 'double *'
what would I have to change here? thx!
Aucun commentaire:
Enregistrer un commentaire