Panda3D
Loading...
Searching...
No Matches
typedSkel.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 typedSkel.h
10 * @author jyelon
11 * @date 2007-01-31
12 */
13
14#ifndef TYPEDSKEL_H
15#define TYPEDSKEL_H
16
17#include "pandabase.h"
18#include "typedObject.h"
19
20/**
21 * Skeleton object that inherits from TypedObject. Stores an integer, and
22 * will return it on request.
23 *
24 * The skeleton classes are intended to help you learn how to add C++ classes
25 * to panda. See also the manual, "Adding C++ Classes to Panda."
26 */
27class EXPCL_PANDASKEL TypedSkel : public TypedObject {
28PUBLISHED:
29 INLINE TypedSkel();
30 INLINE ~TypedSkel();
31
32 // These inline functions allow you to get and set _value.
33 INLINE void set_value(int n);
34 INLINE int get_value();
35
36 // These do the same thing as the functions above.
37 void set_value_alt(int n);
38 int get_value_alt();
39
40private:
41 int _value;
42
43public:
44 static TypeHandle get_class_type() {
45 return _type_handle;
46 }
47 static void init_type() {
49 register_type(_type_handle, "TypedSkel",
50 TypedObject::get_class_type());
51 }
52 virtual TypeHandle get_type() const {
53 return get_class_type();
54 }
55 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
56
57private:
58
59 static TypeHandle _type_handle;
60
61};
62
63#include "typedSkel.I"
64
65#endif
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition typedObject.h:88
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Skeleton object that inherits from TypedObject.
Definition typedSkel.h:27
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(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.