Panda3D

Loading...
Searching...
No Matches
dcMolecularField.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 dcMolecularField.h
10 * @author drose
11 * @date 2000-10-05
12 */
13
14#ifndef DCMOLECULARFIELD_H
15#define DCMOLECULARFIELD_H
16
17#include "dcbase.h"
18#include "dcField.h"
19
20 class DCAtomicField;
21 class DCParameter;
22
23/**
24 * A single molecular field of a Distributed Class, as read from a .dc file.
25 * This represents a combination of two or more related atomic fields, that
26 * will often be treated as a unit.
27 */
28 class EXPCL_DIRECT_DCPARSER DCMolecularField : public DCField {
29 public:
30 DCMolecularField(const std::string &name, DCClass *dclass);
31
32PUBLISHED:
33 virtual DCMolecularField *as_molecular_field();
34 virtual const DCMolecularField *as_molecular_field() const;
35
36 int get_num_atomics() const;
37 DCAtomicField *get_atomic(int n) const;
38
39 public:
40 void add_atomic(DCAtomicField *atomic);
41
42 virtual void output(std::ostream &out, bool brief) const;
43 virtual void write(std::ostream &out, bool brief, int indent_level) const;
44 virtual void generate_hash(HashGenerator &hashgen) const;
45
46 virtual DCPackerInterface *get_nested_field(int n) const;
47
48 protected:
49 virtual bool do_check_match(const DCPackerInterface *other) const;
50 virtual bool do_check_match_molecular_field(const DCMolecularField *other) const;
51
52 private:
53 // These members define the primary interface to the molecular field
54 // definition as read from the file.
55 typedef pvector<DCAtomicField *> Fields;
56 Fields _fields;
57 bool _got_keywords;
58
59 DCParameter *get_next_pack_element();
60
61 typedef pvector<DCPackerInterface *> NestedFields;
62 NestedFields _nested_fields;
63};
64
65#endif
DCAtomicField
A single atomic field of a Distributed Class, as read from a .dc file.
Definition dcAtomicField.h:30
DCClass
Defines a particular DistributedClass as read from an input .dc file.
Definition dcClass.h:44
DCField::write
void write(std::ostream &out, int indent_level) const
Write a string representation of this instance to <out>.
Definition dcField.I:149
DCField::generate_hash
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this field into the hash.
Definition dcField.cxx:467
DCField::output
void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition dcField.I:141
DCField::as_molecular_field
virtual DCMolecularField * as_molecular_field()
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular...
Definition dcField.cxx:130
DCMolecularField::get_num_atomics
int get_num_atomics() const
Returns the number of atomic fields that make up this molecular field.
Definition dcMolecularField.cxx:51
DCMolecularField::get_atomic
DCAtomicField * get_atomic(int n) const
Returns the nth atomic field that makes up this molecular field.
Definition dcMolecularField.cxx:61
DCMolecularField::add_atomic
void add_atomic(DCAtomicField *atomic)
Adds the indicated atomic field to the end of the list of atomic fields that make up the molecular fi...
Definition dcMolecularField.cxx:74
DCPackerInterface::get_nested_field
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
Definition dcPackerInterface.cxx:188
DCPackerInterface::do_check_match_molecular_field
virtual bool do_check_match_molecular_field(const DCMolecularField *other) const
Returns true if this field matches the indicated molecular field, false otherwise.
Definition dcPackerInterface.cxx:444
DCParameter
Represents the type specification for a single parameter within a field specification.
Definition dcParameter.h:35
HashGenerator
This class generates an arbitrary hash number from a sequence of ints.
Definition hashGenerator.h:23
dcField.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dcbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.