Panda3D
 All Classes Functions Variables Enumerations
xFileDataNodeReference.h
00001 // Filename: xFileDataNodeReference.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 XFILEDATANODEREFERENCE_H
00016 #define XFILEDATANODEREFERENCE_H
00017 
00018 #include "pandatoolbase.h"
00019 #include "xFileDataNodeTemplate.h"
00020 #include "pointerTo.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : XFileDataNodeReference
00024 // Description : This is a nested reference to an instance of a
00025 //               template object, declared via the syntax:
00026 //
00027 //                 { InstanceName }
00028 //
00029 //               in the X File.
00030 ////////////////////////////////////////////////////////////////////
00031 class XFileDataNodeReference : public XFileDataNode {
00032 public:
00033   XFileDataNodeReference(XFileDataNodeTemplate *object);
00034 
00035   INLINE XFileTemplate *get_template() const;
00036   INLINE XFileDataNodeTemplate *get_object() const;
00037 
00038   virtual bool is_reference() const;
00039   virtual bool is_complex_object() const;
00040 
00041   virtual void write_text(ostream &out, int indent_level) const;
00042 
00043 protected:
00044   virtual int get_num_elements() const;
00045   virtual XFileDataObject *get_element(int n);
00046   virtual XFileDataObject *get_element(const string &name);
00047 
00048 private:
00049   PT(XFileDataNodeTemplate) _object;
00050 
00051 public:
00052   static TypeHandle get_class_type() {
00053     return _type_handle;
00054   }
00055   static void init_type() {
00056     XFileDataNode::init_type();
00057     register_type(_type_handle, "XFileDataNodeReference",
00058                   XFileDataNode::get_class_type());
00059   }
00060   virtual TypeHandle get_type() const {
00061     return get_class_type();
00062   }
00063   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00064 
00065 private:
00066   static TypeHandle _type_handle;
00067 };
00068 
00069 #include "xFileDataNodeReference.I"
00070 
00071 #endif
00072   
00073 
00074 
00075 
 All Classes Functions Variables Enumerations