Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef SHAPE_TOOLS_SOLID_PRIMITIVE_DIMS_
00036 #define SHAPE_TOOLS_SOLID_PRIMITIVE_DIMS_
00037
00038 #include <shape_msgs/SolidPrimitive.h>
00039
00040 namespace shape_tools
00041 {
00042
00044 template<int>
00045 struct SolidPrimitiveDimCount
00046 {
00047 enum { value = 0 };
00048 };
00049
00050 template<>
00051 struct SolidPrimitiveDimCount<shape_msgs::SolidPrimitive::SPHERE>
00052 {
00053 enum
00054 {
00055 value = static_cast<int>(shape_msgs::SolidPrimitive::SPHERE_RADIUS) + 1
00056 };
00057 };
00058
00059 template<>
00060 struct SolidPrimitiveDimCount<shape_msgs::SolidPrimitive::BOX>
00061 {
00062 enum
00063 {
00064 value = (static_cast<int>(shape_msgs::SolidPrimitive::BOX_X) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_Y) &&
00065 static_cast<int>(shape_msgs::SolidPrimitive::BOX_X) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_Z)) ?
00066 static_cast<int>(shape_msgs::SolidPrimitive::BOX_X) :
00067 (((static_cast<int>(shape_msgs::SolidPrimitive::BOX_Y) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_X) &&
00068 static_cast<int>(shape_msgs::SolidPrimitive::BOX_Y) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_Z))) ?
00069 static_cast<int>(shape_msgs::SolidPrimitive::BOX_Y) :
00070 ((static_cast<int>(shape_msgs::SolidPrimitive::BOX_Z) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_X) &&
00071 static_cast<int>(shape_msgs::SolidPrimitive::BOX_Z) >= static_cast<int>(shape_msgs::SolidPrimitive::BOX_Y)) ?
00072 static_cast<int>(shape_msgs::SolidPrimitive::BOX_Z) : 0)) + 1
00073 };
00074 };
00075
00076 template<>
00077 struct SolidPrimitiveDimCount<shape_msgs::SolidPrimitive::CONE>
00078 {
00079 enum
00080 {
00081 value = (static_cast<int>(shape_msgs::SolidPrimitive::CONE_RADIUS) >= static_cast<int>(shape_msgs::SolidPrimitive::CONE_HEIGHT) ?
00082 static_cast<int>(shape_msgs::SolidPrimitive::CONE_RADIUS) : static_cast<int>(shape_msgs::SolidPrimitive::CONE_HEIGHT)) + 1
00083 };
00084 };
00085
00086 template<>
00087 struct SolidPrimitiveDimCount<shape_msgs::SolidPrimitive::CYLINDER>
00088 {
00089 enum
00090 {
00091 value = (static_cast<int>(shape_msgs::SolidPrimitive::CYLINDER_RADIUS) >= static_cast<int>(shape_msgs::SolidPrimitive::CYLINDER_HEIGHT) ?
00092 static_cast<int>(shape_msgs::SolidPrimitive::CYLINDER_RADIUS) : static_cast<int>(shape_msgs::SolidPrimitive::CYLINDER_HEIGHT)) + 1
00093 };
00094 };
00095
00096
00097 }
00098
00099 #endif