/**
* @file testLabeledSet.cpp
* @brief test multidataset
* @author Erik Rodner
* @date 03/03/2008

*/
#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"
#include "core/image/ImageT.h"

#include <core/basics/Config.h>
#include <vislearning/baselib/cmdline.h>

#include <vislearning/cbaselib/MultiDataset.h>

using namespace OBJREC;
using namespace NICE;
using namespace std;


/**

    test multidataset

*/
int main ( int argc, char **argv )
{
#ifndef __clang__
#ifndef __llvm__
  std::set_terminate ( __gnu_cxx::__verbose_terminate_handler );
#endif
#endif

  char configfile [300];

  struct CmdLineOption options[] = {
    {"config", "use config file", NULL, "%s", configfile},
    {NULL, NULL, NULL, NULL, NULL}
  };
  int ret;
  char *more_options[argc];
  ret = parse_arguments ( argc, ( const char** ) argv, options, more_options );

  if ( ret != 0 )
  {
    if ( ret != 1 ) fprintf ( stderr, "Error parsing command line !\n" );
    exit ( -1 );
  }

  Config conf ( configfile );

  MultiDataset md ( &conf );

  const LabeledSet *train = md["train"];
  const LabeledSet *test = md["test"];
  const ClassNames & cn = md.getClassNames ( "train" );


  fprintf ( stderr, "Training Dataset\n" );
  LOOP_ALL_S ( *train )
  {
    EACH_S ( classno, fn );
    fprintf ( stderr, "%s %s\n", cn.text ( classno ).c_str(), fn.c_str() );
  }

  fprintf ( stderr, "Test Dataset\n" );
  LOOP_ALL_S ( *test )
  {
    EACH_S ( classno, fn );
    fprintf ( stderr, "%s %s\n", cn.text ( classno ).c_str(), fn.c_str() );
  }



  return 0;
}