injector_bones.hpp 2.5 KB

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