TypeConversion -------------- 1. Handler for calls to an action "tseries". //======================================================================= // Sequence -> TimeSeries conversion //======================================================================= class TSeriesFunction: CallChain::Function { public: //: Default constructor - construction of dummy instance registers the Eval //+ method as the handler for calls to the action named by the GetName method TSeriesFunction(); //: Evaluate an action call //!param: Chain - environment of the action call //!param: Params - container of parameter names //!param: Ret - return value name virtual void Eval(CallChain* Chain, const CallChain::Params& Params, const std::string& Ret) const; //: Get the name of the handled action //!return: The name of the handled action virtual const std::string& GetName(void) const; }; 2. Description Implements the CallChain::Function interface for an action "tseries", and supplies the code to evaluate the operation. 3. Operating instructions 3.1 Example Usage CallChain chain; char* par[4]={"input", "rate", NULL}; // list of parameters Sequence in(0.,16384); // first parameter is sequence initialized by zeroes Scalar Rate(16384.); // assign data rate to second parameter // Need to create copies of the input data because once AddSymbol // has been called on an object it's the CallChains responsibility to delete it CallChain::Symbol* input = in.Clone(); CallChain::Symbol* rate = Rate.Clone(); // set name and reference for 1st parameter chain.AddSymbol("input", input); // set name and reference for 2nd parameter chain.AddSymbol("rate", rate); // Append call to action "tseries" chain.AppendCallFunction("tseries", par, "result"); chain.Execute(); // get pointer to output udt* out=chain.GetSymbol("result"); // get pointer to resulting Timeseries if ( udt::IsA >(*out) ) { TimeSeries* ts =&(udt::Cast >(*out)); } 3.2. Options/Defaults 4. Exceptions 4.1 Exceptions Thrown The Eval method may throw exceptions indicating an invalid action call syntax. 4.2 Exceptions Handled None. 5. Algorithms None. 6. Accuracy Non relevant. 7. Performance Non relevant. 8. Testing tTypeConversion.cc - checks proper assignment of data samples and sampling rate. 9. Notes This class is one of many similar classes implementing the CallChain::Function interface, each to handling a particular action. Code implementing the particular action syntax is found in the body of the Eval method. 10. See Also CallChain::Function, TimeSeries 11. References None.