dcField.cxx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Filename: dcField.cxx
  2. // Created by: drose (11Oct00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #include "dcField.h"
  19. #include "hashGenerator.h"
  20. ////////////////////////////////////////////////////////////////////
  21. // Function: DCField::get_number
  22. // Access: Public
  23. // Description: Returns a unique index number associated with this
  24. // field. This is defined implicitly when the .dc
  25. // file(s) are read.
  26. ////////////////////////////////////////////////////////////////////
  27. int DCField::
  28. get_number() const {
  29. return _number;
  30. }
  31. ////////////////////////////////////////////////////////////////////
  32. // Function: DCField::get_name
  33. // Access: Public
  34. // Description: Returns the name of this field.
  35. ////////////////////////////////////////////////////////////////////
  36. const string &DCField::
  37. get_name() const {
  38. return _name;
  39. }
  40. ////////////////////////////////////////////////////////////////////
  41. // Function: DCField::as_atomic_field
  42. // Access: Public, Virtual
  43. // Description: Returns the same field pointer converted to an atomic
  44. // field pointer, if this is in fact an atomic field;
  45. // otherwise, returns NULL.
  46. ////////////////////////////////////////////////////////////////////
  47. DCAtomicField *DCField::
  48. as_atomic_field() {
  49. return (DCAtomicField *)NULL;
  50. }
  51. ////////////////////////////////////////////////////////////////////
  52. // Function: DCField::as_molecular_field
  53. // Access: Public, Virtual
  54. // Description: Returns the same field pointer converted to a
  55. // molecular field pointer, if this is in fact a
  56. // molecular field; otherwise, returns NULL.
  57. ////////////////////////////////////////////////////////////////////
  58. DCMolecularField *DCField::
  59. as_molecular_field() {
  60. return (DCMolecularField *)NULL;
  61. }
  62. ////////////////////////////////////////////////////////////////////
  63. // Function: DCField::Destructor
  64. // Access: Public, Virtual
  65. // Description:
  66. ////////////////////////////////////////////////////////////////////
  67. DCField::
  68. ~DCField() {
  69. }
  70. ////////////////////////////////////////////////////////////////////
  71. // Function: DCField::generate_hash
  72. // Access: Public, Virtual
  73. // Description: Accumulates the properties of this field into the
  74. // hash.
  75. ////////////////////////////////////////////////////////////////////
  76. void DCField::
  77. generate_hash(HashGenerator &hashgen) const {
  78. // It shouldn't be necessary to explicitly add _number to the
  79. // hash--this is computed based on the relative position of this
  80. // field with the other fields, so adding it explicitly will be
  81. // redundant. However, the field name is significant.
  82. hashgen.add_string(_name);
  83. }