$darkmode
cloe::controller::Checker Class Referenceabstract
Inheritance diagram for cloe::controller::Checker:
Collaboration diagram for cloe::controller::Checker:

Public Member Functions

 Checker (const std::string &name)
 
size_t num_failures () const
 
virtual void set_fail_callback (std::function< void(const Sync &s)> f)
 
virtual void enroll (Registrar &)
 
virtual void fail (const Sync &s, std::string &&name, Json &&j)
 
virtual void init (const Sync &, const Vehicle &)
 
virtual void check (const Sync &s, const Vehicle &v)=0
 
- Public Member Functions inherited from cloe::Entity
 Entity (std::string name)
 
 Entity (std::string name, std::string desc)
 
const std::string & name () const
 
void set_name (std::string name)
 
const std::string & description () const
 
void set_description (std::string desc)
 
- Public Member Functions inherited from fable::Confable
 Confable (const Confable &) noexcept
 
 Confable (Confable &&) noexcept=default
 
Confableoperator= (const Confable &other) noexcept
 
Confableoperator= (Confable &&other) noexcept
 
virtual void reset_schema ()
 
Schemaschema ()
 
const Schemaschema () const
 
virtual void validate_or_throw (const Conf &c) const
 
virtual bool validate (const Conf &c, std::optional< SchemaError > &err) const
 
virtual void from_conf (const Conf &c)
 
virtual void to_json (Json &j) const
 
Json to_json () const
 

Protected Member Functions

virtual void private_fail (const Sync &)
 
- Protected Member Functions inherited from cloe::Entity
virtual Logger logger () const
 
- Protected Member Functions inherited from fable::Confable
virtual Schema schema_impl ()
 

Protected Attributes

size_t num_failures_ {0}
 
std::map< std::string, std::vector< FailurePtr > > failures_ {}
 
std::function< void(const Sync &s)> failure_callback_
 
- Protected Attributes inherited from cloe::Entity
std::string name_
 
std::string desc_
 

Member Function Documentation

◆ private_fail()

virtual void cloe::controller::Checker::private_fail ( const Sync )
inlineprotectedvirtual

Trigger any private events on type-specific failure.

This is called during the fail() method and provides a way to add a private event trigger in addition to the generic Failure event. Using this method instead of overriding fail() provides us two advantages:

  1. The fail() method can print an error message first, then raise the type-specific event, followed by the generic failure event.
  2. This approach is less error prone, because implementing fail() requires the developer to remember to call Checker::fail().

Reimplemented in cloe::controller::MissingLaneBoundariesChecker, cloe::controller::SafetyChecker, and cloe::controller::RationalityChecker.


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