/***************************************************************************
                          Transformation.h  -  description
                             -------------------
    begin                : Di Feb 15 2005
    copyright            : (C) 2005 by klaus frieler
    email                : kgf@omniversum.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef _LIBMELODY_TRANSFORMATION_H
#define _LIBMELODY_TRANSFORMATION_H
#include "types.h"
#include "Vector.h"
#include "Melody.h"

namespace Transformations{
enum TransformationType{ none = 0, ioi, ooi, intervals, absIntervals};

class Transformation
{
public:
   Transformation(const Melody* pMel):m_pMel(pMel){}
   virtual ~Transformation(){}

   virtual MRESULT get(Vector& ret);
   
   bool     isValid()const{ return m_pMel != 0;}


protected:
   const Melody  *m_pMel;
   Vector         m_cache;

   virtual MRESULT getData(Vector& ret)const = 0;

private:
};

class TransformationFactory
{
public:
   TransformationFactory(){}
   ~TransformationFactory(){}

   MRESULT        Create(Transformation **ppTransformation, const TransformationType type, const Melody* pMel);
   MRESULT        Destroy(Transformation **ppTransformation);


protected:

};

class IOI: public Transformation
{
public:
   IOI(const Melody* pMel):Transformation(pMel){}

protected:
   virtual MRESULT getData(Vector& ret)const;

};

class OOI: public Transformation
{
public:
   OOI(const Melody* pMel):Transformation(pMel){}

protected:
   virtual MRESULT getData(Vector& ret)const;

};

class PitchIntervals: public Transformation
{
public:
   PitchIntervals(const Melody* pMel):Transformation(pMel){}

protected:
   virtual MRESULT getData(Vector& ret)const;


};

class AbsPitchIntervals: public PitchIntervals
{
public:
   AbsPitchIntervals(const Melody* pMel):PitchIntervals(pMel){}

protected:
   virtual MRESULT getData(Vector& ret)const;

};

class AverageIOI: public IOI
{
public:
   AverageIOI(const Melody* pMel): IOI(pMel){}

protected:
   virtual MRESULT getData(Vector& ret)const;

};

}//namespace
#endif

