7 #ifndef VERSIONED_CSV_FILE_H 8 #define VERSIONED_CSV_FILE_H 33 const std::string& default_value =
"")
34 :
name_(name), version_(version), default_value_(default_value) {
154 void addColumn(
const std::string& col_name,
const std::string&
version,
155 const std::string& default_value =
"");
162 void setMinimumValidColumns(
const std::string& column_name);
166 size_t getMinimumValidColumns()
const;
169 size_t getInputHeaderCount()
const;
178 size_t getValidColumnCount()
const;
197 virtual void open(
const bool seek_to_end =
false);
208 virtual void recreate();
236 std::string getInputSchemaVersion()
const;
243 std::string getSchemaVersion()
const;
250 const VersionedColumnPtr& getVersionedColumn(
const size_t index)
const;
263 bool needsConversion()
const;
280 virtual bool validateHeader(
const CSVRow& header);
289 void columnCountError(
const CSVRow& row,
const std::string& reason);
293 std::vector<VersionedColumnPtr> columns_;
298 size_t valid_column_count_;
302 size_t minimum_valid_columns_;
307 size_t input_header_count_;
317 #endif // VERSIONED_CSV_FILE_H std::string default_value_
default_value The value the column should be assigned if it is not present in a data row...
InputSchemaState
Possible input file schema states.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Contains the metadata for a single column in a file.
virtual ~VersionedColumn()
Destructor.
boost::shared_ptr< VersionedColumn > VersionedColumnPtr
Defines a smart pointer to VersionedColumn.
VersionedColumn(const std::string &name, const std::string &version, const std::string &default_value="")
Constructor.
int version()
returns Kea hooks version.
Represents a single row of the CSV file.
Exception thrown when an error occurs during CSV file processing.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
Implements a CSV file that supports multiple versions of the file's "schema".
VersionedCSVFileError(const char *file, size_t line, const char *what)
Provides input/output access to CSV files.
std::string version_
Text representation of the schema version in which this column first appeared.