Panda3D
 All Classes Functions Variables Enumerations
eggObject.h
00001 // Filename: eggObject.h
00002 // Created by:  drose (17Jan99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef EGGOBJECT_H
00016 #define EGGOBJECT_H
00017 
00018 #include "pandabase.h"
00019 #include "eggUserData.h"
00020 #include "typedReferenceCount.h"
00021 #include "pointerTo.h"
00022 #include "pmap.h"
00023 
00024 class EggTransform;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : EggObject
00028 // Description : The highest-level base class in the egg directory.
00029 //               (Almost) all things egg inherit from this.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDAEGG EggObject : public TypedReferenceCount {
00032 PUBLISHED:
00033   EggObject();
00034   EggObject(const EggObject &copy);
00035   EggObject &operator = (const EggObject &copy);
00036 
00037   virtual ~EggObject();
00038 
00039   void set_user_data(EggUserData *user_data);
00040   EggUserData *get_user_data() const;
00041   EggUserData *get_user_data(TypeHandle type) const;
00042   bool has_user_data() const;
00043   bool has_user_data(TypeHandle type) const;
00044   void clear_user_data();
00045   void clear_user_data(TypeHandle type);
00046 
00047 public:
00048   virtual EggTransform *as_transform();
00049 
00050 private:
00051   typedef pmap<TypeHandle, PT(EggUserData) > UserData;
00052   UserData _user_data;
00053   PT(EggUserData) _default_user_data;
00054 
00055 public:
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059   static void init_type() {
00060     TypedReferenceCount::init_type();
00061     register_type(_type_handle, "EggObject",
00062                   TypedReferenceCount::get_class_type());
00063   }
00064   virtual TypeHandle get_type() const {
00065     return get_class_type();
00066   }
00067   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00068 
00069 private:
00070   static TypeHandle _type_handle;
00071 };
00072 
00073 #include "eggObject.I"
00074 
00075 #endif
 All Classes Functions Variables Enumerations