taco-db  0.1.0
aggregation.h
Go to the documentation of this file.
1 #ifndef UTILS_TYPSUPP_AGGREGATION_H
2 #define UTILS_TYPSUPP_AGGREGATION_H
3 
4 #include "tdb.h"
5 
6 #include <type_traits>
7 
8 namespace taco {
9 
10 struct SumState {
11  bool m_empty;
12  union {
13  uint64_t m_unsigned;
14  int64_t m_signed;
15  double m_float;
16  } m_agg;
17 };
18 
19 template<typename T, typename = void>
21 
22 template<typename T>
23 struct SumStateAggType<T, typename std::enable_if<
24  std::is_integral<T>::value && std::is_signed<T>::value>::type> {
25  typedef int64_t A;
26 };
27 
28 template<typename T>
29 struct SumStateAggType<T, typename std::enable_if<
30  std::is_integral<T>::value && !std::is_signed<T>::value>::type> {
31  typedef uint64_t A;
32 };
33 
34 template<typename T>
35 struct SumStateAggType<T, typename std::enable_if<
36  std::is_floating_point<T>::value>::type> {
37  typedef double A;
38 };
39 
40 struct AvgState {
41  double m_sum;
42  uint64_t m_cnt;
43 };
44 
46  bool m_empty;
47  union {
48  uint64_t u64;
49  uint32_t u32;
50  uint16_t u16;
51  uint8_t u8;
52  int64_t i64;
53  int32_t i32;
54  int16_t i16;
55  int8_t i8;
56  float f;
57  double d;
58  } m_value;
59 };
60 
61 } // namespace taco
62 
63 #endif // UTILS_TYPSUPP_AGGREGATION_H
taco::PrimitiveMinMaxState::u8
uint8_t u8
Definition: aggregation.h:51
taco::SumState::m_signed
int64_t m_signed
Definition: aggregation.h:14
taco::PrimitiveMinMaxState::i16
int16_t i16
Definition: aggregation.h:54
taco::PrimitiveMinMaxState::i8
int8_t i8
Definition: aggregation.h:55
taco::PrimitiveMinMaxState::m_empty
bool m_empty
Definition: aggregation.h:46
taco::PrimitiveMinMaxState::u16
uint16_t u16
Definition: aggregation.h:50
taco
Definition: datum.h:28
taco::PrimitiveMinMaxState::i32
int32_t i32
Definition: aggregation.h:53
taco::AvgState::m_cnt
uint64_t m_cnt
Definition: aggregation.h:42
taco::PrimitiveMinMaxState::u32
uint32_t u32
Definition: aggregation.h:49
taco::PrimitiveMinMaxState::d
double d
Definition: aggregation.h:57
taco::SumStateAggType< T, typename std::enable_if< std::is_integral< T >::value &&std::is_signed< T >::value >::type >::A
int64_t A
Definition: aggregation.h:25
taco::SumState::m_unsigned
uint64_t m_unsigned
Definition: aggregation.h:13
taco::SumStateAggType< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_signed< T >::value >::type >::A
uint64_t A
Definition: aggregation.h:31
tdb.h
taco::SumState::m_float
double m_float
Definition: aggregation.h:15
taco::PrimitiveMinMaxState::m_value
union taco::PrimitiveMinMaxState::@1 m_value
taco::PrimitiveMinMaxState::u64
uint64_t u64
Definition: aggregation.h:48
taco::AvgState::m_sum
double m_sum
Definition: aggregation.h:41
taco::AvgState
Definition: aggregation.h:40
taco::PrimitiveMinMaxState
Definition: aggregation.h:45
taco::SumState::m_empty
bool m_empty
Definition: aggregation.h:11
std
Definition: Record.h:148
taco::SumState::m_agg
union taco::SumState::@0 m_agg
taco::SumState
Definition: aggregation.h:10
taco::SumStateAggType
Definition: aggregation.h:20
taco::PrimitiveMinMaxState::i64
int64_t i64
Definition: aggregation.h:52
taco::PrimitiveMinMaxState::f
float f
Definition: aggregation.h:56
taco::SumStateAggType< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::A
double A
Definition: aggregation.h:37