]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | (C) Copyright Edward Diener 2011,2012 | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:tti_intro Introduction] | |
9 | ||
10 | Welcome to the Boost Type Traits Introspection library, abbreviated TTI. | |
11 | ||
12 | TTI is a library which provides the ability to introspect by name the elements | |
13 | of a type at compile time. | |
14 | ||
15 | TTI works through macros generating metafunctions. Metafunctions are class | |
16 | templates of a particular syntax, having a nested 'type' member. So wherever | |
17 | in C++ class templates can occur, TTI macros can be used. The metafunctions | |
18 | generated by TTI are no different from any other metafunction as defined by | |
19 | the Boost MPL library. | |
20 | ||
21 | The metafunctions generated by TTI are used to introspect elements of a type | |
22 | at compile time, always passing at minimum to each metafunction the enclosing | |
23 | type being introspected. | |
24 | ||
25 | The name of the library has been chosen because the library offers | |
26 | compile time functionality on a type, similar to the Boost Type Traits library, | |
27 | and because the functionality the library offers is the ability to introspect | |
28 | a type about the existence of a specific element within that type. | |
29 | ||
30 | I use the word "introspect" in a very broad sense here. Normally computer | |
31 | language introspection means initially asking for information to be returned | |
32 | by name, which can then further be used to introspect for more specific | |
33 | information. In the TTI library one must always know and supply the name, and | |
34 | use the functionality provided for the correct type of inner element to find | |
35 | out if that particular named entity exists. | |
36 | ||
37 | You may prefer the term "query" instead of "introspection" to denote what this | |
38 | library does, but I use terminology based on the word "introspect" throughout | |
39 | this documentation. | |
40 | ||
41 | The functionality of the library may be summed up as: | |
42 | ||
43 | * Provide the means to introspect a type at compile time | |
44 | using a set of macros. Each macro takes the name of the | |
45 | type's element and generates a metafunction which can be | |
46 | subsequently invoked to determine whether or not the | |
47 | element exists within the type. These generated metafunctions | |
48 | will be called "macro metafunctions" in the documentation. | |
49 | ||
50 | * Provide the means to create a typedef for a type which may | |
51 | not exist. This typedef type can be used as a type in the | |
52 | metafunctions of the library without producing compile-time | |
53 | errors. | |
54 | ||
55 | The library is dependent on Boost PP, Boost MPL, | |
56 | Boost Type Traits, and Boost Function Types. | |
57 | ||
58 | The library is also dependent on the variadic macro support | |
59 | of the Boost PP library if the variadic macros in the library | |
60 | are used. | |
61 | ||
62 | The library is a header only library. | |
63 | ||
64 | Since the dependencies of the library are all header only | |
65 | libraries, there is no need to build a library in order to use | |
66 | the TTI library. | |
67 | ||
68 | [section:tti_headers Header Files] | |
69 | ||
70 | There are is a single header file, `boost/tti/tti.hpp`, | |
71 | which includes all the header files in the library. | |
72 | ||
73 | There are also separate specific header files for each of the elements | |
74 | to be introspected by the library. This allows for finer-grained inclusion | |
75 | of the nested elements to be introspected. These header files are: | |
76 | ||
77 | [table:tbhfiles TTI Header Files | |
78 | [ | |
79 | [Introspected Element] | |
80 | [Specific Header File] | |
81 | ] | |
82 | [ | |
83 | [Type] | |
84 | [[headerref boost/tti/has_type.hpp `has_type.hpp`]] | |
85 | ] | |
86 | [ | |
87 | [Class Template] | |
88 | [[headerref boost/tti/has_template.hpp `has_template.hpp`]] | |
89 | ] | |
90 | [ | |
91 | [Member data] | |
92 | [[headerref boost/tti/has_member_data.hpp `has_member_data.hpp`]] | |
93 | ] | |
94 | [ | |
95 | [Member function] | |
96 | [[headerref boost/tti/has_member_function.hpp `has_member_function.hpp`]] | |
97 | ] | |
98 | [ | |
99 | [Static member data] | |
100 | [[headerref boost/tti/has_static_member_data.hpp `has_static_member_data.hpp`]] | |
101 | ] | |
102 | [ | |
103 | [Static member function] | |
104 | [[headerref boost/tti/has_static_member_function.hpp `has_static_member_function.hpp`]] | |
105 | ] | |
106 | [ | |
107 | [Data] | |
108 | [[headerref boost/tti/has_data.hpp `has_data.hpp`]] | |
109 | ] | |
110 | [ | |
111 | [Function] | |
112 | [[headerref boost/tti/has_function.hpp `has_function.hpp`]] | |
113 | ] | |
114 | [ | |
115 | [Member Type Creation] | |
116 | [[headerref boost/tti/member_type.hpp `member_type.hpp`]] | |
117 | ] | |
118 | ] | |
119 | ||
120 | [endsect] | |
121 | ||
122 | [endsect] |