| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // Filename: pointerDataAttribute.h
- // Created by: jason (07Aug00)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- #ifndef POINTERDATAATTRIBUTE_H
- #define POINTERDATAATTRIBUTE_H
- #include <pandabase.h>
- #include <nodeAttribute.h>
- #include <indent.h>
- template<class PtrType>
- class PointerDataTransition;
- ////////////////////////////////////////////////////////////////////
- // Class : PointerDataTransition
- // Description :
- ////////////////////////////////////////////////////////////////////
- template<class PtrType>
- class PointerDataAttribute : public NodeAttribute {
- public:
- INLINE PointerDataAttribute();
- INLINE PointerDataAttribute(PtrType* ptr);
- INLINE PointerDataAttribute(const PointerDataAttribute<PtrType> ©);
- INLINE void operator = (const PointerDataAttribute<PtrType> ©);
- public:
- INLINE void set_value(PtrType* ptr);
- INLINE PtrType* get_value() const;
- virtual TypeHandle get_handle() const;
- virtual void output(ostream &out) const;
- virtual void write(ostream &out, int indent_level = 0) const;
- protected:
- virtual int internal_compare_to(const NodeAttribute *other) const;
- private:
- PtrType* _ptr;
- public:
- virtual TypeHandle get_type() const {
- return get_class_type();
- }
- virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
- static TypeHandle get_class_type() {
- return _type_handle;
- }
- static void init_type() {
- NodeAttribute::init_type();
- register_type(_type_handle,
- string("PointerDataAttribute<") +
- get_type_handle(PtrType).get_name() + ">",
- NodeAttribute::get_class_type());
- }
- private:
- static TypeHandle _type_handle;
- friend class PointerDataTransition<PtrType>;
- //Variable is just to make the compiler happy for the default
- //constructor
- static PtrType* _null_ptr;
- };
- #include "pointerDataAttribute.I"
- #endif
|