- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
type.hpp
Go to the documentation of this file.
1 /*
2 ** Author(s):
3 ** - Cedric GESTES <gestes@aldebaran-robotics.com>
4 **
5 ** Copyright (C) 2014 Aldebaran Robotics
6 */
7
8 #ifndef _QITYPE_TYPE_HPP_
9 # define _QITYPE_TYPE_HPP_
10
11
12 #include <string>
13 #include <vector>
14 #include <qi/type/typeinterface.hpp>
15
16
17 // THIS INTERFACE IS NOT STABLE. (that's why it belongs to details)
18 // DO NOT USE.
19
20 namespace qi {
21
22 namespace detail {
23
24 class AnyType;
25
26 struct FieldInfo {
27 //Type2 type;
28 std::string name;
29 qi::uint64_t index;
30 std::string description;
31 };
32 using FieldInfoVector = std::vector<FieldInfo>;
33
34 using TypeSignature = Signature;
35
36 class AnyType;
37 using AnyTypeVector = std::vector<AnyType>;
38
39 QI_API AnyType makeTypeOf(TypeKind kind);
40 QI_API AnyType makeTypeList(const AnyType& element);
41 QI_API AnyType makeTypeMap(const AnyType& key, const AnyType& element);
42 QI_API AnyType makeTypeTuple(const AnyTypeVector& elements);
43
44 class QI_API AnyType {
45 public:
46 AnyType();
47 AnyType(TypeInterface *typeInterface);
48
49
50 AnyType(const AnyType& rhs);
51 AnyType &operator=(const AnyType& rhs);
52
53 //## General
54
55 TypeKind kind() const;
56 TypeSignature signature() const; //really?
57 TypeInterface* type() const { return _type; }
58
59 //convert to a human readable format
60 //Vector<Point>, Map<Int, Function>
61 std::string toString();
62
63 //unique type identifier
64 std::string name() const;
65
66 //## Type Specific
67
68 //Struct/Object
69 std::string className() const;
70
71 AnyTypeVector elements();
72
73 //Struct/Object
74 FieldInfoVector members();
75
76 //Object
77 FieldInfoVector methods();
78 FieldInfo method(const uint32_t id);
79 FieldInfoVector methodOverloads(const std::string& name);
80
81 FieldInfoVector sigs(); //qt reserve signals
82 FieldInfo signal(const uint32_t id);
83 FieldInfo signal(const std::string& id);
84
85 FieldInfoVector properties();
86 FieldInfo property(const uint32_t id);
87 FieldInfo property(const std::string& name);
88
89 //Method/Signal
90 FieldInfoVector paramsIn();
91 //Method
92 FieldInfoVector paramsOut();
93
94 //Map
95 AnyType key();
96
97 //List/Map/Pointer/Property (not dynamic)
98 AnyType element();
99
100 //Float/Int
101 int bits();
102 //Int
103 int isSigned();
104
105 //## Operations
106 bool isConvertible(AnyType type);
107 //compare kind?
108 //bool isCompatible(Type2 type);
109 bool isConstructible(AnyType type);
110
111 //hummm what?
112 bool operator==(const AnyType& rhs) { return rhs.type() == _type; }
113
114 private:
115 TypeInterface *_type;
116 };
117
118 }
119 }
120
121 #endif /* !TYPE2_PP_ */
QI_API
#define QI_API
Definition: api.hpp:33
qi::uint32_t
uint32_t uint32_t
Definition: types.hpp:65
qi::Signature
Definition: signature.hpp:66
qi::detail::FieldInfo::description
std::string description
Definition: type.hpp:30
qi::detail::makeTypeMap
AnyType makeTypeMap(const AnyType &key, const AnyType &element)
qi::detail::AnyTypeVector
std::vector< AnyType > AnyTypeVector
Definition: type.hpp:37
qi::TypeInterface
Definition: typeinterface.hpp:129
qi::detail::AnyType::operator==
bool operator==(const AnyType &rhs)
Definition: type.hpp:112
qi::detail::makeTypeOf
AnyType makeTypeOf(TypeKind kind)
qi::detail::FieldInfo::index
qi::uint64_t index
Definition: type.hpp:29
qi::detail::AnyType::type
TypeInterface * type() const
Definition: type.hpp:57
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name
qi::detail::makeTypeTuple
AnyType makeTypeTuple(const AnyTypeVector &elements)
qi::TypeKind
TypeKind
Definition: fwd.hpp:54
qi::detail::AnyType
Definition: type.hpp:44
qi::detail::FieldInfo
Definition: type.hpp:26
typeinterface.hpp
qi::detail::FieldInfo::name
std::string name
Definition: type.hpp:28
qi::detail::makeTypeList
AnyType makeTypeList(const AnyType &element)
qi::uint64_t
uint64_t uint64_t
Definition: types.hpp:66
qi::detail::FieldInfoVector
std::vector< FieldInfo > FieldInfoVector
Definition: type.hpp:32