00001 // Copyright (C) 2010 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2010 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00019 template<typename eT> 00020 class mat_injector_row 00021 { 00022 public: 00023 00024 inline mat_injector_row(); 00025 00026 inline void insert(const eT val) const; 00027 00028 mutable uword n_cols; 00029 mutable podarray<eT> A; 00030 mutable podarray<eT> B; 00031 }; 00032 00033 00034 00035 template<typename T1> 00036 class mat_injector 00037 { 00038 public: 00039 00040 typedef typename T1::elem_type elem_type; 00041 00042 inline void insert(const elem_type val) const; 00043 inline void end_of_row() const; 00044 inline ~mat_injector(); 00045 00046 00047 private: 00048 00049 inline mat_injector(T1& in_X, const elem_type val); 00050 inline mat_injector(T1& in_X, const injector_end_of_row& x); 00051 00052 T1& X; 00053 mutable uword n_rows; 00054 00055 mutable podarray< mat_injector_row<elem_type>* >* AA; 00056 mutable podarray< mat_injector_row<elem_type>* >* BB; 00057 00058 friend class Mat<elem_type>; 00059 friend class Row<elem_type>; 00060 friend class Col<elem_type>; 00061 }; 00062 00063 00064 00065 // 00066 00067 00068 00069 template<typename oT> 00070 class field_injector_row 00071 { 00072 public: 00073 00074 inline field_injector_row(); 00075 inline ~field_injector_row(); 00076 00077 inline void insert(const oT& val) const; 00078 00079 mutable uword n_cols; 00080 mutable field<oT>* AA; 00081 mutable field<oT>* BB; 00082 }; 00083 00084 00085 00086 template<typename T1> 00087 class field_injector 00088 { 00089 public: 00090 00091 typedef typename T1::object_type object_type; 00092 00093 inline void insert(const object_type& val) const; 00094 inline void end_of_row() const; 00095 inline ~field_injector(); 00096 00097 00098 private: 00099 00100 inline field_injector(T1& in_X, const object_type& val); 00101 inline field_injector(T1& in_X, const injector_end_of_row& x); 00102 00103 T1& X; 00104 mutable uword n_rows; 00105 00106 mutable podarray< field_injector_row<object_type>* >* AA; 00107 mutable podarray< field_injector_row<object_type>* >* BB; 00108 00109 friend class field<object_type>; 00110 }; 00111 00112 00113