HOPS
HOPS class reference
Public Member Functions | List of all members
hops::MHO_StationCodeMap Class Reference

Class MHO_StationCodeMap Handles the mapping of two character and one character station representation. This class can be initialized from a file, otherwise it assigns free 1-char codes based on the order in which stations are encountered. Optionally, we can enable some legacy station code assignments inherited from difx2mark4. More...

#include <MHO_StationCodeMap.hh>

Public Member Functions

 MHO_StationCodeMap (bool use_legacy_default_codes=false)
 
virtual ~MHO_StationCodeMap ()
 
std::vector< std::string > GetAllMk4Ids ()
 Getter for all mk4ids. More...
 
std::vector< std::string > GetAllStationCodes ()
 Getter for all station codes. More...
 
std::string GetMk4IdFromStationCode (std::string station_code)
 Getter for mk4id from station code. More...
 
std::string GetStationCodeFromMk4Id (std::string mk4id)
 Getter for station code from mk4id. More...
 
void InitializeStationCodes (std::string station_codes_file="")
 Initializes station codes by reading from a file and optionally using legacy codes. More...
 
std::string ToCanonicalCase (std::string token)
 Converts a given string token to canonical case (first character uppercase, second lowercase). More...
 
std::string ToLowerCase (std::string token)
 Converts a given string to lowercase while preserving non-alphabetic characters. More...
 
std::string ToUpperCase (std::string token)
 Converts a given string to uppercase while preserving non-alphabetic characters. More...
 
void UseLegacyCodes ()
 Sets legacy codes usage flag to true. More...
 

Detailed Description

Class MHO_StationCodeMap Handles the mapping of two character and one character station representation. This class can be initialized from a file, otherwise it assigns free 1-char codes based on the order in which stations are encountered. Optionally, we can enable some legacy station code assignments inherited from difx2mark4.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Thu Apr 28 12:25:09 2022 -0400

Constructor & Destructor Documentation

◆ MHO_StationCodeMap()

hops::MHO_StationCodeMap::MHO_StationCodeMap ( bool  use_legacy_default_codes = false)

◆ ~MHO_StationCodeMap()

hops::MHO_StationCodeMap::~MHO_StationCodeMap ( )
virtual

Member Function Documentation

◆ GetAllMk4Ids()

std::vector< std::string > hops::MHO_StationCodeMap::GetAllMk4Ids ( )

Getter for all mk4ids.

Returns
std::vector<std::string containing all Mk4 IDs.

◆ GetAllStationCodes()

std::vector< std::string > hops::MHO_StationCodeMap::GetAllStationCodes ( )

Getter for all station codes.

Returns
A vector of strings containing all unique station codes.

◆ GetMk4IdFromStationCode()

std::string hops::MHO_StationCodeMap::GetMk4IdFromStationCode ( std::string  station_code)

Getter for mk4id from station code.

Parameters
station_codeInput station code to retrieve mk4id
Returns
mk4id corresponding to input station_code

◆ GetStationCodeFromMk4Id()

std::string hops::MHO_StationCodeMap::GetStationCodeFromMk4Id ( std::string  mk4id)

Getter for station code from mk4id.

Parameters
mk4idInput Mk4 ID string to search for in the map.
Returns
Station code as a string if found; otherwise, an empty string.

◆ InitializeStationCodes()

void hops::MHO_StationCodeMap::InitializeStationCodes ( std::string  station_codes_file = "")

Initializes station codes by reading from a file and optionally using legacy codes.

Parameters
station_codes_filePath to the file containing station codes.

◆ ToCanonicalCase()

std::string hops::MHO_StationCodeMap::ToCanonicalCase ( std::string  token)

Converts a given string token to canonical case (first character uppercase, second lowercase).

Parameters
tokenInput string token to be converted
Returns
String token in canonical case

◆ ToLowerCase()

std::string hops::MHO_StationCodeMap::ToLowerCase ( std::string  token)

Converts a given string to lowercase while preserving non-alphabetic characters.

Parameters
tokenInput string to be converted to lowercase.
Returns
The input string converted to lowercase.

◆ ToUpperCase()

std::string hops::MHO_StationCodeMap::ToUpperCase ( std::string  token)

Converts a given string to uppercase while preserving non-alphabetic characters.

Parameters
tokenInput string to be converted to uppercase.
Returns
Uppercase version of the input string, preserving non-alphabetic characters.

◆ UseLegacyCodes()

void hops::MHO_StationCodeMap::UseLegacyCodes ( )
inline

Sets legacy codes usage flag to true.


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