Logo coherent WaveBurst  
Library Reference Guide
Logo
wslice.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program 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
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 // The template and inlines for the -*- C++ -*- slice class.
20 
21 // Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc.
22 //
23 // This file is part of the GNU ISO C++ Library. This library is free
24 // software; you can redistribute it and/or modify it under the
25 // terms of the GNU General Public License as published by the
26 // Free Software Foundation; either version 2, or (at your option)
27 // any later version.
28 
29 // This library is distributed in the hope that it will be useful,
30 // but WITHOUT ANY WARRANTY; without even the implied warranty of
31 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 // GNU General Public License for more details.
33 
34 // You should have received a copy of the GNU General Public License along
35 // with this library; see the file COPYING. If not, write to the Free
36 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
37 // USA.
38 
39 // As a special exception, you may use this file as part of a free software
40 // library without restriction. Specifically, if other files instantiate
41 // templates or use macros or inline functions from this file, or you compile
42 // this file and link it with other files to produce an executable, this
43 // file does not by itself cause the resulting executable to be covered by
44 // the GNU General Public License. This exception does not however
45 // invalidate any other reasons why the executable file might be covered by
46 // the GNU General Public License.
47 
48 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
49 
50 /** @file slice.h
51  * This is an internal header file, included by other library headers.
52  * You should not attempt to use it directly.
53  */
54 
55 #ifndef _CPP_BITS_SLICE_H
56 #define _CPP_BITS_SLICE_H 1
57 
58 #pragma GCC system_header
59 
60 namespace std
61 {
62 
63 class slice
64 {
65 public:
66  slice ();
67  slice (size_t, size_t, size_t);
68 
69  size_t start () const;
70  size_t size () const;
71  size_t stride () const;
72 
73 private:
74  size_t _M_off; // offset
75  size_t _M_sz; // size
76  size_t _M_st; // stride unit
77 };
78 
79 inline slice::slice () {}
80 
81 inline slice::slice (size_t __o, size_t __d, size_t __s)
82  : _M_off (__o), _M_sz (__d), _M_st (__s) {}
83 
84 inline size_t
85 slice::start () const
86  { return _M_off; }
87 
88 inline size_t
89 slice::size () const
90  { return _M_sz; }
91 
92 inline size_t
93 slice::stride () const
94  { return _M_st; }
95 
96 } // std::
97 
98 
99 #endif /* _CPP_BITS_SLICE_H */
100 
101 // Local Variables:
102 // mode:c++
103 // End:
size_t _M_sz
Definition: wslice.hh:75
STL namespace.
size_t size() const
Definition: wslice.hh:89
size_t start() const
Definition: wslice.hh:85
size_t stride() const
Definition: wslice.hh:93
size_t _M_off
Definition: wslice.hh:74
size_t _M_st
Definition: wslice.hh:76