37class EXPCL_DIRECT_DCPARSER DCField :
public DCPackerInterface,
public DCKeywordList {
40 DCField(
const std::string &name,
DCClass *dclass);
47 virtual DCField *as_field();
48 virtual const DCField *as_field()
const;
56 std::string
format_data(
const vector_uchar &packed_data,
bool show_field_names =
true);
57 vector_uchar
parse_string(
const std::string &formatted_string);
68 INLINE
bool is_ram()
const;
69 INLINE
bool is_db()
const;
76 INLINE
void output(std::ostream &out)
const;
77 INLINE
void write(std::ostream &out,
int indent_level)
const;
80 bool pack_args(
DCPacker &packer, PyObject *sequence)
const;
81 PyObject *unpack_args(
DCPacker &packer)
const;
83 void receive_update(
DCPacker &packer, PyObject *distobj)
const;
85 Datagram client_format_update(DOID_TYPE do_id, PyObject *args)
const;
86 Datagram ai_format_update(DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
87 PyObject *args)
const;
88 Datagram ai_format_update_msg_type(DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
89 int msg_type, PyObject *args)
const;
93 virtual void output(std::ostream &out,
bool brief)
const=0;
94 virtual void write(std::ostream &out,
bool brief,
int indent_level)
const=0;
97 virtual void set_name(
const std::string &name);
104 static std::string get_pystr(PyObject *value);
108 void refresh_default_value();
113 bool _default_value_stale;
114 bool _has_default_value;
118 vector_uchar _default_value;
125INLINE std::ostream &operator << (std::ostream &out,
const DCField &field) {
A single atomic field of a Distributed Class, as read from a .dc file.
Defines a particular DistributedClass as read from an input .dc file.
A single field of a Distributed Class, either atomic or molecular.
bool has_default_value() const
Returns true if a default value has been explicitly established for this field, false otherwise.
void set_number(int number)
Assigns the unique number to this field.
DCClass * get_class() const
Returns the DCClass pointer for the class that contains this field.
bool is_clsend() const
Returns true if the "clsend" flag is set for this field, false otherwise.
bool is_ownsend() const
Returns true if the "ownsend" flag is set for this field, false otherwise.
bool is_bogus_field() const
Returns true if the field has been flagged as a bogus field.
bool is_broadcast() const
Returns true if the "broadcast" flag is set for this field, false otherwise.
bool is_clrecv() const
Returns true if the "clrecv" flag is set for this field, false otherwise.
int get_number() const
Returns a unique index number associated with this field.
bool is_required() const
Returns true if the "required" flag is set for this field, false otherwise.
std::string format_data(const std::vector< unsigned char > &packed_data, bool show_field_names=true)
Given a blob that represents the packed data for this field, returns a string formatting it for human...
void set_default_value(std::vector< unsigned char > default_value)
Establishes a default value for this field.
bool is_db() const
Returns true if the "db" flag is set for this field, false otherwise.
bool is_airecv() const
Returns true if the "airecv" flag is set for this field, false otherwise.
const std::vector< unsigned char > & get_default_value() const
Returns the default value for this field.
void write(std::ostream &out, int indent_level) const
Write a string representation of this instance to <out>.
std::vector< unsigned char > parse_string(const std::string &formatted_string)
Given a human-formatted string (for instance, as returned by format_data(), above) that represents th...
virtual DCAtomicField * as_atomic_field()
Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic fie...
void output(std::ostream &out) const
Write a string representation of this instance to <out>.
void set_class(DCClass *dclass)
Assigns the class pointer to this field.
bool is_ram() const
Returns true if the "ram" flag is set for this field, false otherwise.
virtual DCMolecularField * as_molecular_field()
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular...
bool is_ownrecv() const
Returns true if the "ownrecv" flag is set for this field, false otherwise.
bool validate_ranges(const std::vector< unsigned char > &packed_data) const
Verifies that all of the packed values in the field data are within the specified ranges and that the...
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of these keywords into the hash.
A single molecular field of a Distributed Class, as read from a .dc file.
This is a block of data that receives the results of DCPacker.
virtual void set_name(const std::string &name)
Sets the name of this field.
virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const
Packs the field's specified default value (or a sensible default if no value is specified) into the s...
This class can be used for packing a series of numeric and string data into a binary stream,...
Represents the type specification for a single parameter within a field specification.
This represents a switch statement, which can appear inside a class body and represents two or more a...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This class generates an arbitrary hash number from a sequence of ints.
A lightweight class that represents a single element that may be timed and/or counted via stats.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.