Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
deduce_proxy_type.h
1 /// @file detail/deduce_proxy_type.h
2 ///
3 /// The declaration and definition of DeduceProxyType.
4 ///
5 /// A template meta-function that selects the appropriate type of Data Proxy
6 /// to declare for a specified type T. The data proxy is an important layer
7 /// to homogenize access to all of the different types of values supported
8 /// by Hg.
9 ///
10 /// The MIT License(MIT)
11 /// @copyright 2014 Paul M Watt
12 // ****************************************************************************
13 #ifndef DEDUCE_PROXY_TYPE_H_INCLUDED
14 #define DEDUCE_PROXY_TYPE_H_INCLUDED
15 // Includes ******************************************************************
16 #include <Hg/deduce_type_trait.h>
17 #include <Hg/proxy/data_proxy.h>
18 #include <Hg/proxy/bitlist_field_proxy.h>
19 #include <Hg/proxy/vector_proxy.h>
20 #include <Hg/proxy/array_proxy.h>
21 #include <Hg/proxy/opaque_proxy.h>
22 
23 namespace Hg
24 {
25 
26 namespace detail
27 {
28 
29 // ****************************************************************************
30 /// A convenience meta-function to define the correct type of DataProxy holder.
31 /// The constructed type can be accessed through the public typedef *type*.
32 ///
33 /// @paramt IdxT
34 /// @paramt FormatT
35 ///
36 template< size_t IdxT,
37  typename FormatT
38  >
40 {
41  // **************************************************************************
42  // Deduce the traits from the value_type in order to select the most
43  // appropriate Proxy handler for value management.
44  //
45  typedef typename
46  DeduceTypeAtTrait < IdxT,
47  FormatT
48  >::type selected_type;
49 
50  // **************************************************************************
51  // The selected DataProxy type for the specified input type.
52  typedef DataProxy < selected_type,
53  IdxT,
54  FormatT
55  > type;
56 };
57 
58 
59 } // namespace detail
60 
61 } // namespace Hg
62 
63 #endif