49c84c7c81648a30768a270989fb79991cc8c663
[senf.git] / senf / Packets / SafeIterator.cti
1 // $Id$
2 //
3 // Copyright (C) 2008
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief SafeIterator inline template implementation */
25
26 //#include "SafeIterator.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32
33 //-/////////////////////////////////////////////////////////////////////////////////////////////////
34 // senf::SafePacketParserWrapper<Parser>
35
36 template <class Parser>
37 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper()
38     : parser_(), i_()
39 {}
40
41 template <class Parser>
42 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper(Parser parser)
43     : parser_(parser), i_(parser)
44 {}
45
46 template <class Parser>
47 prefix_ senf::SafePacketParserWrapper<Parser> & senf::SafePacketParserWrapper<Parser>::operator=(Parser parser)
48 {
49     parser_ = parser;
50     i_ = parser;
51     return *this;
52 }
53
54 template <class Parser>
55 prefix_ Parser & senf::SafePacketParserWrapper<Parser>::operator*()
56     const
57 {
58     SENF_ASSERT( i_, "Dereferencing empty SafePacketParserWrapper" );
59     parser_->i_ = PacketParserBase::data_iterator(i_);
60     return *parser_;
61 }
62
63 template <class Parser>
64 prefix_ Parser * senf::SafePacketParserWrapper<Parser>::operator->()
65     const
66 {
67     SENF_ASSERT( i_, "Dereferencing empty SafePacketParserWrapper" );
68     parser_->i_ = PacketParserBase::data_iterator(i_);
69     return & (*parser_);
70 }
71
72 template <class Parser>
73 prefix_ bool senf::SafePacketParserWrapper<Parser>::boolean_test()
74     const
75 {
76     return i_;
77 }
78
79 //-/////////////////////////////////////////////////////////////////////////////////////////////////
80 #undef prefix_
81
82 \f
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // comment-column: 40
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u test"
91 // End: