X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FParserBase.hh;h=6cf4f8e736d766f6855417a70365b6737cd775ff;hb=9a988902090d28007578e93bffd809f6bd913155;hp=cb2eccea7bd2aad49e24bbdea508da5e29578b18;hpb=1835b928b179302ecb716d697fbf3fa24b415ba4;p=senf.git diff --git a/Packets/ParserBase.hh b/Packets/ParserBase.hh index cb2ecce..6cf4f8e 100644 --- a/Packets/ParserBase.hh +++ b/Packets/ParserBase.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -35,23 +35,23 @@ #include "ParserBase.ih" ///////////////////////////////hh.p//////////////////////////////////////// -namespace satcom { -namespace pkf { - +namespace senf { + + namespace impl { struct ParserBase; } - struct nil - : public boost::iterator_facade + struct nil + : public boost::iterator_facade { - // Theese are declared to make nil a valid iterator. All - // access to an instance of this iterator however is invalid - // (these members are not implemented only declared) - char & dereference() const; - bool equal(nil other) const; - void increment(); - void decrement(); - void advance(int n); - int distance_to(nil other) const; + // Theese are declared to make nil a valid iterator. All + // access to an instance of this iterator however is invalid + // (these members are not implemented only declared) + char & dereference() const; + bool equal(nil other) const; + void increment(); + void decrement(); + void advance(int n); + int distance_to(nil other) const; }; /** \brief Parser framework @@ -77,11 +77,11 @@ namespace pkf { To implement a new parser, write a template implementing the following members: - + \code template struct Parser_Example - : protected satcom::pkf::ParserBase + : protected senf::ParserBase { // fixed interface of all parser classes @@ -91,7 +91,7 @@ namespace pkf { Parse_Example() {} Parse_Example(Iterator const & i) : ParserBase(i) {} - + [static] unsigned bytes() { // return the size of the parsed header. This @@ -107,7 +107,7 @@ namespace pkf { // return true, if the data in the range [begin,end) // can be safely interpreted by the parser without // causing invalid memory access. This means, - // check, wether the data is truncated + // check, whether the data is truncated return static_cast(end-begin) >= bytes(); } @@ -141,9 +141,9 @@ namespace pkf { Parse_Field2 field2() const { return Parse_Field2 (this->i()+2); } }; \endcode - + Every parser must have some mandatory fixed members which are: - + - struct rebind: This structure allows the parser to be converted to a parser of the same type but with a different iterator. Parser may have more than the two standard @@ -153,10 +153,10 @@ namespace pkf { parameters must be provided from the outside template - byte_iterator: A typedef for the Iterator class used - + - Non Iterator constructor: This constructor is only used when the parser is inherited into a Packet class. - + - Iterator constructor: This constructor must call the corresponding ParserBase constructor. @@ -223,7 +223,7 @@ namespace pkf { /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ - + // default default constructor // default copy constructor // default copy assignment @@ -237,7 +237,7 @@ namespace pkf { static void init() {}; private: - + }; template @@ -263,15 +263,15 @@ namespace pkf { static void init() {} template static void init(typename SomePacket::ptr) {} - + private: Iterator i_; }; /** \brief Addtiional Parser information - - Parser_traits provids abstract information about an unknown + + Parser_traits provides abstract information about an unknown parser. Besides the information already available within the Parser it provides an additional 'fixed_sized' member which is true if and only if the Parser has a static bytes() member. @@ -293,8 +293,8 @@ namespace pkf { template unsigned min_bytes(); - -}} + +} ///////////////////////////////hh.e//////////////////////////////////////// //#include "ParserBase.cci" @@ -305,5 +305,8 @@ namespace pkf { // Local Variables: // mode: c++ -// c-file-style: "satcom" +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" // End: