naoqi_helpers.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Aldebaran
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 
19 #ifndef NAOQI_HELPERS_HPP
20 #define NAOQI_HELPERS_HPP
21 
22 namespace naoqi
23 {
24 namespace helpers
25 {
26 namespace naoqi
27 {
28 
29 static dataType::DataType getDataType(qi::AnyValue value)
30 {
31  dataType::DataType type;
32  if (value.kind() == qi::TypeKind_Int) {
33  type = dataType::Int;
34  }
35  else if (value.kind() == qi::TypeKind_Float) {
36  type = dataType::Float;
37  }
38  else if (value.kind() == qi::TypeKind_String) {
39  type = dataType::String;
40  }
41  else {
42  throw std::runtime_error("Cannot get a valid type.");
43  }
44  return type;
45 }
46 
47 } // naoqi
48 } // helpers
49 } // naoqi
50 
51 #endif
static dataType::DataType getDataType(qi::AnyValue value)


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26