Panda3D
 All Classes Functions Variables Enumerations
iffId.I
00001 // Filename: iffId.I
00002 // Created by:  drose (23Apr01)
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 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: IffId::Default Constructor
00018 //       Access: Public
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE IffId::
00022 IffId() {
00023   _id._c[0] = 0;
00024   _id._c[1] = 0;
00025   _id._c[2] = 0;
00026   _id._c[3] = 0;
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: IffId::Constructor
00031 //       Access: Public
00032 //  Description:
00033 ////////////////////////////////////////////////////////////////////
00034 INLINE IffId::
00035 IffId(const char id[4]) {
00036   _id._c[0] = id[0];
00037   _id._c[1] = id[1];
00038   _id._c[2] = id[2];
00039   _id._c[3] = id[3];
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: IffId::Copy Constructor
00044 //       Access: Public
00045 //  Description:
00046 ////////////////////////////////////////////////////////////////////
00047 INLINE IffId::
00048 IffId(const IffId &copy) {
00049   _id._n = copy._id._n;
00050 }
00051 
00052 ////////////////////////////////////////////////////////////////////
00053 //     Function: IffId::Copy Assignment Operator
00054 //       Access: Public
00055 //  Description:
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE void IffId::
00058 operator = (const IffId &copy) {
00059   _id._n = copy._id._n;
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: IffId::Equivalence Operator
00064 //       Access: Public
00065 //  Description:
00066 ////////////////////////////////////////////////////////////////////
00067 INLINE bool IffId::
00068 operator == (const IffId &other) const {
00069   return (_id._n == other._id._n);
00070 }
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 //     Function: IffId::Nonequivalence Operator
00074 //       Access: Public
00075 //  Description:
00076 ////////////////////////////////////////////////////////////////////
00077 INLINE bool IffId::
00078 operator != (const IffId &other) const {
00079   return (_id._n != other._id._n);
00080 }
00081 
00082 ////////////////////////////////////////////////////////////////////
00083 //     Function: IffId::Ordering Operator
00084 //       Access: Public
00085 //  Description: The ordering is arbitrary, and may not even be
00086 //               consistent between different architectures
00087 //               (e.g. big-endian and little-endian).  It is useful
00088 //               mainly for putting IffId's into a sorted container,
00089 //               like sets and maps.
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE bool IffId::
00092 operator < (const IffId &other) const {
00093   return (_id._n < other._id._n);
00094 }
00095 
00096 ////////////////////////////////////////////////////////////////////
00097 //     Function: IffId::get_name
00098 //       Access: Public
00099 //  Description: Returns the four-character name of the Id, for
00100 //               outputting.
00101 ////////////////////////////////////////////////////////////////////
00102 INLINE string IffId::
00103 get_name() const {
00104   return string(_id._c, 4);
00105 }
 All Classes Functions Variables Enumerations