#include #include #include #include "WaveletFunctions.hh" #include "Haar.hh" #include "ScalarUDT.hh" //======================================================================= // Wavelet w = Haar(parameters) //======================================================================= static HaarFunction _HaarFunction; HaarFunction:: HaarFunction() : Function(GetName()) { } void HaarFunction::Eval(CallChain* Chain, const CallChain::Params& Params, const std::string& Ret) const { using namespace datacondAPI; CallChain::Symbol* result = 0; CallChain::Symbol* obj = 0; int arg = 0; int tree = 0; switch(Params.size()) { case 1: arg = 1; obj = Chain->GetSymbol(Params[arg - 1]); if (const Scalar* const p = dynamic_cast*>(obj)) { tree = p->GetValue(); } else { std::ostrstream oss; oss << "Illegal argument to " << GetName() << " - argument #" << arg << " must be an integer" << ends; std::invalid_argument e(oss.str()); oss.freeze(0); throw e; } break; case 0: tree = 0; break; default: tree = 0; throw CallChain::BadArgumentCount("Haar", 1, Params.size()); break; } //: no matter what is the Haar<> template type: cast to base class result = new wat::Haar(tree); if (result == 0) { throw CallChain::UndocumentedError(__FILE__, __LINE__); } Chain->Push(result); Chain->ResetOrAddSymbolWithStackData(Ret); } const std::string& HaarFunction:: GetName(void) const { static const std::string name("Haar"); return name; }