Project
Loading...
Searching...
No Matches
EncoderImpl.h
Go to the documentation of this file.
1// Copyright 2019-2023 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#ifndef RANS_INTERNAL_ENCODE_ENCODERIMPL_H_
17#define RANS_INTERNAL_ENCODE_ENCODERIMPL_H_
18
19#include <cstdint>
20
21#include <fairlogger/Logger.h>
22
24
25namespace o2::rans::internal
26{
27
28template <typename symbol_T, typename derived_T>
30{
31 public:
35 using size_type = size_t;
36 using difference_type = std::ptrdiff_t;
37
38 [[nodiscard]] inline static constexpr size_type getNstreams() noexcept
39 {
40 return derived_T::getNstreams();
41 };
42
43 // Flushes the rANS encoder.
44 template <typename Stream_IT>
45 [[nodiscard]] inline Stream_IT flush(Stream_IT outputIter)
46 {
47 return static_cast<derived_T*>(this)->flush(outputIter);
48 };
49
50 template <typename Stream_IT>
51 [[nodiscard]] inline Stream_IT putSymbols(Stream_IT outputIter, const symbol_type& encodeSymbols)
52 {
53 return static_cast<derived_T*>(this)->putSymbols(outputIter, encodeSymbols);
54 };
55
56 template <typename Stream_IT>
57 [[nodiscard]] inline Stream_IT putSymbols(Stream_IT outputIter, const symbol_type& encodeSymbols, size_type nActiveStreams)
58 {
59 return static_cast<derived_T*>(this)->putSymbols(outputIter, encodeSymbols, nActiveStreams);
60 };
61
62 [[nodiscard]] inline static constexpr state_type getStreamingLowerBound() noexcept
63 {
64 return derived_T::getStreamingLowerBound();
65 };
66
67 protected:
68 [[nodiscard]] inline static constexpr state_type getStreamOutTypeBits() noexcept
69 {
70 return utils::toBits<stream_type>();
71 };
72
73 EncoderImpl() = default;
74 explicit EncoderImpl(size_t symbolTablePrecision) noexcept : mSymbolTablePrecision{symbolTablePrecision} {};
75
77};
78
79} // namespace o2::rans::internal
80
81#endif /* RANS_INTERNAL_ENCODE_ENCODERIMPL_H_ */
unsigned int uint32_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
common helper classes and functions
Stream_IT putSymbols(Stream_IT outputIter, const symbol_type &encodeSymbols)
Definition EncoderImpl.h:51
static constexpr state_type getStreamingLowerBound() noexcept
Definition EncoderImpl.h:62
Stream_IT putSymbols(Stream_IT outputIter, const symbol_type &encodeSymbols, size_type nActiveStreams)
Definition EncoderImpl.h:57
static constexpr size_type getNstreams() noexcept
Definition EncoderImpl.h:38
static constexpr state_type getStreamOutTypeBits() noexcept
Definition EncoderImpl.h:68
Stream_IT flush(Stream_IT outputIter)
Definition EncoderImpl.h:45
EncoderImpl(size_t symbolTablePrecision) noexcept
Definition EncoderImpl.h:74