pgsOperand pgsGenTime::eval(pgsVarMap &vars) const { // Evaluate parameters pgsOperand min(m_min->eval(vars)); pgsOperand max(m_max->eval(vars)); pgsOperand sequence(m_sequence->eval(vars)); pgsOperand seed(m_seed->eval(vars)); // Check parameters and create the generator if (min->is_string() && max->is_string() && sequence->is_integer() && seed->is_integer()) { wxDateTime aux_min, aux_max; if (aux_min.ParseTime(min->value()) != 0 && aux_max.ParseTime(max->value()) != 0 && aux_min.IsValid() && aux_max.IsValid()) { long aux_sequence, aux_seed; sequence->value().ToLong(&aux_sequence); seed->value().ToLong(&aux_seed); return pnew pgsGenerator(pgsVariable::pgsTString, pnew pgsTimeGen(aux_min, aux_max, aux_sequence != 0, aux_seed)); } else { throw pgsParameterException(wxString() << value() << wxT(":\nmin and/or max times are not valid")); } } else { // Deal with errors if (!min->is_string()) { throw pgsParameterException(wxString() << value() << wxT(":\nmin should be a string")); } else if (!max->is_string()) { throw pgsParameterException(wxString() << value() << wxT(":\nmax should be a string")); } else if (!sequence->is_integer()) { throw pgsParameterException(wxString() << value() << wxT(":\nsequence should be an integer")); } else { throw pgsParameterException(wxString() << value() << wxT(":\nseed should be an integer")); } } }
pgsTimeGen * pgsTimeGen::clone() { return pnew pgsTimeGen(*this); }