#ifndef NUMDATA_HH #define NUMDATA_HH //////////////////////////////////////////////////////////////////////////// //! author="Robert Crida" //! lib=NumData //! date="27/2/1998" //! userlevel=Normal //! docentry="Pattern Recognition.Data Types;Numerical Methods.Data Types" //! file="amma/PatternRec/Data/NumData.hh" //! rcsid="$Id: NumData.hh,v 1.20 2000/02/16 14:09:59 ees1cg Exp $" #include "amma/Num/NumLabel.hh" // -------------------------------------------------------------------------- // ********** NumDataC **************************************************** // -------------------------------------------------------------------------- //: Stores data value tuples for use in data sets within PatternRec // // NumDataC is a template class for storing data value // tuples. The object should be interpreted as a corresponding input/output // pair.

// // Base class in the PatternRec hierarchy and is used for creating data sets // for representing training and test data. See NumDataSetC // for how it is used. template class NumDataC { public: NumDataC (); //: Default constructor // Calls default constructors of member data. NumDataC (const InputC &input, const OutputC &output); //: Constructor taking the input and output values NumDataC (istream &in); //: Constructs from stream NumDataC (const NumDataC &oth); //: Copy constructor // Makes a shallow copy. NumDataC Copy () const; //: Makes a deep copy const InputC & Input () const; //: Const access to the input value const OutputC & Output () const; //: Const access to the output value InputC & Input (); //: Access to the input value OutputC & Output (); //: Access to the output value void Save (ostream &out) const; //: Writes object to stream, can be loaded using constructor private: InputC _input; OutputC _output; }; template ostream &operator<<(ostream &out,const NumDataC &dat) { out << dat.Input() << " " << dat.Output(); return out; } template istream &operator>>(istream &in,NumDataC &dat) { dat = NumDataC(in); return in; } ////////////////////////////////////////////////////// template NumDataC::NumDataC () {} template NumDataC::NumDataC (const InputC &input, const OutputC &output) :_input(input), _output(output) {} template NumDataC::NumDataC (istream &in) { in >> _input >> _output; } template NumDataC::NumDataC (const NumDataC &oth) :_input(oth._input), _output(oth._output) {} template NumDataC NumDataC::Copy () const { return NumDataC (_input,_output); } template const InputC & NumDataC::Input () const { return _input; } template const OutputC & NumDataC::Output () const { return _output; } template InputC & NumDataC::Input () { return _input; } template OutputC & NumDataC::Output () { return _output; } template void NumDataC::Save (ostream &out) const { out << _input << "\n" << _output << "\n"; } #endif