Panda3D
 All Classes Functions Variables Enumerations
dcClassParameter.h
00001 // Filename: dcClassParameter.h
00002 // Created by:  drose (18Jun04)
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 DCCLASSPARAMETER_H
00016 #define DCCLASSPARAMETER_H
00017 
00018 #include "dcbase.h"
00019 #include "dcParameter.h"
00020 
00021 class DCClass;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : DCClassParameter
00025 // Description : This represents a class (or struct) object used as a
00026 //               parameter itself.  This means that all the fields of
00027 //               the class get packed into the message.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_DIRECT DCClassParameter : public DCParameter {
00030 public:
00031   DCClassParameter(const DCClass *dclass);
00032   DCClassParameter(const DCClassParameter &copy);
00033 
00034 PUBLISHED:
00035   virtual DCClassParameter *as_class_parameter();
00036   virtual const DCClassParameter *as_class_parameter() const;
00037   virtual DCParameter *make_copy() const;
00038   virtual bool is_valid() const;
00039 
00040   const DCClass *get_class() const;
00041 
00042 public:
00043   virtual DCPackerInterface *get_nested_field(int n) const;
00044 
00045   virtual void output_instance(ostream &out, bool brief, const string &prename, 
00046                                const string &name, const string &postname) const;
00047   virtual void generate_hash(HashGenerator &hashgen) const;
00048 
00049 protected:
00050   virtual bool do_check_match(const DCPackerInterface *other) const;
00051   virtual bool do_check_match_class_parameter(const DCClassParameter *other) const;
00052   virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const;
00053 
00054 private:
00055   typedef pvector<DCPackerInterface *> Fields;
00056   Fields _nested_fields;
00057 
00058   const DCClass *_dclass;
00059 };
00060 
00061 #endif
 All Classes Functions Variables Enumerations