00001 // Filename: dcField.cxx 00002 // Created by: drose (11Oct00) 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 #include "dcField.h" 00020 #include "hashGenerator.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: DCField::get_number 00024 // Access: Public 00025 // Description: Returns a unique index number associated with this 00026 // field. This is defined implicitly when the .dc 00027 // file(s) are read. 00028 //////////////////////////////////////////////////////////////////// 00029 int DCField:: 00030 get_number() const { 00031 return _number; 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: DCField::get_name 00036 // Access: Public 00037 // Description: Returns the name of this field. 00038 //////////////////////////////////////////////////////////////////// 00039 const string &DCField:: 00040 get_name() const { 00041 return _name; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: DCField::as_atomic_field 00046 // Access: Public, Virtual 00047 // Description: Returns the same field pointer converted to an atomic 00048 // field pointer, if this is in fact an atomic field; 00049 // otherwise, returns NULL. 00050 //////////////////////////////////////////////////////////////////// 00051 DCAtomicField *DCField:: 00052 as_atomic_field() { 00053 return (DCAtomicField *)NULL; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: DCField::as_molecular_field 00058 // Access: Public, Virtual 00059 // Description: Returns the same field pointer converted to a 00060 // molecular field pointer, if this is in fact a 00061 // molecular field; otherwise, returns NULL. 00062 //////////////////////////////////////////////////////////////////// 00063 DCMolecularField *DCField:: 00064 as_molecular_field() { 00065 return (DCMolecularField *)NULL; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: DCField::Destructor 00070 // Access: Public, Virtual 00071 // Description: 00072 //////////////////////////////////////////////////////////////////// 00073 DCField:: 00074 ~DCField() { 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: DCField::generate_hash 00079 // Access: Public, Virtual 00080 // Description: Accumulates the properties of this field into the 00081 // hash. 00082 //////////////////////////////////////////////////////////////////// 00083 void DCField:: 00084 generate_hash(HashGenerator &hashgen) const { 00085 // It shouldn't be necessary to explicitly add _number to the 00086 // hash--this is computed based on the relative position of this 00087 // field with the other fields, so adding it explicitly will be 00088 // redundant. However, the field name is significant. 00089 hashgen.add_string(_name); 00090 }