Glue_bones.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 Glue
  16. //! @{
  17. template<typename T1, typename T2, typename glue_type, bool condition>
  18. struct Glue_traits {};
  19. template<typename T1, typename T2, typename glue_type>
  20. struct Glue_traits<T1, T2, glue_type, true>
  21. {
  22. static const bool is_row = glue_type::template traits<T1,T2>::is_row;
  23. static const bool is_col = glue_type::template traits<T1,T2>::is_col;
  24. static const bool is_xvec = glue_type::template traits<T1,T2>::is_xvec;
  25. };
  26. template<typename T1, typename T2, typename glue_type>
  27. struct Glue_traits<T1, T2, glue_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 T2, typename glue_type>
  34. class Glue
  35. : public Base<typename T1::elem_type, Glue<T1, T2, glue_type> >
  36. , public Glue_traits<T1, T2, glue_type, has_nested_glue_traits<glue_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. arma_inline Glue(const T1& in_A, const T2& in_B);
  42. arma_inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword);
  43. arma_inline ~Glue();
  44. const T1& A; //!< first operand; must be derived from Base
  45. const T2& B; //!< second operand; must be derived from Base
  46. uword aux_uword; //!< storage of auxiliary data, uword format
  47. };
  48. //! @}