libresidfp
1.1.1
Main Page
Classes
Files
File List
src
array.h
1
/*
2
* This file is part of libsidplayfp, a SID player engine.
3
*
4
* Copyright (C) 2011-2026 Leandro Nini
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#ifndef ARRAY_H
22
#define ARRAY_H
23
24
#include <cstdint>
25
26
#include <atomic>
27
#include <memory>
28
29
template
<
typename
T>
30
class
matrix
31
{
32
private
:
33
T* data;
34
const
unsigned
int
x, y;
35
36
private
:
37
matrix
& operator=(
const
matrix
&) =
delete
;
38
39
public
:
40
matrix
(
unsigned
int
new_x,
unsigned
int
new_y) :
41
data(
new
T[new_x * new_y]),
42
x(new_x),
43
y(new_y) {}
44
45
matrix
(
const
matrix
& p) :
46
data(p.data),
47
x(p.x),
48
y(p.y) {}
49
50
~matrix
() {
delete
[] data; }
51
52
unsigned
int
length()
const
{
return
x * y; }
53
54
T* operator[](
unsigned
int
a) {
return
&data[a * y]; }
55
56
T
const
* operator[](
unsigned
int
a)
const
{
return
&data[a * y]; }
57
};
58
59
using
matrix_t
=
matrix<int16_t>
;
60
using
rc_matrix_t = std::shared_ptr<matrix_t>;
61
62
#endif
matrix
Definition
array.h:31
Generated on Sun Jun 28 2026 07:10:42 for libresidfp by
1.9.8