Panda3D
 All Classes Functions Variables Enumerations
vrmlNode.h
1 // Filename: vrmlNode.h
2 // Created by: drose (23Jun99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 // PANDA 3D SOFTWARE
6 // Copyright (c) Carnegie Mellon University. All rights reserved.
7 //
8 // All use of this software is subject to the terms of the revised BSD
9 // license. You should have received a copy of this license along
10 // with this source code in a file named "LICENSE."
11 ////////////////////////////////////////////////////////////////////
12 
13 #ifndef VRMLNODE_H
14 #define VRMLNODE_H
15 
16 #include "pandatoolbase.h"
17 
18 #include "vrmlNodeType.h"
19 #include "pvector.h"
20 #include "pmap.h"
21 
22 class VrmlNode {
23 public:
24  VrmlNode(const VrmlNodeType *type);
25  ~VrmlNode();
26 
27  const VrmlFieldValue &get_value(const char *field_name) const;
28 
29  void output(ostream &out, int indent) const;
30 
31  class Field {
32  public:
33  Field() { }
34  Field(const VrmlNodeType::NameTypeRec *type, const VrmlFieldValue &value) :
35  _type(type), _value(value) { }
36  const VrmlNodeType::NameTypeRec *_type;
37  VrmlFieldValue _value;
38  };
39 
40  typedef vector<Field> Fields;
41  Fields _fields;
42 
43  int _use_count;
44 
45  const VrmlNodeType *_type;
46 };
47 
48 inline ostream &operator << (ostream &out, const VrmlNode &node) {
49  node.output(out, 0);
50  return out;
51 }
52 
53 class Declaration {
54 public:
55  SFNodeRef _node;
56 
57  void output(ostream &out, int indent) const;
58 };
59 
60 inline ostream &operator << (ostream &out, const Declaration &dec) {
61  dec.output(out, 0);
62  return out;
63 }
64 
66 
67 ostream &operator << (ostream &out, const VrmlScene &scene);
68 
69 #endif
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39