TLVParser.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 TLVParser inline template implementation */
16 
17 // Custom includes
18 
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
21 
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::MIHFIdTLVParser::binaryNAIEncoder<OutputIterator>
24 
25 template <class OutputIterator>
26 prefix_ senf::MIHFIdTLVParser::binaryNAIEncoder<OutputIterator>::binaryNAIEncoder(OutputIterator & i)
27  : i_(i)
28 {}
29 
30 template <class OutputIterator>
31 prefix_ void senf::MIHFIdTLVParser::binaryNAIEncoder<OutputIterator>::operator()(boost::uint8_t v)
32 {
33  *i_++ = '\\';
34  *i_++ = v;
35 }
36 
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
38 // senf::MIHFIdTLVParser
39 
40 template <class OutputIterator>
41 prefix_ boost::function_output_iterator<senf::MIHFIdTLVParser::binaryNAIEncoder<OutputIterator> >
42 senf::MIHFIdTLVParser::getNAIEncodedOutputIterator(OutputIterator & i)
43 {
44  return boost::make_function_output_iterator(binaryNAIEncoder<OutputIterator>(i));
45 }
46 
47 template <class Iterator>
48 prefix_ boost::filter_iterator<senf::MIHFIdTLVParser::binaryNAIDecoder, Iterator>
49 senf::MIHFIdTLVParser::getNAIDecodedIterator(Iterator begin, Iterator end)
50 {
51  return boost::make_filter_iterator<binaryNAIDecoder>(begin, end);
52 }
53 
54 
55 //-/////////////////////////////////////////////////////////////////////////////////////////////////
56 #undef prefix_
57 
58 
59 // Local Variables:
60 // mode: c++
61 // fill-column: 100
62 // comment-column: 40
63 // c-file-style: "senf"
64 // indent-tabs-mode: nil
65 // ispell-local-dictionary: "american"
66 // compile-command: "scons -u test"
67 // End: