]> Dogcows Code - chaz/yoink/blob - src/moof/stlplus/matrix.hpp
fixes for newer versions of g++
[chaz/yoink] / src / moof / stlplus / matrix.hpp
1 #ifndef STLPLUS_MATRIX
2 #define STLPLUS_MATRIX
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // General-purpose 2D matrix data structure
11
12 ////////////////////////////////////////////////////////////////////////////////
13 #include "containers_fixes.hpp"
14
15 namespace stlplus
16 {
17
18 ////////////////////////////////////////////////////////////////////////////////
19
20 template<typename T> class matrix
21 {
22 public:
23 matrix(unsigned rows = 0, unsigned cols = 0, const T& fill = T()) throw();
24 ~matrix(void) throw();
25
26 matrix(const matrix&) throw();
27 matrix& operator =(const matrix&) throw();
28
29 void resize(unsigned rows, unsigned cols, const T& fill = T()) throw();
30
31 unsigned rows(void) const throw();
32 unsigned columns(void) const throw();
33
34 void erase(const T& fill = T()) throw();
35 void erase(unsigned row, unsigned col, const T& fill = T()) throw(std::out_of_range);
36 void insert(unsigned row, unsigned col, const T&) throw(std::out_of_range);
37 const T& item(unsigned row, unsigned col) const throw(std::out_of_range);
38 T& item(unsigned row, unsigned col) throw(std::out_of_range);
39 const T& operator()(unsigned row, unsigned col) const throw(std::out_of_range);
40 T& operator()(unsigned row, unsigned col) throw(std::out_of_range);
41
42 void fill(const T& item = T()) throw();
43 void fill_column(unsigned col, const T& item = T()) throw(std::out_of_range);
44 void fill_row(unsigned row, const T& item = T()) throw(std::out_of_range);
45 void fill_leading_diagonal(const T& item = T()) throw();
46 void fill_trailing_diagonal(const T& item = T()) throw();
47 void make_identity(const T& one, const T& zero = T()) throw();
48
49 void transpose(void) throw();
50
51 private:
52 unsigned m_rows;
53 unsigned m_cols;
54 T** m_data;
55 };
56
57 ////////////////////////////////////////////////////////////////////////////////
58
59 } // end namespace stlplus
60
61 #include "matrix.tpp"
62 #endif
This page took 0.033482 seconds and 4 git commands to generate.