X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FAnnotationRouter.hh;h=705eb8dab9406163b9abc4d863008d88e426550f;hb=b8ca4a544cce3e6023bb56b712a03d6362f2bb79;hp=a186fd5eb5766cc3e008ff3fcddfab304738173f;hpb=412024ed31a4ab4eaea7a4165a434f8efebee325;p=senf.git diff --git a/PPI/AnnotationRouter.hh b/PPI/AnnotationRouter.hh index a186fd5..705eb8d 100644 --- a/PPI/AnnotationRouter.hh +++ b/PPI/AnnotationRouter.hh @@ -28,6 +28,7 @@ // Custom includes #include +#include "../Utils/String.hh" #include "Module.hh" #include "Connectors.hh" @@ -38,18 +39,21 @@ namespace senf { namespace ppi { namespace module { - /** \brief Route packets to destination according to some annotation value + /** \brief %Route packets to destination according to some annotation value This router takes packet on a single input and directs them to one of it outputs depending - on a packet annotation. Each output connected will be associated with a single annotation - value. Incoming packets for which no matching output is found are directed to a default - output. If this output is left unconnected, those packets will be dropped. + on a \ref packet_usage_annotation "packet annotation". Each output connected + will be associated with a single annotation value. Incoming packets for which no matching + output is found are directed to a default output. If this output is left unconnected, those + packets will be dropped. The \a AnnotationType template parameter defines the routing key. This annotation must support the following operations: - \li Comparison with '<' - \li Copy-construction - \li Output streaming to an ostream via '<<' + \li Comparison with '<' (\c LessThanComparable concept) + \li Copy construction and copy assignment (\c Copyable und \c Assignable concepts) + (e.g. via compiler synthesized copy constructor and assignment operator) + \li Output streaming to an ostream via '\c <<' (for error description purposes) (\c + OutputStreamable concept) The following annotation can be used to route the packets according to a mac address. \code @@ -72,7 +76,7 @@ namespace module { mac address and allows to pass a senf::MACAddress value as routing key directly: \code - senf::ppi::module::AnnotationRouter router; + senf::ppi::module::AnnotationRouter router; senf::ppi::connect(router, target1, senf::MACAddress::from_string("00:1a:2b:04:06:08")); \endcode @@ -100,8 +104,8 @@ namespace module { struct DuplicateKeyException : public senf::Exception { DuplicateKeyException(AnnotationType const & key) - : senf::Exception("Duplicate senf::ppi::module::AnnotationRouter routing key") - { append(boost::lexical_cast(key)); } }; + : senf::Exception("Duplicate senf::ppi::module::AnnotationRouter routing key ") + { append( senf::str(key)); } }; private: connector::ActiveOutput<> & newOutput(AnnotationType const & key);