forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtpccluster_parameter_model.h
More file actions
101 lines (93 loc) · 4.42 KB
/
tpccluster_parameter_model.h
File metadata and controls
101 lines (93 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "DataCompression/dc_primitives.h"
#include "DataCompression/HuffmanCodec.h"
#include <bitset>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/string.hpp>
/**
* Parameter model definitions
* - boost mpl vector of alphabets
*/
using tpccluster_parameter =
boost::mpl::vector<BitRangeContiguousAlphabet<uint16_t, 6, boost::mpl::string<'p', 'a', 'd', 'r', 'o', 'w'>>,
BitRangeContiguousAlphabet<uint16_t, 14, boost::mpl::string<'p', 'a', 'd'>>,
BitRangeContiguousAlphabet<uint16_t, 15, boost::mpl::string<'t', 'i', 'm', 'e'>>,
BitRangeContiguousAlphabet<uint16_t, 8, boost::mpl::string<'s', 'i', 'g', 'm', 'a', 'Y', '2'>>,
BitRangeContiguousAlphabet<uint16_t, 8, boost::mpl::string<'s', 'i', 'g', 'm', 'a', 'Z', '2'>>,
BitRangeContiguousAlphabet<uint16_t, 16, boost::mpl::string<'c', 'h', 'a', 'r', 'g', 'e'>>,
BitRangeContiguousAlphabet<uint16_t, 10, boost::mpl::string<'q', 'm', 'a', 'x'>>>;
/**
* Definition of Huffman probability models for the above defined alphabets
*
* This is a temporary definition, the mpl sequence can be created automatically
* from the list of alphabet types, but did not manage so far (see below)
*/
template <typename RepT, int Length, typename Description>
using Model = o2::HuffmanModel<ProbabilityModel<BitRangeContiguousAlphabet<RepT, Length, Description>>,
o2::HuffmanNode<std::bitset<64>>, true>;
using tpccluster_parameter_models =
boost::mpl::vector<Model<uint16_t, /* */ 6, boost::mpl::string<'p', 'a', 'd', 'r', 'o', 'w'>>,
Model<uint16_t, /**/ 14, boost::mpl::string<'p', 'a', 'd'>>,
Model<uint16_t, /**/ 15, boost::mpl::string<'t', 'i', 'm', 'e'>>,
Model<uint16_t, /* */ 8, boost::mpl::string<'s', 'i', 'g', 'm', 'a', 'Y', '2'>>,
Model<uint16_t, /* */ 8, boost::mpl::string<'s', 'i', 'g', 'm', 'a', 'Z', '2'>>,
Model<uint16_t, /**/ 16, boost::mpl::string<'c', 'h', 'a', 'r', 'g', 'e'>>,
Model<uint16_t, /**/ 10, boost::mpl::string<'q', 'm', 'a', 'x'>>>;
/** new approach
using basemodels = foldtype
< tpccluster_parameter,
mpl::lambda<ProbabilityModel<_>>::type
>::type;
using tpcmodels = foldtype
< basemodels,
mpl::lambda<_, o2::HuffmanNode<std::bitset<64>>>::type
>::type;
*/
/**
* this was an attemp to create the vector of Huffman models directly
* from the vector of alphabets
*
* For the moment, the placeholders of mpl fold are not expanded, so there are
* unknown types in the end
*/
/// very first attemp
//using namespace boost::mpl::placeholders;
//
//typedef boost::mpl::fold<
// tpccluster_parameter,
// boost::mpl::vector<>,
// boost::mpl::push_back<
// _1
// , AliceO2::HuffmanModel< ProbabilityModel< _2 >, AliceO2::HuffmanNode<std::bitset<64>>, true>
// >
// >::type models_t;
/// trying with additional lambda levels
//typedef boost::mpl::string<'T','e','s','t'>::type TestAlphabetName;
//typedef ContiguousAlphabet<int16_t, -1, 10, TestAlphabetName> TestAlphabet;
//
//typedef typename boost::mpl::lambda< ProbabilityModel< _1 > > apply_alphabet;
//typedef boost::mpl::apply1<apply_alphabet, TestAlphabet>::type TestAlphabetModel;
//typedef typename boost::mpl::lambda< AliceO2::HuffmanModel< _1, AliceO2::HuffmanNode<std::bitset<64>>, true> > apply_probabilitymodel;
//typedef typename boost::mpl::apply1<boost::mpl::protect<apply_probabilitymodel>::type, TestAlphabetModel>::type TestHuffmanModel;
//
//TestAlphabetModel object;
//typedef TestAlphabetModel::value_type vtype;
//
//std::cout << object.getName() << std::endl;
//typedef boost::mpl::fold<
// tpccluster_parameter,
// boost::mpl::vector<>,
// boost::mpl::push_back<
// _1
// , boost::mpl::apply1< boost::mpl::protect<apply_huffmanmodel>::type, _2 >
// >
// >::type models_t;