1 | // Copyright (C) 2010 Conrad Sanderson |
---|
2 | // Copyright (C) 2010 NICTA (www.nicta.com.au) |
---|
3 | // |
---|
4 | // This Source Code Form is subject to the terms of the Mozilla Public |
---|
5 | // License, v. 2.0. If a copy of the MPL was not distributed with this |
---|
6 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. |
---|
7 | |
---|
8 | |
---|
9 | //! \addtogroup injector |
---|
10 | //! @{ |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | template<typename eT> |
---|
15 | class mat_injector_row |
---|
16 | { |
---|
17 | public: |
---|
18 | |
---|
19 | inline mat_injector_row(); |
---|
20 | |
---|
21 | inline void insert(const eT val) const; |
---|
22 | |
---|
23 | mutable uword n_cols; |
---|
24 | mutable podarray<eT> A; |
---|
25 | mutable podarray<eT> B; |
---|
26 | }; |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | template<typename T1> |
---|
31 | class mat_injector |
---|
32 | { |
---|
33 | public: |
---|
34 | |
---|
35 | typedef typename T1::elem_type elem_type; |
---|
36 | |
---|
37 | inline void insert(const elem_type val) const; |
---|
38 | inline void end_of_row() const; |
---|
39 | inline ~mat_injector(); |
---|
40 | |
---|
41 | |
---|
42 | private: |
---|
43 | |
---|
44 | inline mat_injector(T1& in_X, const elem_type val); |
---|
45 | inline mat_injector(T1& in_X, const injector_end_of_row<>& x); |
---|
46 | |
---|
47 | T1& X; |
---|
48 | mutable uword n_rows; |
---|
49 | |
---|
50 | mutable podarray< mat_injector_row<elem_type>* >* AA; |
---|
51 | mutable podarray< mat_injector_row<elem_type>* >* BB; |
---|
52 | |
---|
53 | friend class Mat<elem_type>; |
---|
54 | friend class Row<elem_type>; |
---|
55 | friend class Col<elem_type>; |
---|
56 | }; |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | // |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | template<typename oT> |
---|
65 | class field_injector_row |
---|
66 | { |
---|
67 | public: |
---|
68 | |
---|
69 | inline field_injector_row(); |
---|
70 | inline ~field_injector_row(); |
---|
71 | |
---|
72 | inline void insert(const oT& val) const; |
---|
73 | |
---|
74 | mutable uword n_cols; |
---|
75 | mutable field<oT>* AA; |
---|
76 | mutable field<oT>* BB; |
---|
77 | }; |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | template<typename T1> |
---|
82 | class field_injector |
---|
83 | { |
---|
84 | public: |
---|
85 | |
---|
86 | typedef typename T1::object_type object_type; |
---|
87 | |
---|
88 | inline void insert(const object_type& val) const; |
---|
89 | inline void end_of_row() const; |
---|
90 | inline ~field_injector(); |
---|
91 | |
---|
92 | |
---|
93 | private: |
---|
94 | |
---|
95 | inline field_injector(T1& in_X, const object_type& val); |
---|
96 | inline field_injector(T1& in_X, const injector_end_of_row<>& x); |
---|
97 | |
---|
98 | T1& X; |
---|
99 | mutable uword n_rows; |
---|
100 | |
---|
101 | mutable podarray< field_injector_row<object_type>* >* AA; |
---|
102 | mutable podarray< field_injector_row<object_type>* >* BB; |
---|
103 | |
---|
104 | friend class field<object_type>; |
---|
105 | }; |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | //! @} |
---|