bitMaskAttribute.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Filename: bitMaskAttribute.h
  2. // Created by: drose (08Jun00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef BITMASKATTRIBUTE_H
  19. #define BITMASKATTRIBUTE_H
  20. #include <pandabase.h>
  21. #include "nodeAttribute.h"
  22. template<class MaskType>
  23. class BitMaskTransition;
  24. ////////////////////////////////////////////////////////////////////
  25. // Class : BitMaskAttribute
  26. // Description :
  27. ////////////////////////////////////////////////////////////////////
  28. template<class MaskType>
  29. class BitMaskAttribute : public NodeAttribute {
  30. protected:
  31. INLINE_GRAPH BitMaskAttribute();
  32. INLINE_GRAPH BitMaskAttribute(const MaskType &mask);
  33. INLINE_GRAPH BitMaskAttribute(const BitMaskAttribute &copy);
  34. INLINE_GRAPH void operator = (const BitMaskAttribute &copy);
  35. public:
  36. INLINE_GRAPH void set_mask(const MaskType &mask);
  37. INLINE_GRAPH const MaskType &get_mask() const;
  38. virtual void output(ostream &out) const;
  39. protected:
  40. virtual int internal_compare_to(const NodeAttribute *other) const;
  41. private:
  42. MaskType _mask;
  43. public:
  44. virtual TypeHandle get_type() const {
  45. return get_class_type();
  46. }
  47. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  48. static TypeHandle get_class_type() {
  49. return _type_handle;
  50. }
  51. static void init_type() {
  52. NodeAttribute::init_type();
  53. MaskType::init_type();
  54. register_type(_type_handle,
  55. string("BitMaskAttribute<") +
  56. MaskType::get_class_type().get_name() + ">",
  57. NodeAttribute::get_class_type());
  58. }
  59. private:
  60. static TypeHandle _type_handle;
  61. friend class BitMaskTransition<MaskType>;
  62. };
  63. #include "bitMaskAttribute.T"
  64. #endif