Panda3D
|
00001 // Filename: xFileDataNode.h 00002 // Created by: drose (08Oct04) 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 XFILEDATANODE_H 00016 #define XFILEDATANODE_H 00017 00018 #include "pandatoolbase.h" 00019 #include "xFileNode.h" 00020 #include "xFileDataObject.h" 00021 #include "xFileTemplate.h" 00022 #include "pointerTo.h" 00023 #include "dcast.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : XFileDataNode 00027 // Description : This is an abstract base class for an XFileNode which 00028 // is also an XFileDataObject. That is to say, objects 00029 // that inherit from this class may be added to the 00030 // toplevel X file graph as nodes, and they also may be 00031 // containers for data elements. 00032 // 00033 // Specifically, this is the base class of both 00034 // XFileDataNodeTemplate and XFileDataNodeReference. 00035 //////////////////////////////////////////////////////////////////// 00036 class XFileDataNode : public XFileNode, public XFileDataObject { 00037 public: 00038 XFileDataNode(XFile *x_file, const string &name, 00039 XFileTemplate *xtemplate); 00040 00041 virtual bool is_object() const; 00042 virtual bool is_standard_object(const string &template_name) const; 00043 virtual string get_type_name() const; 00044 00045 INLINE const XFileDataNode &get_data_child(int n) const; 00046 00047 INLINE XFileTemplate *get_template() const; 00048 INLINE const string &get_template_name() const; 00049 00050 protected: 00051 PT(XFileTemplate) _template; 00052 00053 public: 00054 static TypeHandle get_class_type() { 00055 return _type_handle; 00056 } 00057 static void init_type() { 00058 XFileNode::init_type(); 00059 XFileDataObject::init_type(); 00060 register_type(_type_handle, "XFileDataNode", 00061 XFileNode::get_class_type(), 00062 XFileDataObject::get_class_type()); 00063 } 00064 virtual TypeHandle get_type() const { 00065 return get_class_type(); 00066 } 00067 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00068 00069 private: 00070 static TypeHandle _type_handle; 00071 }; 00072 00073 #include "xFileDataNode.I" 00074 00075 #endif 00076 00077 00078 00079