Panda3D

lwoGroupChunk.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 lwoGroupChunk.h
10 * @author drose
11 * @date 2001-04-24
12 */
13
14 #ifndef LWOGROUPCHUNK_H
15 #define LWOGROUPCHUNK_H
16
17 #include "pandatoolbase.h"
18
19 #include "lwoChunk.h"
20 #include "iffChunk.h"
21
22 #include "pointerTo.h"
23
24 #include "pvector.h"
25
26 /**
27 * A particular kind of LwoChunk that is expected to contain an arbitrary
28 * number of child chunks.
29 */
30 class LwoGroupChunk : public LwoChunk {
31 public:
32 int get_num_chunks() const;
33 IffChunk *get_chunk(int n) const;
34
35 protected:
36 bool read_chunks_iff(IffInputFile *in, size_t stop_at);
37 bool read_subchunks_iff(IffInputFile *in, size_t stop_at);
38 void write_chunks(std::ostream &out, int indent_level) const;
39
40 typedef pvector< PT(IffChunk) > Chunks;
41 Chunks _chunks;
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 LwoChunk::init_type();
53 register_type(_type_handle, "LwoGroupChunk",
54 LwoChunk::get_class_type());
55 }
56
57 private:
58 static TypeHandle _type_handle;
59 };
60
61 #endif
IffChunk
The basic kind of record in an EA "IFF" file, which the LightWave object file is based on.
Definition: iffChunk.h:30
IffInputFile
A wrapper around an istream used for reading an IFF file.
Definition: iffInputFile.h:30
LwoChunk
A specialization of IffChunk for Lightwave Object files.
Definition: lwoChunk.h:26
LwoGroupChunk
A particular kind of LwoChunk that is expected to contain an arbitrary number of child chunks.
Definition: lwoGroupChunk.h:30
LwoGroupChunk::get_num_chunks
int get_num_chunks() const
Returns the number of child chunks of this group.
Definition: lwoGroupChunk.cxx:25
LwoGroupChunk::get_chunk
IffChunk * get_chunk(int n) const
Returns the nth child chunk of this group.
Definition: lwoGroupChunk.cxx:33
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
pvector
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
iffChunk.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lwoChunk.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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