17 #ifndef COMMONVALUETOOLS_HPP_
18 #define COMMONVALUETOOLS_HPP_
22 #ifdef KAA_USE_CONFIGURATION
35 class CommonValueTools {
37 static bool isRecord(std::shared_ptr<ICommonValue> v) {
41 static bool isArray(std::shared_ptr<ICommonValue> v) {
45 static bool isFixed(std::shared_ptr<ICommonValue> v) {
49 static bool isEnum(std::shared_ptr<ICommonValue> v) {
53 static bool isString(std::shared_ptr<ICommonValue> v) {
57 static bool isNumeric(std::shared_ptr<ICommonValue> v) {
61 static bool isBool(std::shared_ptr<ICommonValue> v) {
65 static bool isByteArray(std::shared_ptr<ICommonValue> v) {
69 static bool isNull(std::shared_ptr<ICommonValue> v) {
73 static const CommonRecord getRecord(std::shared_ptr<ICommonValue> v) {
75 return boost::any_cast<
const CommonRecord &>(v->getValue());
77 throw KaaException(
"Can not cast to record");
80 static ICommonArray::container_type getList(std::shared_ptr<ICommonValue> v) {
82 return boost::any_cast<
const ICommonArray::container_type &>(v->getValue());
84 throw KaaException(
"Can not cast to array");
87 static const std::string &getEnumValue(std::shared_ptr<ICommonValue> v) {
89 return boost::any_cast<
const std::string &>(v->getValue());
91 throw KaaException(
"Can not cast to enum");
94 static std::vector<std::uint8_t> getByteArray(std::shared_ptr<ICommonValue> v) {
96 return boost::any_cast<
const std::vector<std::uint8_t> &>(v->getValue());
98 throw KaaException(
"Can not cast to byte array");