00001 // Filename: iffChunk.h 00002 // Created by: drose (23Apr01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef IFFCHUNK_H 00020 #define IFFCHUNK_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "iffId.h" 00025 00026 #include <typedObject.h> 00027 #include <typedReferenceCount.h> 00028 00029 class IffInputFile; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : IffChunk 00033 // Description : The basic kind of record in an EA "IFF" file, which 00034 // the LightWave object file is based on. 00035 //////////////////////////////////////////////////////////////////// 00036 class IffChunk : public TypedReferenceCount { 00037 public: 00038 INLINE IffChunk(); 00039 00040 INLINE IffId get_id() const; 00041 INLINE void set_id(IffId id); 00042 00043 virtual bool read_iff(IffInputFile *in, size_t stop_at)=0; 00044 00045 virtual void output(ostream &out) const; 00046 virtual void write(ostream &out, int indent_level = 0) const; 00047 00048 virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id); 00049 00050 private: 00051 IffId _id; 00052 00053 public: 00054 virtual TypeHandle get_type() const { 00055 return get_class_type(); 00056 } 00057 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00058 static TypeHandle get_class_type() { 00059 return _type_handle; 00060 } 00061 static void init_type() { 00062 TypedReferenceCount::init_type(); 00063 register_type(_type_handle, "IffChunk", 00064 TypedReferenceCount::get_class_type()); 00065 } 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 }; 00070 00071 #include "iffChunk.I" 00072 00073 INLINE ostream &operator << (ostream &out, const IffChunk &chunk) { 00074 chunk.output(out); 00075 return out; 00076 } 00077 00078 #endif 00079 00080