#ifndef CLUSTER_CLUSTER_HH
# define CLUSTER_CLUSTER_HH

# include "PeriodicTask.h"

# include "devices/DevicesManager.hh"
# include "classifiers/ClusterLoader.hh"
# include "ClusterLogger.hh"

# define ClusterName "cluster" 
#define CLUSTER_PERIOD 500 



/** @brief Cluster main task
 *
 * This class implements the control loop used by cluster
 * to classify data.
 *
 * @author Frederic Py <fpy@mbari.org>
 */
class Cluster :public PeriodicTask {
public:
  /** @brief Constructor
   *
   * @param millisec periodicity of the task
   */
  Cluster(int millisec);
  /** @brief Destructor.
   */
  ~Cluster();

  /** @brief Load configuration
   *
   * @param fileName
   *
   * This method generate the classifiers based on the
   * content of @e fileName
   *
   * @throw ParseError error while parsing @e fileName
   */
  void loadConfig(Symbol const &fileName) /* throw(ParseError) */;

private:
  /** @brief periodic callback
   *
   * This method is called periodically to do all the classifications
   */
  void callback();

  /** @brief Classifiers
   *
   * This is the list of all classifiers managed by this class
   */
  std::list<AbstractClassifier *> m_classifiers;
  /** @brief devices
   *
   * an entry point used to update alle the devices
   * used by the classifiers
   */
  SingletonUse<DevicesManager> m_devices;
  /** @brief Configuration loader.
   *
   * This class is used to load the configuration
   */
  ClusterLoader m_loader;
  /** @brief data log file
   *
   * This class is used to log periodically the result from classifiers
   */
  ClusterLogger m_log;
}; // Cluster

#endif // CLUSTER_CLUSTER_HH
