#ifndef SOUNDDATA_H
#define SOUNDDATA_H
#include <iostream>
#include <string>
#include <vector>
namespace soundData
{
using std::ostream;
using std::istream;
using std::string;
using std::vector;
class FeatureVector
{
private:
vector<double> values_;
public:
//Accessors
int count() const;
double operator[](int i)const; // array accesor operator
double distanceTo( FeatureVector const& other ) const;
// Construction & destruction:
explicit FeatureVector( int n = 0 ); //explicit converting constructor
};
class Frame
{
public:
FeatureVector features;
// Modifiers:
friend void swap( Frame& a, Frame& b ); // this function can access the members of class
// Construction & destruction:
explicit Frame( int nFeatures );
};
class Frames
{
private:
vector<Frame> frames_;
int nFeaturesPerFrame_;
public:
// Accessors:
int count() const;
int nFeaturesPerFrame() const;
Frame const& operator[]( int i ) const;
// Modifiers:
Frame& addFrame();
friend void swap( Frames& a, Frames& b );
// Construction & destruction:
explicit Frames( int nFeaturesPerFrame = 0 );
};
/* void loadFrom(
istream& stream,
Frames& frames, ostream& log,
string const& streamName = "a text stream");*/
void loadFrom(
istream& stream,
Frames& frames,
string const& streamName = "a text stream",
// ostream should also have default parameter as streamName
ostream& log =std::clog); //std::clog create an object for ostream
void laodFromFile(
string const& fileName,
Frames& frames,
ostream& log =std::clog);
//name space soundData.
}
#endif // SOUNDDATA_H