1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup injector
20 //! @{
21 
22 
23 
24 template<typename eT>
25 class mat_injector_row
26   {
27   public:
28 
29   arma_cold inline mat_injector_row();
30 
31   arma_cold inline void insert(const eT val) const;
32 
33   mutable uword        n_cols;
34   mutable podarray<eT> A;
35   mutable podarray<eT> B;
36   };
37 
38 
39 
40 template<typename T1>
41 class mat_injector
42   {
43   public:
44 
45   typedef typename T1::elem_type elem_type;
46 
47   arma_cold inline void  insert(const elem_type val) const;
48   arma_cold inline void  end_of_row()                const;
49   arma_cold inline      ~mat_injector();
50 
51 
52   private:
53 
54   arma_cold inline mat_injector(T1& in_X, const elem_type val);
55   arma_cold inline mat_injector(T1& in_X, const injector_end_of_row<>& x);
56 
57   T1&           X;
58   mutable uword n_rows;
59 
60   mutable podarray< mat_injector_row<elem_type>* >* AA;
61   mutable podarray< mat_injector_row<elem_type>* >* BB;
62 
63   friend class Mat<elem_type>;
64   friend class Row<elem_type>;
65   friend class Col<elem_type>;
66   };
67 
68 
69 
70 //
71 
72 
73 
74 template<typename oT>
75 class field_injector_row
76   {
77   public:
78 
79   arma_cold inline  field_injector_row();
80   arma_cold inline ~field_injector_row();
81 
82   arma_cold inline void insert(const oT& val) const;
83 
84   mutable uword      n_cols;
85   mutable field<oT>* AA;
86   mutable field<oT>* BB;
87   };
88 
89 
90 
91 template<typename T1>
92 class field_injector
93   {
94   public:
95 
96   typedef typename T1::object_type object_type;
97 
98   arma_cold inline void  insert(const object_type& val) const;
99   arma_cold inline void  end_of_row()                   const;
100   arma_cold inline      ~field_injector();
101 
102 
103   private:
104 
105   arma_cold inline field_injector(T1& in_X, const object_type& val);
106   arma_cold inline field_injector(T1& in_X, const injector_end_of_row<>& x);
107 
108   T1&           X;
109   mutable uword n_rows;
110 
111   mutable podarray< field_injector_row<object_type>* >* AA;
112   mutable podarray< field_injector_row<object_type>* >* BB;
113 
114   friend class field<object_type>;
115   };
116 
117 
118 
119 //! @}
120