00001 #ifndef OPENTISSUE_KINEMATICS_SKELETON_SKELETON_BONE_ACCESS_H 00002 #define OPENTISSUE_KINEMATICS_SKELETON_SKELETON_BONE_ACCESS_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 namespace OpenTissue 00013 { 00014 namespace skeleton 00015 { 00016 00024 class BoneAccess 00025 { 00026 public: 00027 00035 template<typename bone_type> 00036 static void set_name(bone_type * bone, std::string const & name) 00037 { 00038 bone->m_name = name; 00039 } 00040 00047 template<typename bone_type> 00048 static void set_number(bone_type * bone, size_t const & number) 00049 { 00050 bone->m_number = number; 00051 } 00052 00059 template<typename bone_type> 00060 static void set_parent(bone_type * bone, bone_type * parent) 00061 { 00062 bone->m_parent = parent; 00063 } 00064 00071 template<typename bone_type, typename skeleton_type> 00072 static void set_skeleton(bone_type * bone, skeleton_type * skeleton) 00073 { 00074 bone->m_skeleton = skeleton; 00075 } 00076 00077 00084 template<typename bone_type> 00085 static void add_child(bone_type * bone, bone_type * child) 00086 { 00087 bone->m_children.push_back( child ); 00088 } 00089 00096 template<typename bone_type> 00097 static bone_type * get_first_child_ptr(bone_type const * bone) 00098 { 00099 if(bone->m_children.empty()) 00100 return 0; 00101 return bone->m_children.front(); 00102 } 00103 00104 00105 }; 00106 00107 } // namespace skeleton 00108 } // namespace OpenTissue 00109 00110 //OPENTISSUE_KINEMATICS_SKELETON_SKELETON_BONE_ACCESS_H 00111 #endif