00001
00002
00003
00004
00005
00006
00007 #ifndef _XML_READER_H
00008 #define _XML_READER_H
00009
00010 #include <map>
00011 #include <string>
00012 #include <vector>
00013 #include <libxml/parser.h>
00014 #include <libxml/tree.h>
00015 #include <boost/shared_ptr.hpp>
00016 #include <Physsim/VectorN.h>
00017 #include <Physsim/MatrixN.h>
00018
00019 namespace Physsim {
00020
00021 class Simulator;
00022 class RigidBody;
00023 class RCArticulatedBody;
00024 class Primitive;
00025
00027 class XMLReader
00028 {
00029 public:
00030 static std::map<std::string, BasePtr> read(const std::string& fname);
00031
00032 private:
00033 static XMLTreeConstPtr find_subtree(XMLTreeConstPtr root, const std::string& name);
00034 static void process_tag(const std::string& tag, XMLTreeConstPtr root, void (*fn)(XMLTreeConstPtr, std::map<std::string, BasePtr>&), std::map<std::string, BasePtr>& id_map);
00035 static void read_adf_coldet(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00036 static void read_pqp_coldet(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00037 static void read_box(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00038 static void read_sphere(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00039 static void read_cylinder(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00040 static void read_trimesh(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00041 static void read_euler_integrator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00042 static void read_rk4_integrator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00043 static void read_rk4i_integrator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00044 static void read_thresh_contact_simulator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00045 static void read_impulse_contact_simulator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00046 static void read_simulator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00047 static void read_rigid_body(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00048 static void read_rcab_link(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00049 static void read_rc_abody(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00050 static void read_so_separator(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00051 static void read_collision_geometry(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00052 static void read_prismatic_joint(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00053 static void read_revolute_joint(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00054 static void read_spherical_joint(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00055 static void read_universal_joint(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00056 static void read_gravity_force(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00057 static void read_newton_model(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00058 static void read_poisson_model(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00059 static void read_mirtich_model(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00060 static void read_lcp_method(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00061 static void read_penalty_method(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00062 static void read_crb_algorithm(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00063 static void read_fsab_algorithm(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00064 static XMLTreeConstPtr construct_xml_tree(xmlNode* root);
00065 };
00066 }
00067
00068 #endif
00069