00001 /* 00002 * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc. 00003 * All rights reserved. This program is made available under the terms of the 00004 * Eclipse Public License v1.0 which accompanies this distribution, and is 00005 * available at http://www.eclipse.org/legal/epl-v10.html 00006 * Contributors: 00007 * National Institute of Advanced Industrial Science and Technology (AIST) 00008 */ 00009 00014 #ifndef OPENHRP_MODEL_NODE_SET_H_INCLUDED 00015 #define OPENHRP_MODEL_NODE_SET_H_INCLUDED 00016 00017 #include <vector> 00018 #include <boost/shared_ptr.hpp> 00019 #include <boost/version.hpp> 00020 #if (BOOST_VERSION >= 103900) 00021 #include <boost/signals2/signal.hpp> 00022 #else 00023 #include <boost/signals.hpp> 00024 #endif 00025 #include <hrpUtil/VrmlNodes.h> 00026 #include <hrpUtil/Eigen4d.h> 00027 #include "Config.h" 00028 00029 00030 namespace hrp { 00031 00032 class VrmlParser; 00033 00034 class JointNodeSet; 00035 typedef boost::shared_ptr<JointNodeSet> JointNodeSetPtr; 00036 00037 class JointNodeSet 00038 { 00039 public: 00040 VrmlProtoInstancePtr jointNode; 00041 std::vector<JointNodeSetPtr> childJointNodeSets; 00042 std::vector<Matrix44, Eigen::aligned_allocator<Matrix44> > transforms; 00043 std::vector<VrmlProtoInstancePtr> segmentNodes; 00044 std::vector<VrmlProtoInstancePtr> sensorNodes; 00045 std::vector<VrmlProtoInstancePtr> hwcNodes; 00046 std::vector<std::pair<Matrix44, VrmlNodePtr>, 00047 Eigen::aligned_allocator<std::pair<Matrix44, VrmlNodePtr> > > lightNodes; 00048 }; 00049 00050 typedef std::vector<JointNodeSetPtr> JointNodeSetArray; 00051 00052 class ModelNodeSetImpl; 00053 00054 class HRPMODEL_API ModelNodeSet 00055 { 00056 public: 00057 00058 ModelNodeSet(); 00059 virtual ~ModelNodeSet(); 00060 00061 bool loadModelFile(const std::string& filename); 00062 00063 int numJointNodes(); 00064 VrmlProtoInstancePtr humanoidNode(); 00065 JointNodeSetPtr rootJointNodeSet(); 00066 00067 int numExtraJointNodes(); 00068 VrmlProtoInstancePtr extraJointNode(int index); 00069 00076 #if (BOOST_VERSION >= 103900) 00077 boost::signals2::signal<void(const std::string& message)> sigMessage; 00078 #else 00079 boost::signal<void(const std::string& message)> sigMessage; 00080 #endif 00081 00082 class Exception { 00083 public: 00084 Exception(const std::string& description) : description(description) { } 00085 const char* what() const { return description.c_str(); } 00086 private: 00087 std::string description; 00088 }; 00089 00090 private: 00091 ModelNodeSetImpl* impl; 00092 }; 00093 00094 typedef boost::shared_ptr<ModelNodeSet> ModelNodeSetPtr; 00095 }; 00096 00097 00098 #endif