2
0

matrixAttribute.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Filename: matrixAttribute.h
  2. // Created by: drose (24Mar00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef MATRIXATTRIBUTE_H
  6. #define MATRIXATTRIBUTE_H
  7. #include <pandabase.h>
  8. #include "nodeAttribute.h"
  9. template<class Matrix>
  10. class MatrixTransition;
  11. ////////////////////////////////////////////////////////////////////
  12. // Class : MatrixAttribute
  13. // Description :
  14. ////////////////////////////////////////////////////////////////////
  15. template<class Matrix>
  16. class MatrixAttribute : public NodeAttribute {
  17. protected:
  18. INLINE MatrixAttribute();
  19. INLINE MatrixAttribute(const MatrixAttribute &copy);
  20. INLINE void operator = (const MatrixAttribute &copy);
  21. public:
  22. INLINE void set_matrix(const Matrix &mat);
  23. INLINE const Matrix &get_matrix() const;
  24. virtual void output(ostream &out) const;
  25. virtual void write(ostream &out, int indent_level = 0) const;
  26. protected:
  27. virtual int internal_compare_to(const NodeAttribute *other) const;
  28. private:
  29. Matrix _matrix;
  30. public:
  31. virtual TypeHandle get_type() const {
  32. return get_class_type();
  33. }
  34. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  35. static TypeHandle get_class_type() {
  36. return _type_handle;
  37. }
  38. static void init_type() {
  39. NodeAttribute::init_type();
  40. Matrix::init_type();
  41. register_type(_type_handle,
  42. string("MatrixAttribute<") +
  43. Matrix::get_class_type().get_name() + ">",
  44. NodeAttribute::get_class_type());
  45. }
  46. private:
  47. static TypeHandle _type_handle;
  48. friend class MatrixTransition<Matrix>;
  49. };
  50. #include "matrixAttribute.I"
  51. #endif