Panda3D
 All Classes Functions Variables Enumerations
dcClassParameter.h
1 // Filename: dcClassParameter.h
2 // Created by: drose (18Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DCCLASSPARAMETER_H
16 #define DCCLASSPARAMETER_H
17 
18 #include "dcbase.h"
19 #include "dcParameter.h"
20 
21 class DCClass;
22 
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);
33 
34 PUBLISHED:
35  virtual DCClassParameter *as_class_parameter();
36  virtual const DCClassParameter *as_class_parameter() const;
37  virtual DCParameter *make_copy() const;
38  virtual bool is_valid() const;
39 
40  const DCClass *get_class() const;
41 
42 public:
43  virtual DCPackerInterface *get_nested_field(int n) const;
44 
45  virtual void output_instance(ostream &out, bool brief, const string &prename,
46  const string &name, const string &postname) const;
47  virtual void generate_hash(HashGenerator &hashgen) const;
48 
49 protected:
50  virtual bool do_check_match(const DCPackerInterface *other) const;
51  virtual bool do_check_match_class_parameter(const DCClassParameter *other) const;
52  virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const;
53 
54 private:
55  typedef pvector<DCPackerInterface *> Fields;
56  Fields _nested_fields;
57 
58  const DCClass *_dclass;
59 };
60 
61 #endif
virtual bool do_check_match_class_parameter(const DCClassParameter *other) const
Returns true if this field matches the indicated class parameter, false otherwise.
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
This represents a class (or struct) object used as a parameter itself.
Defines a particular DistributedClass as read from an input .dc file.
Definition: dcClass.h:47
DCClass * get_class() const
Returns the DCClass pointer for the class that contains this field.
Definition: dcField.I:35
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const
Returns true if this field matches the indicated array parameter, false otherwise.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
Represents the type specification for a single parameter within a field specification.
Definition: dcParameter.h:39
This represents an array of some other kind of object, meaning this parameter type accepts an arbitra...
This class generates an arbitrary hash number from a sequence of ints.
Definition: hashGenerator.h:26
This defines the internal interface for packing values into a DCField.