#include "Syslog.h"

#include "ClusterLoader.hh"

/*
 * class ClusterLoader
 */
void ClusterLoader::parseEvent(ArgList const &arg) {
  try {
    AbstractClassifier *classif = m_factory->get(arg.getId())(arg);
    m_loaded.push_back(classif);
  } /* catch(ParseError &pe) {
    throw;
  } catch(Exception &e) {
    throw ParseError(e.msg);
    } */
  catch(Exception &e) {
    // I don't want to quit if the trouble is just one cluster not created...
    // ... or do I ?
    Syslog::write("cluster : warning : exception while loading a %s cluster : %s", 
		  arg.getId().c_str(), e.msg);
  }
}

void ClusterLoader::clear() {
  while( !empty() ) {
    AbstractClassifier *to_del = pop_front();
    delete to_del;
  }
}
