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
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
15 \brief VectorParser non-inline template implementation */
17 #include "VectorParser.ih"
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::VectorParser<ElementParser,AuxPolicy>
27 template <class ElementParser, class AuxPolicy>
28 prefix_ void senf::VectorParser<ElementParser,AuxPolicy>::init()
31 AuxPolicy::aux(0, i(), state());
33 iterator const e (end());
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 // senf::VectorParser_Container<ElementParser,AuxPolicy>
41 template <class ElementParser, class AuxPolicy>
42 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::init()
46 iterator const e (end());
53 template <class ElementParser, class AuxPolicy>
54 prefix_ typename senf::VectorParser_Container<ElementParser,AuxPolicy>::iterator
55 senf::VectorParser_Container<ElementParser,AuxPolicy>::shift(iterator pos, size_type n)
57 size_type ix (std::distance(data().begin(),pos.raw()));
59 data().insert(pos.raw(),n*ElementParser::fixed_bytes,0);
60 return iterator(boost::next(data().begin(),ix),state());
63 template <class ElementParser, class AuxPolicy>
64 template <class Value>
65 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::insert(iterator pos,
69 for (iterator j (shift(pos,n)); n; --n, ++j)
74 template <class ElementParser, class AuxPolicy>
75 template <class ForwardIterator>
76 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::
77 insert(iterator pos, ForwardIterator f, ForwardIterator l,
78 typename boost::disable_if< boost::is_convertible<ForwardIterator,size_type> >::type *)
80 for (iterator j (shift(pos,std::distance(f,l))); f!=l; ++f,++j)
84 template <class ElementParser, class AuxPolicy>
85 template <class ForwardIterator>
86 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::
87 insert(iterator pos, ForwardIterator f, ForwardIterator l)
91 template <class ElementParser, class AuxPolicy>
92 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::resize(size_type n)
95 erase(boost::next(begin(),n),end());
97 push_back_space(n-size());
100 template <class ElementParser, class AuxPolicy>
101 template <class Value>
102 prefix_ void senf::VectorParser_Container<ElementParser,AuxPolicy>::resize(size_type n,
106 erase(boost::next(begin(),n),end());
108 push_back(value,n-size());
111 //-/////////////////////////////////////////////////////////////////////////////////////////////////
118 // c-file-style: "senf"
119 // indent-tabs-mode: nil
120 // ispell-local-dictionary: "american"
121 // compile-command: "scons -u test"
122 // comment-column: 40