MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::exceptions Namespace Reference

Classes

class  CustomException
 Base class for project-specific exceptions. More...
class  ModelCreationException
 Thrown when model creation fails. More...
class  ExportException
 Thrown when export fails. More...
class  ConsistencyException
 Thrown when a consistency check fails. More...
class  InvalidInputException
 Thrown when input values do not satisfy expected constraints. More...
class  ImportException
 Thrown when importing data fails. More...
class  VertexNotExistentException
 Thrown when a referenced vertex does not exist. More...
class  EdgeNotExistentException
 Thrown when a referenced edge does not exist. More...
class  TrainNotExistentException
 Thrown when a referenced train does not exist. More...
class  StationNotExistentException
 Thrown when a referenced station does not exist. More...
class  ScheduleNotExistentException
 Thrown when a referenced schedule does not exist. More...

Functions

void throw_if_less (double const value, double const threshold, std::string_view const name, bool inclusive)
 Validates that a value meets a minimum threshold constraint.
void throw_if_less_than (double const value, double const threshold, std::string_view const name)
 Throws if a value is less than a threshold.
void throw_if_less_than_or_equal (double const value, double const threshold, std::string_view const name)
 Validates that a value is greater than a threshold.
void throw_if_negative (double const value, std::string_view const name)
 Validates that a value is non-negative.
void throw_if_non_positive (double const value, double tolerance, std::string_view const name)
 Ensures a value is strictly greater than a tolerance.
void throw_if_non_positive (double const value, std::string_view const name)
 Validates that a value is strictly positive.
void throw_if_non_positive (int const value, std::string_view const name)
 Throws if an integer value is not strictly positive.
void throw_if_invalid_folder_name (std::string_view const folderName)
 Validates that a folder name is portable across Linux, Windows, and macOS.

Function Documentation

◆ throw_if_invalid_folder_name()

void cda_rail::exceptions::throw_if_invalid_folder_name ( std::string_view const folderName)
inline

Validates that a folder name is portable across Linux, Windows, and macOS.

This function uses a conservative allowlist to ensure portability. A folder name is accepted only if:

  • All characters are in: A-Z, a-z, 0-9, underscore (_), hyphen (-), dot (.), or space ( ).
  • It is not empty.
  • It is at most 255 characters.
  • It does not start with a space.
  • It does not end with a space or dot.
  • Its Windows base name (the part before the first dot, or the whole name if no dot exists) is not a reserved device name (case-insensitive): CON, PRN, AUX, NUL, COM1–COM9, LPT1–LPT9.
Parameters
folderNameThe folder name to validate.
Exceptions
InvalidInputExceptionif the folder name violates any of the above constraints.

◆ throw_if_less()

void cda_rail::exceptions::throw_if_less ( double const value,
double const threshold,
std::string_view const name,
bool inclusive )
inline

Validates that a value meets a minimum threshold constraint.

Parameters
valueValue to validate.
thresholdLower bound to enforce.
nameHuman-readable parameter name for the error message.
inclusiveIf true, requires value > threshold; if false, requires value >= threshold.
Exceptions
InvalidInputExceptionIf the constraint is violated.

◆ throw_if_less_than()

void cda_rail::exceptions::throw_if_less_than ( double const value,
double const threshold,
std::string_view const name )
inline

Throws if a value is less than a threshold.

Parameters
valueValue to validate.
thresholdInclusive lower bound.
nameHuman-readable parameter name used in the error message.
Exceptions
InvalidInputExceptionIf value < threshold.

◆ throw_if_less_than_or_equal()

void cda_rail::exceptions::throw_if_less_than_or_equal ( double const value,
double const threshold,
std::string_view const name )
inline

Validates that a value is greater than a threshold.

Parameters
valueValue to validate.
thresholdStrict lower bound (exclusive).
nameParameter name for the error message.
Exceptions
InvalidInputExceptionIf value is less than or equal to threshold.

◆ throw_if_negative()

void cda_rail::exceptions::throw_if_negative ( double const value,
std::string_view const name )
inline

Validates that a value is non-negative.

Parameters
nameHuman-readable parameter name used in the error message.
Exceptions
InvalidInputExceptionIf the value is negative.

◆ throw_if_non_positive() [1/3]

void cda_rail::exceptions::throw_if_non_positive ( double const value,
double tolerance,
std::string_view const name )
inline

Ensures a value is strictly greater than a tolerance.

Parameters
valueValue to validate.
toleranceStrict lower bound.
nameHuman-readable parameter name used in the error message.
Exceptions
InvalidInputExceptionIf value <= tolerance.

◆ throw_if_non_positive() [2/3]

void cda_rail::exceptions::throw_if_non_positive ( double const value,
std::string_view const name )
inline

Validates that a value is strictly positive.

Parameters
valueValue to validate.
nameParameter name used in the error message.
Exceptions
InvalidInputExceptionIf value is less than or equal to zero.

◆ throw_if_non_positive() [3/3]

void cda_rail::exceptions::throw_if_non_positive ( int const value,
std::string_view const name )
inline

Throws if an integer value is not strictly positive.

Parameters
valueValue to validate.
nameHuman-readable parameter name used in the error message.
Exceptions
InvalidInputExceptionIf value <= 0.