Utilities

class

Class for keeping track of expected times for operations.

Example usage:

using namespace std::literals::chrono_literals;

Timeout timeout(2s);
try {
    doAThing();
    timeout.check();
    do {
        keepGoing();
        timeout.check();
    } while (stillGoing())
} catch(Timeout::Expired) {
    std::cout << "took too long" << std::endl;

Public Functions

Timeout::Timeout(duration_type duration)

create a timeout duration in the future

Timeout::Timeout(clock::time_point end)

create a timeout ending at end

void Timeout::check() const

check if the timeout has expired, and throw Expired if so

void Timeout::wait() const

wait for the timeout to expire

class

Inherits from exception

class

Heirarchical logger, use to produce indented logs.

Public Functions

Logger::~Logger()

upon destruction, log either “[done]” or “[threw]”

Logger Logger::child(std::string name)

create a sublogger of this logger

void Logger::checkpoint(Robot &r, std::string id)

record a checkpoint. Scope for stopping the robot and waiting for user interaction

int Logger::depth() const

the depth of this logger - used for indentation

Public Static Functions

static Logger &Logger::active()

get the current active logger

Friends

template <typename T>
std::ostream &operator<<(Logger &logger, const T &t)

Output content to the logger, prefixed with appropriate indentation.

class