Buffer.hh
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 
17 #ifndef HH_SENF_Utils_Buffer_
18 #define HH_SENF_Utils_Buffer_ 1
19 
20 // Custom includes
21 #include <senf/config.hh>
22 
23 //#include "Buffer.mpp"
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 #if defined(SENF_BUFFER_USE_LOCALS)
27 
28 # define SENF_SCOPED_BUFFER(type, sym, size) \
29  type sym[size];
30 
31 #elif defined(SENF_BUFFER_USE_ALLOCA)
32 
33 # include <alloca.h>
34 # define SENF_SCOPED_BUFFER(type, sym, size) \
35  type * sym (static_cast<type *>(alloca(size*sizeof(type))));
36 
37 #elif defined(SENF_BUFFER_USE_NEW)
38 
39 # include <boost/scoped_array.hpp>
70 # define SENF_SCOPED_BUFFER(type, sym, size) \
71  boost::scoped_array<type> _senf_scoped_buffer__ ## sym ## __ ## __LINE__ (new type[size]); \
72  type * sym (_senf_scoped_buffer__ ## sym ## __ ## __LINE__.get());
73 
74 #endif
75 
76 //-/////////////////////////////////////////////////////////////////////////////////////////////////
77 //#include "Buffer.cci"
78 //#include "Buffer.ct"
79 //#include "Buffer.cti"
80 #endif
81 
82 
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // c-file-style: "senf"
87 // indent-tabs-mode: nil
88 // ispell-local-dictionary: "american"
89 // compile-command: "scons -u test"
90 // comment-column: 40
91 // End: