Go to the documentation of this file.00001
00030 #include <constrained_ik/enum_types.h>
00031 #include <ros/console.h>
00032
00033 using namespace constrained_ik::constraint_types;
00034
00035 const std::string ConstraintType::names_[] = {"Primary", "Auxiliary", "Inactive"};
00036 const std::map<std::string, ConstraintTypes> ConstraintType::name_to_enum_map_ = boost::assign::map_list_of ("primary", Primary) ("auxiliary", Auxiliary) ("inactive", Inactive);
00037
00038 ConstraintTypes ConstraintType::stringToEnum(std::string constraint_type_name)
00039 {
00040 std::map<std::string, ConstraintTypes>::const_iterator it;
00041 std::transform(constraint_type_name.begin(), constraint_type_name.end(), constraint_type_name.begin(), ::tolower);
00042 it = name_to_enum_map_.find(constraint_type_name);
00043 if (it != name_to_enum_map_.end())
00044 return it->second;
00045 else
00046 ROS_ERROR("No enumerator named %s. Valid names (Not case sensitive): Primary, Auxiliary, Inactive", constraint_type_name.c_str());
00047 }