Panda3D
eggObject.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggObject.h
10  * @author drose
11  * @date 1999-01-17
12  */
13 
14 #ifndef EGGOBJECT_H
15 #define EGGOBJECT_H
16 
17 #include "pandabase.h"
18 #include "eggUserData.h"
19 #include "typedReferenceCount.h"
20 #include "pointerTo.h"
21 #include "pmap.h"
22 
23 class EggTransform;
24 
25 /**
26  * The highest-level base class in the egg directory. (Almost) all things egg
27  * inherit from this.
28  */
29 class EXPCL_PANDA_EGG EggObject : public TypedReferenceCount {
30 PUBLISHED:
31  EggObject();
32  EggObject(const EggObject &copy);
33  EggObject &operator = (const EggObject &copy);
34 
35  virtual ~EggObject();
36 
37  void set_user_data(EggUserData *user_data);
38  EggUserData *get_user_data() const;
39  EggUserData *get_user_data(TypeHandle type) const;
40  bool has_user_data() const;
41  bool has_user_data(TypeHandle type) const;
42  void clear_user_data();
43  void clear_user_data(TypeHandle type);
44 
45 public:
46  virtual EggTransform *as_transform();
47 
48 private:
49  typedef pmap<TypeHandle, PT(EggUserData) > UserData;
50  UserData _user_data;
51  PT(EggUserData) _default_user_data;
52 
53 public:
54  static TypeHandle get_class_type() {
55  return _type_handle;
56  }
57  static void init_type() {
58  TypedReferenceCount::init_type();
59  register_type(_type_handle, "EggObject",
60  TypedReferenceCount::get_class_type());
61  }
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 #include "eggObject.I"
72 
73 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This is a base class for a user-defined data type to extend egg structures in processing code.
Definition: eggUserData.h:29
The highest-level base class in the egg directory.
Definition: eggObject.h:29
This represents the <Transform> entry of a group or texture node: a list of component transform opera...
Definition: eggTransform.h:29