iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::ValidValuesSpecRegex< T > Class Template Reference

#include <nrt/Core/Typing/ValidValuesSpec.H>

template<class T>
class nrt::ValidValuesSpecRegex< T >

Regex-based valid values spec, everything that is a match to the regex is considered valid.

Uses boost::regex internally (because std::regex is not fully supported by g++ yet). This allows for highly flexible valid values definitions. For example, say you want an int parameter to be in range [0..59] but it could also have value 72, your regex would be:


You can find on the web regex examples to match things like a valid filename, a valid URL, a valid credit card number, etc. Just make sure your regex is in the syntax expected by boost::regex since several syntaxes are floating around for regular expressions.

Definition at line 170 of file ValidValuesSpec.H.

Inheritance diagram for nrt::ValidValuesSpecRegex< T >:
nrt::ValidValuesSpecBase< T >

Public Member Functions

 ValidValuesSpecRegex ()=delete
 No default constructor, always need to provide a regex.
 ValidValuesSpecRegex (boost::regex const &valid_regex)
 Construct from a given regex that specifies valid values.
virtual ~ValidValuesSpecRegex ()
virtual bool checkValueValidity (T const &val) const
 Check whether a proposed value is valid, returns true iff value is a match against our regex.
virtual std::string const str () const
 Convert to a readable string. More...
- Public Member Functions inherited from nrt::ValidValuesSpecBase< T >
 ValidValuesSpecBase ()
 Construct, for the base class this is a no-op. More...
virtual ~ValidValuesSpecBase ()

Protected Attributes

boost::regex const itsValidRegex

Member Function Documentation

template<class T >
std::string const nrt::ValidValuesSpecRegex< T >::str ( ) const

Convert to a readable string.

Returns Regex:[expression] where expression is replaced by the actual regex.

Implements nrt::ValidValuesSpecBase< T >.

Definition at line 147 of file ValidValuesSpecImpl.H.

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