4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Definition of inline template functions
25 #include "ParseListS.ih"
28 #include <boost/assert.hpp>
30 #define prefix_ inline
31 ///////////////////////////////cti.p///////////////////////////////////////
33 template <class Parser, class Sentinel, class Iterator, class IPacket>
34 prefix_ satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::Parse_ListS()
37 template <class Parser, class Sentinel, class Iterator, class IPacket>
39 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::Parse_ListS(Iterator const & i)
40 : ParserBase<Iterator,IPacket>(i)
43 template <class Parser, class Sentinel, class Iterator, class IPacket>
44 prefix_ typename satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::size_type
45 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::size()
48 return std::distance(begin(),end());
51 template <class Parser, class Sentinel, class Iterator, class IPacket>
52 prefix_ bool satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::empty()
55 return begin()==end();
58 template <class Parser, class Sentinel, class Iterator, class IPacket>
59 prefix_ typename satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::iterator
60 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::begin()
63 return iterator(this->i());
66 template <class Parser, class Sentinel, class Iterator, class IPacket>
67 prefix_ typename satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::iterator
68 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::end()
74 template <class Parser, class Sentinel, class Iterator, class IPacket>
75 prefix_ typename satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range_type
76 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range()
79 return std::make_pair(begin(),end());
82 template <class Parser, class Sentinel, class Iterator, class IPacket>
83 prefix_ typename satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range_type
84 satcom::pkf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::value()
90 ///////////////////////////////////////////////////////////////////////////
91 // satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>
93 template <class Parser, class Sentinel, class Iterator>
95 satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::Parse_ListS_iterator()
99 template <class Parser, class Sentinel, class Iterator>
101 satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::
102 Parse_ListS_iterator(Iterator const & i)
103 : i_(i), atEnd_(false)
105 atEnd_ = Sentinel::check(dereference());
108 template <class Parser, class Sentinel, class Iterator>
109 prefix_ Iterator satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::raw()
115 template <class Parser, class Sentinel, class Iterator>
117 satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::dereference()
123 template <class Parser, class Sentinel, class Iterator>
124 prefix_ bool satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::
125 equal(Parse_ListS_iterator const & other)
128 // !! We cannot compare the to iterators if either
129 // !! Iterator is atEnd_, since one of the iterators
130 // !! might be a default-constructed iterator and
131 // !! iterators can only be compared with each other
132 // !! if both point to the *same* valid container
133 if (atEnd_ || other.atEnd_) return atEnd_ == other.atEnd_;
134 return i_ == other.i_;
137 template <class Parser, class Sentinel, class Iterator>
138 prefix_ void satcom::pkf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::increment()
140 BOOST_ASSERT( !atEnd_ );
141 i_ += dereference().bytes();
142 atEnd_ = Sentinel::check(dereference());
145 ///////////////////////////////////////////////////////////////////////////
146 // satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>
148 template <class Parser, class Sentinel, class Container>
149 template <class P, class S, class I, class IP>
150 prefix_ satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::
151 Parse_ListS_wrapper(Parse_ListS<P,S,I,IP> const & list, Container & container)
152 : i_(list.i()-container.begin()), container_(container)
155 template <class Parser, class Sentinel, class Container>
156 prefix_ typename satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::size_type
157 satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::size()
160 return std::distance(begin(),end());
163 template <class Parser, class Sentinel, class Container>
164 prefix_ bool satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::empty()
167 return begin()==end();
170 template <class Parser, class Sentinel, class Container>
171 prefix_ typename satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::iterator
172 satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::begin()
175 return iterator(container_.begin()+i_);
178 template <class Parser, class Sentinel, class Container>
179 prefix_ typename satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::iterator
180 satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::end()
186 template <class Parser, class Sentinel, class Container>
187 prefix_ typename satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::range_type
188 satcom::pkf::Parse_ListS_wrapper<Parser,Sentinel,Container>::range()
191 return std::make_pair(begin(),end());
194 ///////////////////////////////cti.e///////////////////////////////////////
200 // c-file-style: "satcom"