Panda3D
fltBeadID.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 fltBeadID.h
10  * @author drose
11  * @date 2000-08-24
12  */
13 
14 #ifndef FLTBEADID_H
15 #define FLTBEADID_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltBead.h"
20 
21 /**
22  * A base class for any of a broad family of flt beads that include an ID.
23  */
24 class FltBeadID : public FltBead {
25 public:
26  FltBeadID(FltHeader *header);
27 
28  const std::string &get_id() const;
29  void set_id(const std::string &id);
30 
31  virtual void output(std::ostream &out) const;
32 
33 protected:
34  virtual bool extract_record(FltRecordReader &reader);
35  virtual bool extract_ancillary(FltRecordReader &reader);
36 
37  virtual bool build_record(FltRecordWriter &writer) const;
38  virtual FltError write_ancillary(FltRecordWriter &writer) const;
39 
40 private:
41  std::string _id;
42 
43 public:
44  virtual TypeHandle get_type() const {
45  return get_class_type();
46  }
47  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
48  static TypeHandle get_class_type() {
49  return _type_handle;
50  }
51  static void init_type() {
52  FltBead::init_type();
53  register_type(_type_handle, "FltBeadID",
54  FltBead::get_class_type());
55  }
56 
57 private:
58  static TypeHandle _type_handle;
59 };
60 
61 #endif
void set_id(const std::string &id)
Changes the id (name) of this particular bead.
Definition: fltBeadID.cxx:41
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
A base class for any of a broad family of flt beads that include an ID.
Definition: fltBeadID.h:24
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
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
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition: fltBead.h:29
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
virtual void output(std::ostream &out) const
Writes a quick one-line description of the record, but not its children.
Definition: fltBeadID.cxx:51
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
const std::string & get_id() const
Returns the id (name) of this particular bead.
Definition: fltBeadID.cxx:32