Panda3D

dcMolecularField.h

00001 // Filename: dcMolecularField.h
00002 // Created by:  drose (05Oct00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef DCMOLECULARFIELD_H
00016 #define DCMOLECULARFIELD_H
00017 
00018 #include "dcbase.h"
00019 #include "dcField.h"
00020 
00021 class DCAtomicField;
00022 class DCParameter;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : DCMolecularField
00026 // Description : A single molecular field of a Distributed Class, as
00027 //               read from a .dc file.  This represents a combination
00028 //               of two or more related atomic fields, that will often
00029 //               be treated as a unit.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_DIRECT DCMolecularField : public DCField {
00032 public:
00033   DCMolecularField(const string &name, DCClass *dclass);
00034 
00035 PUBLISHED:
00036   virtual DCMolecularField *as_molecular_field();
00037   virtual const DCMolecularField *as_molecular_field() const;
00038 
00039   int get_num_atomics() const;
00040   DCAtomicField *get_atomic(int n) const;
00041 
00042 public:
00043   void add_atomic(DCAtomicField *atomic);
00044 
00045   virtual void output(ostream &out, bool brief) const;
00046   virtual void write(ostream &out, bool brief, int indent_level) const;
00047   virtual void generate_hash(HashGenerator &hashgen) const;
00048 
00049   virtual DCPackerInterface *get_nested_field(int n) const;
00050 
00051 protected:
00052   virtual bool do_check_match(const DCPackerInterface *other) const;
00053   virtual bool do_check_match_molecular_field(const DCMolecularField *other) const;
00054 
00055 private:
00056   // These members define the primary interface to the molecular field
00057   // definition as read from the file.
00058   typedef pvector<DCAtomicField *> Fields;
00059   Fields _fields;
00060   bool _got_keywords;
00061 
00062   DCParameter *get_next_pack_element();
00063 
00064   typedef pvector<DCPackerInterface *> NestedFields;
00065   NestedFields _nested_fields;
00066 };
00067 
00068 #endif
00069 
00070 
 All Classes Functions Variables Enumerations