ROOT
ROOT project
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Protected Member Functions | Friends | List of all members
ReaderBase Class Referenceabstract

Base class for Reader classes. More...

#include <reader.hpp>

Inheritance diagram for ReaderBase:
Inheritance graph
Collaboration diagram for ReaderBase:
Collaboration graph

Public Member Functions

virtual ~ReaderBase ()=default
 Virtual destructor for ReaderBase.
 
virtual std::unique_ptr< ConfigBaseread (CLI::App *app, bool verbose)=0
 Read the configuration from the input.
 

Public Attributes

std::string filename
 The input filename to read from.
 
char sep
 Field separator character.
 
char quote
 Quote/delimiter character.
 

Static Protected Member Functions

static std::string trim (const std::string &untrimmed_str)
 Helper static method to trim leading and trailing whitespace from a string.
 
static bool parseBool (const std::string &bool_str, bool &out)
 Helper static method to parse a boolean value from a string.
 
static bool parseDouble (const std::string &double_str, double &out)
 Helper static method to parse a double value from a string.
 
static bool parseInt (const std::string &int_str, int &out)
 Helper static method to parse an integer value from a string.
 
static bool parseMethod (const std::string &method_str, Method &out)
 Helper static method to parse a Method enum value from a string.
 
static std::unique_ptr< ConfigBasemake_config_from_map (const std::unordered_map< std::string, std::string > &config_map)
 Helper static method to create a ConfigBase object from a map of string key-value pairs.
 

Friends

class ReaderBaseTester
 Friend test fixture class for unit testing.
 

Detailed Description

Base class for Reader classes.

This abstract base class defines the interface for Reader classes that read configuration data from various file formats (e.g., CSV, DAT) and produce ConfigBase objects.

Constructor & Destructor Documentation

◆ ~ReaderBase()

virtual ReaderBase::~ReaderBase ( )
virtualdefault

Virtual destructor for ReaderBase.

Member Function Documentation

◆ make_config_from_map()

std::unique_ptr< ConfigBase > ReaderBase::make_config_from_map ( const std::unordered_map< std::string, std::string > &  config_map)
staticprotected

Helper static method to create a ConfigBase object from a map of string key-value pairs.

Parameters
config_mapThe map containing configuration key-value pairs.
Returns
A unique pointer to a ConfigBase object representing the configuration.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseBool()

bool ReaderBase::parseBool ( const std::string &  bool_str,
bool &  out 
)
staticprotected

Helper static method to parse a boolean value from a string.

Parameters
bool_strThe input string representing a boolean value.
outA reference to store the parsed boolean value.
Returns
true if parsing was successful, false otherwise.
Here is the caller graph for this function:

◆ parseDouble()

bool ReaderBase::parseDouble ( const std::string &  double_str,
double &  out 
)
staticprotected

Helper static method to parse a double value from a string.

Parameters
double_strThe input string representing a double value.
outA reference to store the parsed double value.
Returns
true if parsing was successful, false otherwise.
Here is the caller graph for this function:

◆ parseInt()

bool ReaderBase::parseInt ( const std::string &  int_str,
int &  out 
)
staticprotected

Helper static method to parse an integer value from a string.

Parameters
int_strThe input string representing an integer value.
outA reference to store the parsed integer value.
Returns
true if parsing was successful, false otherwise.
Here is the caller graph for this function:

◆ parseMethod()

bool ReaderBase::parseMethod ( const std::string &  method_str,
Method out 
)
staticprotected

Helper static method to parse a Method enum value from a string.

Parameters
method_strThe input string representing a Method.
outA reference to store the parsed Method value.
Returns
true if parsing was successful, false otherwise.
Here is the caller graph for this function:

◆ read()

virtual std::unique_ptr< ConfigBase > ReaderBase::read ( CLI::App *  app,
bool  verbose 
)
pure virtual

Read the configuration from the input.

Parameters
appThe CLI app subcommand containing the options for a specific input type.
Returns
A unique pointer to a ConfigBase object representing the read configuration.

Implemented in ReaderCSV, ReaderDAT, and ReaderCLI.

◆ trim()

std::string ReaderBase::trim ( const std::string &  untrimmed_str)
staticprotected

Helper static method to trim leading and trailing whitespace from a string.

Parameters
untrimmed_strThe input string to be trimmed.
Returns
The trimmed string.
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ ReaderBaseTester

friend class ReaderBaseTester
friend

Friend test fixture class for unit testing.

Member Data Documentation

◆ filename

std::string ReaderBase::filename

The input filename to read from.

◆ quote

char ReaderBase::quote

Quote/delimiter character.

◆ sep

char ReaderBase::sep

Field separator character.


The documentation for this class was generated from the following files: