Panda3D
dcClassParameter.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dcClassParameter.h
10  * @author drose
11  * @date 2004-06-18
12  */
13 
14 #ifndef DCCLASSPARAMETER_H
15 #define DCCLASSPARAMETER_H
16 
17 #include "dcbase.h"
18 #include "dcParameter.h"
19 
20 class DCClass;
21 
22 /**
23  * This represents a class (or struct) object used as a parameter itself.
24  * This means that all the fields of the class get packed into the message.
25  */
26 class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
27 public:
28  DCClassParameter(const DCClass *dclass);
30 
31 PUBLISHED:
32  virtual DCClassParameter *as_class_parameter();
33  virtual const DCClassParameter *as_class_parameter() const;
34  virtual DCParameter *make_copy() const;
35  virtual bool is_valid() const;
36 
37  const DCClass *get_class() const;
38 
39 public:
40  virtual DCPackerInterface *get_nested_field(int n) const;
41 
42  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
43  const std::string &name, const std::string &postname) const;
44  virtual void generate_hash(HashGenerator &hashgen) const;
45 
46 protected:
47  virtual bool do_check_match(const DCPackerInterface *other) const;
48  virtual bool do_check_match_class_parameter(const DCClassParameter *other) const;
49  virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const;
50 
51 private:
52  typedef pvector<DCPackerInterface *> Fields;
53  Fields _nested_fields;
54 
55  const DCClass *_dclass;
56 };
57 
58 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
DCClass * get_class() const
Returns the DCClass pointer for the class that contains this field.
Definition: dcField.I:27
virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const
Returns true if this field matches the indicated array parameter, false otherwise.
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:44
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
Represents the type specification for a single parameter within a field specification.
Definition: dcParameter.h:35
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:24
virtual bool do_check_match_class_parameter(const DCClassParameter *other) const
Returns true if this field matches the indicated class parameter, false otherwise.
This defines the internal interface for packing values into a DCField.