/**
* @file MultiDataset.h
* @brief multiple datasets
* @author Erik Rodner
* @date 02/08/2008

*/
#ifndef MULTIDATASETINCLUDE
#define MULTIDATASETINCLUDE

#include <string>
#include <map>


#include <core/basics/Config.h>


#include "LabeledSetSelection.h"
#include "LabeledFileList.h"
#include "LabeledSetFactory.h"
#include "LabeledSet.h"
#include "ClassNames.h"


namespace OBJREC {

/** multiple datasets */
class MultiDataset
{

protected:
    LabeledFileList lfl;
    std::map<std::string, ClassNames> classnames;
    std::map<std::string, LabeledSet> datasets;

    void selectExamples ( const std::string & examples_command,
                          const LabeledSet & base,
                          LabeledSet & positives,
                          LabeledSet & negatives,
                          const ClassNames & cn ) const;

    public:
  
    /** Create a new data set consiting of multiple datasets.
     *
     * @param pSetFactory factory for creating the right loading object (@see LabeledSetCreatorInterface) for a specified xml config file.
     *                      The factory is used when the log tag "factoryxml = < file >.xml" is specified in section " [main] ".
     *  @see LabeledFileList::get()
     */
    MultiDataset( const NICE::Config *conf, LabeledSetFactory *pSetFactory = NULL );
      
	/** simple destructor */
	virtual ~MultiDataset();
    
    /** access class information, e.g., md.getClassNames("train") */
    const ClassNames & getClassNames ( const std::string & key ) const;
    
    ClassNames & getClassNamesNonConst ( const std::string & key );

    /** access stored dataset by name, e.g., md["train"], if you have a [train] section
      * in your config file */
    const LabeledSet * operator[] ( const std::string & key ) const;

    const LabeledSet * at ( const std::string & key ) const;

};


} // namespace

#endif
