44#include < utility>
55#include < variant>
66
7+ #include " ../clp/Defs.h"
78#include " DictionaryWriter.hpp"
89#include " FileWriter.hpp"
910#include " ParsedMessage.hpp"
1011#include " TimestampDictionaryWriter.hpp"
11- #include " VariableEncoder.hpp"
1212#include " ZstdCompressor.hpp"
1313
1414namespace clp_s {
@@ -117,6 +117,9 @@ class BooleanColumnWriter : public BaseColumnWriter {
117117
118118class ClpStringColumnWriter : public BaseColumnWriter {
119119public:
120+ // Types
121+ using encoded_log_dict_id_t = uint64_t ;
122+
120123 // Constructor
121124 ClpStringColumnWriter (
122125 int32_t id,
@@ -141,16 +144,16 @@ class ClpStringColumnWriter : public BaseColumnWriter {
141144 * @param encoded_id
142145 * @return the encoded log dict id
143146 */
144- static int64_t get_encoded_log_dict_id (uint64_t encoded_id) {
145- return ( int64_t ) encoded_id & cLogDictIdMask;
147+ static clp:: logtype_dictionary_id_t get_encoded_log_dict_id (encoded_log_dict_id_t encoded_id) {
148+ return static_cast <clp:: logtype_dictionary_id_t >( encoded_id & cLogDictIdMask) ;
146149 }
147150
148151 /* *
149152 * @param encoded_id
150153 * @return The encoded offset
151154 */
152- static int64_t get_encoded_offset (uint64_t encoded_id) {
153- return (( int64_t ) encoded_id & cOffsetMask) >> cOffsetBitPosition;
155+ static uint64_t get_encoded_offset (encoded_log_dict_id_t encoded_id) {
156+ return (encoded_id & cOffsetMask) >> cOffsetBitPosition;
154157 }
155158
156159private:
@@ -160,20 +163,21 @@ class ClpStringColumnWriter : public BaseColumnWriter {
160163 * @param offset
161164 * @return The encoded log dict id
162165 */
163- static int64_t encode_log_dict_id (uint64_t id, uint64_t offset) {
164- return ((int64_t )id) | ((int64_t )offset) << cOffsetBitPosition;
166+ static encoded_log_dict_id_t
167+ encode_log_dict_id (clp::logtype_dictionary_id_t id, uint64_t offset) {
168+ return static_cast <encoded_log_dict_id_t >(id) | (offset << cOffsetBitPosition);
165169 }
166170
167171 static constexpr int cOffsetBitPosition = 24 ;
168- static constexpr int64_t cLogDictIdMask = ~(- 1ULL << cOffsetBitPosition);
169- static constexpr int64_t cOffsetMask = ~cLogDictIdMask;
172+ static constexpr uint64_t cLogDictIdMask = ( 1ULL << cOffsetBitPosition) - 1 ;
173+ static constexpr uint64_t cOffsetMask = ~cLogDictIdMask;
170174
171175 std::shared_ptr<VariableDictionaryWriter> m_var_dict;
172176 std::shared_ptr<LogTypeDictionaryWriter> m_log_dict;
173177 LogTypeDictionaryEntry m_logtype_entry;
174178
175- std::vector<int64_t > m_logtypes;
176- std::vector<int64_t > m_encoded_vars;
179+ std::vector<encoded_log_dict_id_t > m_logtypes;
180+ std::vector<clp:: encoded_variable_t > m_encoded_vars;
177181};
178182
179183class VariableStringColumnWriter : public BaseColumnWriter {
@@ -193,7 +197,7 @@ class VariableStringColumnWriter : public BaseColumnWriter {
193197
194198private:
195199 std::shared_ptr<VariableDictionaryWriter> m_var_dict;
196- std::vector<int64_t > m_variables ;
200+ std::vector<clp:: variable_dictionary_id_t > m_var_dict_ids ;
197201};
198202
199203class DateStringColumnWriter : public BaseColumnWriter {
0 commit comments