Debian Codegraph @

lib/dat/array.hpp

raw symbols SCIP
1 /*
2 Copyright(C) 2011-2016 Brazil
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #pragma once
20
21 #include "dat.hpp"cxx . . $ `<file>/lib/dat/dat.hpp`/
22
23 namespace grncxx . . $ grn/ {
24 namespace datcxx . . $ grn/dat/ {
25
26 // This class is used to detect an out-of-range access in debug mode.
27 template <typename T>
28 class GRN_DAT_APIcxx . . $ `lib/dat/dat.hpp:44:12`! Arraycxx . . $ grn/dat/Array# {
29 public:
30 Arraycxx . . $ grn/dat/Array#`Array<T>`(49f6e7a06ebc5aa8).() : ptr_cxx . . $ grn/dat/Array#ptr_.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!), size_cxx . . $ grn/dat/Array#size_.(0) {}
31 Arraycxx . . $ grn/dat/Array#`Array<T>`(67abb4dd43ac34c5).(void *ptr, UInt32cxx . . $ grn/dat/UInt32# size) : ptr_cxx . . $ grn/dat/Array#ptr_.(static_cast<T *>(ptr)), size_cxx . . $ grn/dat/Array#size_.(size) {
32 GRN_DAT_DEBUG_THROW_IFcxx . . $ `lib/dat/dat.hpp:242:10`!((ptr == NULL) && (size != 0));
33 }
34 template <UInt32cxx . . $ grn/dat/UInt32# U>
35 explicit Arraycxx . . $ grn/dat/Array#`Array<T>`(d2be23fd680d41ab).(T (&array)[U]) : ptr_cxx . . $ grn/dat/Array#ptr_.(array), size_cxx . . $ grn/dat/Array#size_.(U) {}
36 ~cxx . . $ grn/dat/Array#`~Array<T>`(49f6e7a06ebc5aa8).Array() {}
37
38 const T &operatorcxx . . $ grn/dat/Array#`operator[]`(324713ecd9036b86).[](UInt32cxx . . $ grn/dat/UInt32# i) const {
39 GRN_DAT_DEBUG_THROW_IFcxx . . $ `lib/dat/dat.hpp:242:10`!(i >= size_);
40 return ptr_cxx . . $ grn/dat/Array#ptr_.[i];
41 }
42 T &operatorcxx . . $ grn/dat/Array#`operator[]`(cbb7c2c208bf2972).[](UInt32cxx . . $ grn/dat/UInt32# i) {
43 GRN_DAT_DEBUG_THROW_IFcxx . . $ `lib/dat/dat.hpp:242:10`!(i >= size_);
44 return ptr_cxx . . $ grn/dat/Array#ptr_.[i];
45 }
46
47 const T *begincxx . . $ grn/dat/Array#begin(1016ee5406d91ab9).() const {
48 return ptrcxx . . $ grn/dat/Array#ptr(5a2a78a048fb49a8).();
49 }
50 T *begincxx . . $ grn/dat/Array#begin(155dc7f103cdb9db).() {
51 return ptrcxx . . $ grn/dat/Array#ptr(5a2a78a048fb49a8).();
52 }
53
54 const T *endcxx . . $ grn/dat/Array#end(1016ee5406d91ab9).() const {
55 return ptrcxx . . $ grn/dat/Array#ptr(5a2a78a048fb49a8).() + sizecxx . . $ grn/dat/Array#size(ddd8539a2fcdd4ce).();
56 }
57 T *endcxx . . $ grn/dat/Array#end(155dc7f103cdb9db).() {
58 return ptrcxx . . $ grn/dat/Array#ptr(5a2a78a048fb49a8).() + sizecxx . . $ grn/dat/Array#size(ddd8539a2fcdd4ce).();
59 }
60
61 void assigncxx . . $ grn/dat/Array#assign(67abb4dd43ac34c5).(void *ptr, UInt32cxx . . $ grn/dat/UInt32# size) {
62 GRN_DAT_DEBUG_THROW_IFcxx . . $ `lib/dat/dat.hpp:242:10`!((ptr == NULL) && (size != 0));
63 ptr_cxx . . $ grn/dat/Array#ptr_. = static_cast<T *>(ptr);
64 size_cxx . . $ grn/dat/Array#size_. = size;
65 }
66 template <UInt32cxx . . $ grn/dat/UInt32# U>
67 void assigncxx . . $ grn/dat/Array#assign(d2be23fd680d41ab).(T (&array)[U]) {
68 assigncxx . . $ grn/dat/Array#assign(d2be23fd680d41ab).(array, U);
69 }
70
71 void swapcxx . . $ grn/dat/Array#swap(9e3561b02af8a061).(Array *rhs) {
72 T * const temp_ptr = ptr_cxx . . $ grn/dat/Array#ptr_.;
73 ptr_cxx . . $ grn/dat/Array#ptr_. = rhs->ptr_cxx . . $ grn/dat/Array#ptr_.;
74 rhs->ptr_cxx . . $ grn/dat/Array#ptr_. = temp_ptr;
75
76 const UInt32cxx . . $ grn/dat/UInt32# temp_size = size_cxx . . $ grn/dat/Array#size_.;
77 size_cxx . . $ grn/dat/Array#size_. = rhs->size_cxx . . $ grn/dat/Array#size_.;
78 rhs->size_cxx . . $ grn/dat/Array#size_. = temp_size;
79 }
80
81 T *ptrcxx . . $ grn/dat/Array#ptr(5a2a78a048fb49a8).() const {
82 return ptr_cxx . . $ grn/dat/Array#ptr_.;
83 }
84 UInt32cxx . . $ grn/dat/UInt32# sizecxx . . $ grn/dat/Array#size(ddd8539a2fcdd4ce).() const {
85 return size_cxx . . $ grn/dat/Array#size_.;
86 }
87
88 private:
89 T *ptr_cxx . . $ grn/dat/Array#ptr_.;
90 UInt32cxx . . $ grn/dat/UInt32# size_cxx . . $ grn/dat/Array#size_.;
91
92 // Disallows copy and assignment.
93 Arraycxx . . $ grn/dat/Array#`Array<T>`(60da2592f3a6c746).(const Array &);
94 Array &operatorcxx . . $ grn/dat/Array#`operator=`(8acabb88df7fe2b4).=(const Array &);
95 };
96
97 } // namespace dat
98 } // namespace grn