Panda3D
 All Classes Functions Variables Enumerations
fltUnsupportedRecord.cxx
1 // Filename: fltUnsupportedRecord.cxx
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 #include "fltUnsupportedRecord.h"
16 #include "fltRecordReader.h"
17 #include "fltRecordWriter.h"
18 
19 TypeHandle FltUnsupportedRecord::_type_handle;
20 
21 ////////////////////////////////////////////////////////////////////
22 // Function: FltUnsupportedRecord::Constructor
23 // Access: Public
24 // Description:
25 ////////////////////////////////////////////////////////////////////
26 FltUnsupportedRecord::
27 FltUnsupportedRecord(FltHeader *header) : FltRecord(header) {
28  _opcode = FO_none;
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: FltUnsupportedRecord::output
33 // Access: Public
34 // Description: Writes a quick one-line description of the bead, but
35 // not its children. This is a human-readable
36 // description, primarily for debugging; to write a flt
37 // file, use FltHeader::write_flt().
38 ////////////////////////////////////////////////////////////////////
40 output(ostream &out) const {
41  out << "Unsupported(" << _opcode << ")";
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: FltUnsupportedRecord::extract_record
46 // Access: Protected, Virtual
47 // Description: Fills in the information in this bead based on the
48 // information given in the indicated datagram, whose
49 // opcode has already been read. Returns true on
50 // success, false if the datagram is invalid.
51 ////////////////////////////////////////////////////////////////////
52 bool FltUnsupportedRecord::
53 extract_record(FltRecordReader &reader) {
54  _opcode = reader.get_opcode();
55  _datagram = reader.get_datagram();
56 
57  return true;
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: FltUnsupportedRecord::build_record
62 // Access: Protected, Virtual
63 // Description: Fills up the current record on the FltRecordWriter with
64 // data for this record, but does not advance the
65 // writer. Returns true on success, false if there is
66 // some error.
67 ////////////////////////////////////////////////////////////////////
68 bool FltUnsupportedRecord::
69 build_record(FltRecordWriter &writer) const {
70  writer.set_opcode(_opcode);
71  writer.set_datagram(_datagram);
72  return true;
73 }
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly...
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
void set_datagram(const Datagram &datagram)
Sets the datagram that will be written when advance() is called.
virtual void output(ostream &out) const
Writes a quick one-line description of the bead, but not its children.
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
const Datagram & get_datagram()
Returns the datagram representing the entire record, less the four-byte header.
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:40
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
void set_opcode(FltOpcode opcode)
Sets the opcode associated with the current record.