Panda3D
xFileDataObjectDouble.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 xFileDataObjectDouble.h
10  * @author drose
11  * @date 2004-10-07
12  */
13 
14 #ifndef XFILEDATAOBJECTDOUBLE_H
15 #define XFILEDATAOBJECTDOUBLE_H
16 
17 #include "pandatoolbase.h"
18 #include "xFileDataObject.h"
19 
20 /**
21  * An double-valued data element. This matches one double data member of a
22  * template, or a single element of an double array.
23  */
25 public:
26  XFileDataObjectDouble(const XFileDataDef *data_def, double value);
27 
28  virtual void output_data(std::ostream &out) const;
29  virtual void write_data(std::ostream &out, int indent_level,
30  const char *separator) const;
31 
32 protected:
33  virtual void set_int_value(int int_value);
34  virtual void set_double_value(double double_value);
35 
36  virtual int get_int_value() const;
37  virtual double get_double_value() const;
38  virtual std::string get_string_value() const;
39 
40 private:
41  double _value;
42 
43 public:
44  static TypeHandle get_class_type() {
45  return _type_handle;
46  }
47  static void init_type() {
48  XFileDataObject::init_type();
49  register_type(_type_handle, "XFileDataObjectDouble",
50  XFileDataObject::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 
57 private:
58  static TypeHandle _type_handle;
59 };
60 
61 #include "xFileDataObjectDouble.I"
62 
63 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
virtual void write_data(std::ostream &out, int indent_level, const char *separator) const
Writes a suitable representation of this node to an .x file in text mode.
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:31
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An double-valued data element.
virtual void output_data(std::ostream &out) const
Writes a suitable representation of this node to an .x file in text mode.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
The abstract base class for a number of different types of data elements that may be stored in the X ...