PacketVector.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 PacketVector inline template implementation */
16 
17 //#include "PacketVector.ih"
18 
19 // Custom includes
20 #include <senf/Utils/senfassert.hh>
21 
22 #define prefix_ inline
23 ///////////////////////////////cti.p///////////////////////////////////////
24 
25 #ifndef SENF_PACKET_STD_CONTAINER
26 
27 template <class ForwardIterator>
28 prefix_ senf::PacketVector::PacketVector(ForwardIterator f, ForwardIterator l)
29  : owner_ (true)
30 {
31  int requestSize (std::distance(f,l));
32  size_ = allocationSize(requestSize);
33  data_ = static_cast<value_type *>(Pool::ordered_malloc(size_ >> ChunkSizeIndex));
34  b_ = data_ + HeadRoom;
35  e_ = b_ + requestSize;
36  std::copy(f, l, b_);
37 }
38 
39 template <class ForwardIterator>
40 prefix_ void senf::PacketVector::insert(iterator pos, ForwardIterator f, ForwardIterator l)
41 {
42  SENF_ASSERT( pos >= b_ && pos <= e_, "invalid iterator passed to PacketVector::erase" );
43  std::copy(f, l, move(pos, std::distance(f,l)));
44 }
45 
46 #endif
47 
48 ///////////////////////////////cti.e///////////////////////////////////////
49 #undef prefix_
50 
51 
52 // Local Variables:
53 // mode: c++
54 // fill-column: 100
55 // comment-column: 40
56 // c-file-style: "senf"
57 // indent-tabs-mode: nil
58 // ispell-local-dictionary: "american"
59 // compile-command: "scons -u test"
60 // End: