]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/full-storage.icc
release: 0.1.47
[lilypond.git] / flower / include / full-storage.icc
1 /*
2   full-storage.icc -- implement Full_storage inline functions
3
4   source file of the Flower Library
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef FULL_STORAGE_ICC
11 #define FULL_STORAGE_ICC
12
13
14 INLINE void
15 Full_storage::init()
16 {
17   els_p_p_=0;
18   height_i_=width_i_=max_height_i_=max_width_i_=0;
19 }
20 INLINE bool
21 Full_storage::valid (int i, int j) const
22 {
23   return (i>=0 && i < height_i_)
24     && (j < width_i_ && j >=0);
25 }
26
27
28 INLINE
29 Full_storage::Full_storage (Full_storage const&s)
30   : Matrix_storage (s)
31 {
32   init();
33   (*this) = s;
34 }
35
36 INLINE Real& 
37 Full_storage::elem (int i,int j)
38 {
39   assert (valid (i,j));
40   return els_p_p_[i][j];
41 }
42
43 INLINE Real
44 Full_storage::elem (int i, int j) const {
45   assert (valid (i,j));
46   return els_p_p_[i][j];
47 }
48
49 INLINE
50 Full_storage::Full_storage() {
51   init();
52 }
53
54
55 INLINE int
56 Full_storage::rows() const
57 {
58   return height_i_;
59 }
60 INLINE int
61 Full_storage::cols() const
62 {
63   return width_i_;
64 }
65 INLINE int
66 Full_storage::dim() const
67 {
68   assert (rows()==cols ());
69   return rows();
70 }
71
72 INLINE void
73 Full_storage::resize (int i)
74 {
75   resize (i,i);
76 }
77
78 INLINE   
79 Full_storage::Full_storage (int i,int j)
80 {
81   init();
82   set_size (i,j);
83 }
84
85 INLINE 
86 Full_storage::Full_storage (int i)
87 {
88   init();
89   set_size (i);
90 }
91  
92 INLINE
93 IMPLEMENT_VIRTUAL_COPY_CONS(Full_storage,Matrix_storage);
94
95 #endif // FULL_STORAGE_ICC