SafeIterator.cti
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief SafeIterator inline template implementation */
16 
17 #include "SafeIterator.ih"
18 
19 // Custom includes
20 
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::SafePacketParserWrapper<Parser>
26 
27 template <class Parser>
28 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper()
29  : parser_(), i_()
30 {}
31 
32 template <class Parser>
33 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper(Parser parser)
34  : parser_(parser), i_(parser)
35 {}
36 
37 template <class Parser>
38 prefix_ senf::SafePacketParserWrapper<Parser> & senf::SafePacketParserWrapper<Parser>::operator=(Parser parser)
39 {
40  parser_ = parser;
41  i_ = parser;
42  return *this;
43 }
44 
45 template <class Parser>
46 prefix_ Parser & senf::SafePacketParserWrapper<Parser>::operator*()
47  const
48 {
49  SENF_ASSERT( i_, "Dereferencing empty SafePacketParserWrapper" );
50  parser_->i_ = PacketParserBase::data_iterator(i_);
51  return *parser_;
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_ bool senf::SafePacketParserWrapper<Parser>::boolean_test()
65  const
66 {
67  return i_;
68 }
69 
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 #undef prefix_
72 
73 
74 // Local Variables:
75 // mode: c++
76 // fill-column: 100
77 // comment-column: 40
78 // c-file-style: "senf"
79 // indent-tabs-mode: nil
80 // ispell-local-dictionary: "american"
81 // compile-command: "scons -u test"
82 // End: