/** 
* @file ClusterAlgorithm.h
* @brief Interface for Cluster-Algorithms
* @author Erik Rodner, Alexander Freytag
* @date 10/29/2007 (last update on 12-02-2014 ( dd-mm-yyyy ) )
*/
#ifndef CLUSTERALGORITHMINCLUDE
#define CLUSTERALGORITHMINCLUDE

// nice-core includes
#include <core/basics/Exception.h>
#include <core/basics/Persistent.h>
#include <core/basics/Config.h>
// 
#include <core/vector/VectorT.h>
#include <core/vector/MatrixT.h>
#include <core/vector/VVector.h>


namespace OBJREC {

/** Interface for Cluster-Algorithms */
class ClusterAlgorithm : public NICE::Persistent
{

  protected:

  public:
    
    ///////////////////// ///////////////////// /////////////////////
    //                   CONSTRUCTORS / DESTRUCTORS
    ///////////////////// ///////////////////// /////////////////////        
    
    /** simple constructor */
    ClusterAlgorithm();
        
    /** simple destructor */
    virtual ~ClusterAlgorithm();
    
    /** 
     * @brief Jobs previously performed in the config-version of the constructor, read settings etc. -- nothing to do here
     * @author Alexander Freytag
     * @date 12-02-2014 ( dd-mm-yyyy )
     */    
    virtual void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "ClusterAlgorithm");    
    
    ///////////////////// ///////////////////// /////////////////////
    //                      CLUSTERING STUFF
    ///////////////////// ///////////////////// //////////////////    

    virtual void cluster ( 
            const NICE::VVector & features,
            NICE::VVector & prototypes,
            std::vector<double> & weights,
            std::vector<int>    & assignment ) = 0;
            
    ///////////////////// INTERFACE PERSISTENT /////////////////////
    // interface specific methods for store and restore
    ///////////////////// INTERFACE PERSISTENT /////////////////////

    /**
    * @brief Load object from external file (stream)  -- nothing to do here
    * @author Alexander Freytag
    * @date 12-02-2014 ( dd-mm-yyyy )
    */
    void restore ( std::istream & is, int format = 0 );

    /**
    * @brief Save object to external file (stream)  -- nothing to do here
    * @author Alexander Freytag
    * @date 12-02-2014 ( dd-mm-yyyy )
    */
    void store ( std::ostream & os, int format = 0 ) const;

    /**
    * @brief Clear object  -- nothing to do here
    * @author Alexander Freytag
    * @date 12-02-2014 ( dd-mm-yyyy )
    */
    void clear ();             
      
  };


} // namespace

#endif
