1#ifndef BLUETOE_ATTRIBUTE_GENERATOR_HPP
2#define BLUETOE_ATTRIBUTE_GENERATOR_HPP
15 template <
typename,
typename, std::size_t,
typename,
typename,
typename ... Options >
16 struct generate_attribute;
27 template <
typename Attributes,
typename CCCDIndices, std::size_t ClientCharacteristicIndex,
typename Service,
typename Server,
typename ... Options >
28 struct generate_attribute_list;
30 template <
typename CCCDIndices,std::size_t ClientCharacteristicIndex,
typename Service,
typename Server,
typename ... Options >
31 struct generate_attribute_list< std::tuple<>, CCCDIndices, ClientCharacteristicIndex, Service, Server, std::tuple< Options... > >
33 static const attribute attribute_at( std::size_t )
35 assert( !
"should not happen" );
40 template <
typename ... Attributes,
typename ... CCCDIndices, std::size_t ClientCharacteristicIndex,
typename Service,
typename Server,
typename ... Options >
41 struct generate_attribute_list< std::tuple< Attributes... >, std::tuple< CCCDIndices... >, ClientCharacteristicIndex, Service, Server, std::tuple< Options... > >
43 static const attribute attribute_at( std::size_t index )
45 return attributes[ index ];
48 static const attribute attributes[
sizeof ...(Attributes) ];
51 template <
typename ... Attributes,
typename ... CCCDIndices, std::size_t ClientCharacteristicIndex,
typename Service,
typename Server,
typename ... Options >
52 const attribute generate_attribute_list< std::tuple< Attributes... >, std::tuple< CCCDIndices... >, ClientCharacteristicIndex, Service, Server, std::tuple< Options... > >::attributes[
sizeof ...(Attributes) ] =
54 generate_attribute< Attributes, std::tuple< CCCDIndices... >, ClientCharacteristicIndex, Service, Server, Options... >::attr...
57 template <
typename OptionsList,
typename MetaTypeList,
typename OptionsDefault = std::tuple<> >
58 struct count_attributes;
60 template <
typename OptionsList,
typename ... MetaTypes,
typename OptionsDefault >
61 struct count_attributes< OptionsList, std::tuple< MetaTypes... >, OptionsDefault >
63 using attribute_generation_parameters =
typename group_by_meta_types_without_empty_groups<
64 typename add_type< OptionsList, OptionsDefault >::type,
68 enum { number_of_attributes = std::tuple_size< attribute_generation_parameters >::value };
71 template <
typename OptionsList,
typename MetaTypeList,
typename CCCDIndices,
typename OptionsDefault = std::tuple<> >
72 struct generate_attributes;
74 template <
typename OptionsList,
typename ... MetaTypes,
typename CCCDIndices,
typename OptionsDefault >
75 struct generate_attributes< OptionsList, std::tuple< MetaTypes... >, CCCDIndices, OptionsDefault >
76 : count_attributes< OptionsList, std::tuple< MetaTypes... >, OptionsDefault >
78 using attribute_generation_parameters =
typename group_by_meta_types_without_empty_groups<
79 typename add_type< OptionsList, OptionsDefault >::type,
83 attribute_generation_parameters get_attribute_generation_parameters() {
return attribute_generation_parameters(); }
85 template < std::
size_t ClientCharacteristicIndex,
typename Service,
typename Server >
86 static const attribute attribute_at( std::size_t index )
88 return generate_attribute_list<
89 attribute_generation_parameters,
91 ClientCharacteristicIndex,
95 >::attribute_at( index );