X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FParseListS.hh;h=63d3ff1c86e9b9fcb3acc261e3771544ca1d7d2a;hb=9a988902090d28007578e93bffd809f6bd913155;hp=2c75016b4b4d37692b25c7152690c2d6fa145de7;hpb=c52cd7d87dbb525c1267aad27391b8b7365dbb57;p=senf.git diff --git a/Packets/ParseListS.hh b/Packets/ParseListS.hh index 2c75016..63d3ff1 100644 --- a/Packets/ParseListS.hh +++ b/Packets/ParseListS.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -20,6 +20,36 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + + \idea Add an optional state to the sentinel and an optional + transition function. See ParseListS.hh for more. + + We should write a baseclass for sentinels which has no \c check() + member, an empty \c next() member and \c void as the state + type. This simplifies writing simple sentinels. + + The parse_listS iterator will have to pass the state in addition + to the current list element to \c check(). The \c next() member + will be invoked to advance the iterator. It is passer the current + element and a (non-const) reference to the state which it may + update. The Parse_ListS constructor must take an arbitrary number + of additional arguments which are forwarded to the state + initialization. + + This structure makes it simple to optimize away the overhead if + the state type is void. If we would always instantiate the + sentinel, this will always take up space. + + Another possibility would be to always instantiate the sentinel + and make the baseclass mandatory. The baseclass would then hold + the current raw iterator. The iterator itself would ONLY include a + single sentinel instance .. I think, this is the best solution, + sentinel members then have intrinsic access to the + state. Arguments are forwarded from the list constructor to the + Sentinel constructor. + */ + #ifndef HH_ParseListS_ #define HH_ParseListS_ 1 @@ -32,12 +62,12 @@ //#include "ParseListS.mpp" ///////////////////////////////hh.p//////////////////////////////////////// -namespace satcom { -namespace pkf { +namespace senf { + template class Parse_ListS_wrapper; - namespace impl { - template class Parse_ListS_iterator; + namespace impl { + template class Parse_ListS_iterator; } template @@ -46,13 +76,13 @@ namespace pkf { /////////////////////////////////////////////////////////////////////////// // Parser interface - template + template struct rebind { typedef Parse_ListS parser; }; typedef Iterator byte_iterator; - + Parse_ListS(); Parse_ListS(Iterator const & i); - + unsigned bytes() const; bool check(Iterator const & e) const; void init() const; @@ -83,7 +113,7 @@ namespace pkf { }; /** \brief - + Holds a reference to the container ! */ template @@ -132,25 +162,25 @@ namespace pkf { ///\name Mutators ///@{ - template void insert(iterator pos, Value const & t); - template void insert(iterator pos, size_type n, Value const & t); - template void insert(iterator pos, InputIterator f, InputIterator l); - - void erase(iterator pos, size_type n=1); - void erase(iterator f, iterator l); - void clear(); + template void insert(iterator pos, Value const & t); + template void insert(iterator pos, size_type n, Value const & t); + template void insert(iterator pos, InputIterator f, InputIterator l); + + void erase(iterator pos, size_type n=1); + void erase(iterator f, iterator l); + void clear(); ///@} protected: private: - + size_type i_; Container & container_; }; -}} +} ///////////////////////////////hh.e//////////////////////////////////////// //#include "ParseListS.cci" @@ -161,5 +191,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: