dcClassParameter.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Filename: dcClassParameter.h
  2. // Created by: drose (18Jun04)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, 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://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef DCCLASSPARAMETER_H
  19. #define DCCLASSPARAMETER_H
  20. #include "dcbase.h"
  21. #include "dcParameter.h"
  22. class DCClass;
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : DCClassParameter
  25. // Description : This represents a class (or struct) object used as a
  26. // parameter itself. This means that all the fields of
  27. // the class get packed into the message.
  28. ////////////////////////////////////////////////////////////////////
  29. class EXPCL_DIRECT DCClassParameter : public DCParameter {
  30. public:
  31. DCClassParameter(const DCClass *dclass);
  32. DCClassParameter(const DCClassParameter &copy);
  33. PUBLISHED:
  34. virtual DCClassParameter *as_class_parameter();
  35. virtual const DCClassParameter *as_class_parameter() const;
  36. virtual DCParameter *make_copy() const;
  37. virtual bool is_valid() const;
  38. const DCClass *get_class() const;
  39. public:
  40. virtual DCPackerInterface *get_nested_field(int n) const;
  41. virtual void output_instance(ostream &out, bool brief, const string &prename,
  42. const string &name, const string &postname) const;
  43. virtual void generate_hash(HashGenerator &hashgen) const;
  44. protected:
  45. virtual bool do_check_match(const DCPackerInterface *other) const;
  46. virtual bool do_check_match_class_parameter(const DCClassParameter *other) const;
  47. virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const;
  48. private:
  49. typedef pvector<DCPackerInterface *> Fields;
  50. Fields _nested_fields;
  51. const DCClass *_dclass;
  52. };
  53. #endif