Panda3D
fltBeadID.h
1 // Filename: fltBeadID.h
2 // Created by: drose (24Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FLTBEADID_H
16 #define FLTBEADID_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltBead.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : FltBeadID
24 // Description : A base class for any of a broad family of flt beads
25 // that include an ID.
26 ////////////////////////////////////////////////////////////////////
27 class FltBeadID : public FltBead {
28 public:
29  FltBeadID(FltHeader *header);
30 
31  const string &get_id() const;
32  void set_id(const string &id);
33 
34  virtual void output(ostream &out) const;
35 
36 protected:
37  virtual bool extract_record(FltRecordReader &reader);
38  virtual bool extract_ancillary(FltRecordReader &reader);
39 
40  virtual bool build_record(FltRecordWriter &writer) const;
41  virtual FltError write_ancillary(FltRecordWriter &writer) const;
42 
43 private:
44  string _id;
45 
46 public:
47  virtual TypeHandle get_type() const {
48  return get_class_type();
49  }
50  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  FltBead::init_type();
56  register_type(_type_handle, "FltBeadID",
57  FltBead::get_class_type());
58  }
59 
60 private:
61  static TypeHandle _type_handle;
62 };
63 
64 #endif
65 
66 
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:27
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition: fltBead.h:33
const string & get_id() const
Returns the id (name) of this particular bead.
Definition: fltBeadID.cxx:37
void set_id(const string &id)
Changes the id (name) of this particular bead.
Definition: fltBeadID.cxx:48
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
virtual void output(ostream &out) const
Writes a quick one-line description of the record, but not its children.
Definition: fltBeadID.cxx:61
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85