Op_bones.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 Op
  16. //! @{
  17. template<typename T1, typename op_type, bool condition>
  18. struct Op_traits {};
  19. template<typename T1, typename op_type>
  20. struct Op_traits<T1, op_type, true>
  21. {
  22. static const bool is_row = op_type::template traits<T1>::is_row;
  23. static const bool is_col = op_type::template traits<T1>::is_col;
  24. static const bool is_xvec = op_type::template traits<T1>::is_xvec;
  25. };
  26. template<typename T1, typename op_type>
  27. struct Op_traits<T1, op_type, false>
  28. {
  29. static const bool is_row = false;
  30. static const bool is_col = false;
  31. static const bool is_xvec = false;
  32. };
  33. template<typename T1, typename op_type>
  34. class Op
  35. : public Base<typename T1::elem_type, Op<T1, op_type> >
  36. , public Op_traits<T1, op_type, has_nested_op_traits<op_type>::value >
  37. {
  38. public:
  39. typedef typename T1::elem_type elem_type;
  40. typedef typename get_pod_type<elem_type>::result pod_type;
  41. inline explicit Op(const T1& in_m);
  42. inline Op(const T1& in_m, const elem_type in_aux);
  43. inline Op(const T1& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b);
  44. inline Op(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b);
  45. inline Op(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c, const char junk);
  46. inline ~Op();
  47. arma_aligned const T1& m; //!< the operand; must be derived from Base
  48. arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
  49. arma_aligned uword aux_uword_a; //!< auxiliary data, uword format
  50. arma_aligned uword aux_uword_b; //!< auxiliary data, uword format
  51. arma_aligned uword aux_uword_c; //!< auxiliary data, uword format
  52. };
  53. //! @}