00001 // Filename: bamEnums.h 00002 // Created by: drose (26Feb09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef BAMENUMS_H 00016 #define BAMENUMS_H 00017 00018 #include "pandabase.h" 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Class : BamEnums 00022 // Description : This class exists just to provide scoping for the 00023 // enums shared by BamReader and BamWriter. 00024 //////////////////////////////////////////////////////////////////// 00025 class EXPCL_PANDA_PUTIL BamEnums { 00026 PUBLISHED: 00027 00028 // This defines an enumerated type used to represent the endianness of 00029 // certain numeric values stored in a Bam file. It really has only 00030 // two possible values, either BE_bigendian or BE_littleendian; but 00031 // through a preprocessor trick we also add BE_native, which is the 00032 // same numerically as whichever value the hardware supports natively. 00033 enum BamEndian { 00034 BE_bigendian = 0, 00035 BE_littleendian = 1, 00036 #ifdef WORDS_BIGENDIAN 00037 BE_native = 0, 00038 #else 00039 BE_native = 1, 00040 #endif 00041 }; 00042 00043 // This is the code written along with each object. It is used to 00044 // control object scoping. A BOC_push includes an object 00045 // definition, and will always be eventually paired with a BOC_pop 00046 // (which does not). A BOC_adjunct includes an object definition 00047 // but does not push the level; it is associated with the current 00048 // level. BOC_remove lists object ID's that have been deallocated 00049 // on the sender end. BOC_file_data may appear at any level and 00050 // indicates the following datagram contains auxiliary file data 00051 // that may be referenced by a later object. 00052 enum BamObjectCode { 00053 BOC_push, 00054 BOC_pop, 00055 BOC_adjunct, 00056 BOC_remove, 00057 BOC_file_data, 00058 }; 00059 00060 // This enum is used to control how textures are written to a bam 00061 // stream. 00062 enum BamTextureMode { 00063 BTM_unchanged, 00064 BTM_fullpath, 00065 BTM_relative, 00066 BTM_basename, 00067 BTM_rawdata 00068 }; 00069 }; 00070 00071 EXPCL_PANDA_PUTIL ostream &operator << (ostream &out, BamEnums::BamEndian be); 00072 EXPCL_PANDA_PUTIL istream &operator >> (istream &in, BamEnums::BamEndian &be); 00073 00074 EXPCL_PANDA_PUTIL ostream &operator << (ostream &out, BamEnums::BamObjectCode boc); 00075 00076 EXPCL_PANDA_PUTIL ostream &operator << (ostream &out, BamEnums::BamTextureMode btm); 00077 EXPCL_PANDA_PUTIL istream &operator >> (istream &in, BamEnums::BamTextureMode &btm); 00078 00079 #endif 00080