Bayeux  3.4.1
Core Foundation library for SuperNEMO
data_type.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2015 by François Mauger <mauger@lpccaen.in2p3.fr>
5 //
6 // This file is part of datatools.
7 //
8 // datatools is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // datatools is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with datatools. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef DATATOOLS_INTROSPECTION_DATA_TYPE_H
22 #define DATATOOLS_INTROSPECTION_DATA_TYPE_H
23 
24 // Standard library:
25 #include <string>
26 
27 // Third party:
28 // - Boost:
29 #include <boost/any.hpp>
30 #include <boost/cstdint.hpp>
31 
32 #ifndef Q_MOC_RUN
34 #endif // Q_MOC_RUN
35 
36 namespace datatools {
37 
38  namespace introspection {
39 
41  enum data_type {
59  };
60 
68  const std::type_info & get_type_info(data_type dt_, const std::string & layout_label_ = "");
69 
71  void make_value(boost::any &, data_type dt_, const std::string & layout_label_ = "");
72 
74  const std::string & to_string(data_type);
75 
77  bool from_string(const std::string & label_, data_type & layout_);
78 
80  data_type from_label_to_data_type(const std::string & label_);
81 
83  bool is_valid(data_type);
84 
86  bool is_void(data_type);
87 
89  bool is_boolean(data_type);
90 
92  bool is_integer(data_type);
93 
95  bool is_real(data_type);
96 
98  bool is_string(data_type);
99 
101  bool is_path(data_type);
102 
104  bool is_enum(data_type);
105 
107  bool is_user(data_type);
108 
109  } // end of namespace introspection
110 
111 } // end of namespace datatools
112 
113 #ifndef Q_MOC_RUN
114 // Activate reflection layer:
116 #endif // Q_MOC_RUN
117 
118 #endif // DATATOOLS_INTROSPECTION_DATA_TYPE_H
119 
120 // Local Variables: --
121 // mode: c++ --
122 // c-file-style: "gnu" --
123 // tab-width: 2 --
124 // End: --
bool is_enum(data_type)
Check if a data type is an enumeration.
int16_t
Definition: data_type.h:47
data_type from_label_to_data_type(const std::string &label_)
Convert a string to a data type.
double value
Definition: data_type.h:54
bool is_void(data_type)
Check if a data type is a void.
Invalid data type.
Definition: data_type.h:42
bool is_boolean(data_type)
Check if a data type is a boolean.
uint16_t
Definition: data_type.h:48
int32_t
Definition: data_type.h:49
bool is_integer(data_type)
Check if a data type is an integer.
uint32_t
Definition: data_type.h:50
uint64_t
Definition: data_type.h:52
int8_t
Definition: data_type.h:45
float value
Definition: data_type.h:53
filesystem path as a character string
Definition: data_type.h:56
bool is_path(data_type)
Check if a data type is a path (string)
bool is_string(data_type)
Check if a data type is a string.
enumeration type
Definition: data_type.h:57
bool from_string(const std::string &label_, access_type &access_)
Convert a string to an access type.
const std::type_info & get_type_info(data_type dt_, const std::string &layout_label_="")
bool
Definition: data_type.h:44
data_type
Data type.
Definition: types.h:38
int64_t
Definition: data_type.h:51
const std::string & to_string(access_type)
Convert an access type to a string.
No type.
Definition: data_type.h:43
void make_value(boost::any &, data_type dt_, const std::string &layout_label_="")
Make value as a boost::any object.
data_type
Supported data types.
Definition: data_type.h:41
user data type
Definition: data_type.h:58
character string
Definition: data_type.h:55
bool is_valid(access_type t_)
Check the validity of an access type.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
#define DR_TYPE_INIT(Introspectable)
Definition: reflection_interface.h:165
bool is_user(data_type)
Check if a data type is a user type.
bool is_real(data_type)
Check if a data type is a real.
uint8_t
Definition: data_type.h:46