forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdcArrayParameter.h
More file actions
74 lines (63 loc) · 2.85 KB
/
dcArrayParameter.h
File metadata and controls
74 lines (63 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file dcArrayParameter.h
* @author drose
* @date 2004-06-17
*/
#ifndef DCARRAYPARAMETER_H
#define DCARRAYPARAMETER_H
#include "dcbase.h"
#include "dcParameter.h"
#include "dcNumericRange.h"
/**
* This represents an array of some other kind of object, meaning this
* parameter type accepts an arbitrary (or possibly fixed) number of nested
* fields, all of which are of the same type.
*/
class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
public:
DCArrayParameter(DCParameter *element_type,
const DCUnsignedIntRange &size = DCUnsignedIntRange());
DCArrayParameter(const DCArrayParameter ©);
virtual ~DCArrayParameter();
PUBLISHED:
virtual DCArrayParameter *as_array_parameter();
virtual const DCArrayParameter *as_array_parameter() const;
virtual DCParameter *make_copy() const;
virtual bool is_valid() const;
DCParameter *get_element_type() const;
int get_array_size() const;
public:
virtual DCParameter *append_array_specification(const DCUnsignedIntRange &size);
virtual int calc_num_nested_fields(size_t length_bytes) const;
virtual DCPackerInterface *get_nested_field(int n) const;
virtual bool validate_num_nested_fields(int num_nested_fields) const;
virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
const std::string &name, const std::string &postname) const;
virtual void generate_hash(HashGenerator &hashgen) const;
virtual void pack_string(DCPackData &pack_data, const std::string &value,
bool &pack_error, bool &range_error) const;
virtual void pack_blob(DCPackData &pack_data, const vector_uchar &value,
bool &pack_error, bool &range_error) const;
virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
virtual void unpack_string(const char *data, size_t length, size_t &p,
std::string &value, bool &pack_error, bool &range_error) const;
virtual void unpack_blob(const char *data, size_t length, size_t &p,
vector_uchar &value, bool &pack_error, bool &range_error) const;
protected:
virtual bool do_check_match(const DCPackerInterface *other) const;
virtual bool do_check_match_simple_parameter(const DCSimpleParameter *other) const;
virtual bool do_check_match_class_parameter(const DCClassParameter *other) const;
virtual bool do_check_match_array_parameter(const DCArrayParameter *other) const;
private:
DCParameter *_element_type;
int _array_size;
DCUnsignedIntRange _array_size_range;
};
#endif