Skip to content
Snippets Groups Projects
BaseConfig.hpp 975 B
Newer Older
#ifndef BASECONFIG__H
#define BASECONFIG__H

#include <string>
#include <vector>
#include <unordered_map>
#include <boost/flyweight.hpp>
#include "util.hpp"
#include "Config.hpp"

class SubConfig;

class BaseConfig : public Config
{
  private :

  std::vector<std::string> colIndex2Name;
  std::unordered_map<std::string, int> colName2Index;

  Utf8String rawInputUtf8;

  private :

  void readMCD(std::string_view mcdFilename);
  void readRawInput(std::string_view rawFilename);
  void readTSVInput(std::string_view tsvFilename);

  public :

  BaseConfig(std::string_view mcdFilename, std::string_view tsvFilename, std::string_view rawFilename);

  std::size_t getNbColumns() const override;
  std::size_t getFirstLineIndex() const override;
  std::size_t getColIndex(const std::string & colName) const override;
  bool hasColIndex(const std::string & colName) const override;
  const std::string & getColName(int colIndex) const override;

  friend SubConfig;
};

#endif