25 #ifndef INCLUDED_NetworkClassOfService_h_GUID_5B1253E0_C690_4891_5C84_3F713099B8BE 26 #define INCLUDED_NetworkClassOfService_h_GUID_5B1253E0_C690_4891_5C84_3F713099B8BE 35 #include <type_traits> 42 namespace class_of_service {
88 template <
typename ClassOfService>
99 : std::integral_constant<uint32_t, (1 << 0)> {};
101 struct VRPNConnectionValue<FixedLatency>
102 : std::integral_constant<uint32_t, (1 << 1)> {};
104 struct VRPNConnectionValue<LowLatency>
105 : std::integral_constant<uint32_t, (1 << 2)> {};
107 struct VRPNConnectionValue<FixedThroughput>
108 : std::integral_constant<uint32_t, (1 << 3)> {};
110 struct VRPNConnectionValue<HighThroughput>
111 : std::integral_constant<uint32_t, (1 << 4)> {};
118 struct ClassOfServiceRoot {
120 ClassOfServiceRoot() = default;
123 template <typename SpecificClass> struct GetMessageSizeLimit {
128 template <typename ClassOfService>
129 struct ClassOfServiceBase : detail::ClassOfServiceRoot {
130 typedef ClassOfService type;
131 typedef ClassOfServiceBase<ClassOfService> base_type;
132 ClassOfServiceBase();
134 struct Reliable : ClassOfServiceBase<Reliable> {};
136 struct FixedLatency : ClassOfServiceBase<FixedLatency> {};
138 struct LowLatency : ClassOfServiceBase<LowLatency> {};
140 struct FixedThroughput : ClassOfServiceBase<FixedThroughput> {};
142 struct HighThroughput : ClassOfServiceBase<HighThroughput> {};
144 template <typename T>
145 struct IsClassOfService
146 : std::is_base_of<detail::ClassOfServiceRoot, T> {};
148 template <typename ClassOfService>
150 getMessageSizeLimit(ClassOfServiceBase<ClassOfService> const &) {
151 return detail::GetMessageSizeLimit<ClassOfService>::get();
158 template <typename ClassOfService>
159 inline ClassOfServiceBase<ClassOfService>::ClassOfServiceBase() {
166 static_assert(std::is_base_of<base_type, type>::value,
167 "ClassOfServiceBase<T> must be the base of a class "
168 "of service type T (the CRTP)!");
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
Definition: NetworkClassOfService.h:134
Header wrapping the C99 standard stdint header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
CRTP base for classes of service, useful for accepting classes of service for an argument without let...
Definition: NetworkClassOfService.h:81
Definition: NetworkClassOfService.h:142
size_t getMessageSizeLimit(ClassOfServiceBase< ClassOfService > const &)
Given a class of service, returns a m.
Definition: NetworkClassOfService.h:150
Association of class of service types with integral constants.
Definition: NetworkClassOfService.h:95
Definition: NetworkClassOfService.h:138
Definition: NetworkClassOfService.h:140
Type trait like std::is_base_of indicating whether the given type is a recognized class of service...
Definition: NetworkClassOfService.h:85
Definition: NetworkClassOfService.h:136