<commit_before>#include "ZfpMan.h"
#include <zfp.h>

ZfpMan::ZfpMan()
    :CompressMan()
{
}

ZfpMan::~ZfpMan(){
}

int ZfpMan::init(json p_jmsg){
    return 0;
}

int ZfpMan::put(const void *p_data, json p_jmsg){
    put_begin(p_data, p_jmsg);

    void *compressed_data = NULL;
    if (check_json(p_jmsg, {"doid", "var", "dtype", "putshape"}, "ZfpMan")){
        if (p_jmsg["compression_rate"] == nullptr){
            p_jmsg["compression_rate"] = 4;
        }
        compressed_data = compress(const_cast<void*>(p_data), p_jmsg);
    }

    put_end(compressed_data, p_jmsg);
    if(compressed_data) free(compressed_data);
    return 0;
}

int ZfpMan::get(void *p_data, json &p_jmsg){
    return 0;
}

void ZfpMan::flush(){

}

void* ZfpMan::compress(void* p_data, json &p_jmsg){

    string dtype = p_jmsg["dtype"];
    vector<size_t> shape = p_jmsg["putshape"].get<vector<size_t>>();
    int compression_rate = p_jmsg["compression_rate"].get<int>();

    int status = 0;    // return value: 0 = success
    uint dim = 1;
    zfp_type type = zfp_type_none;     // array scalar type
    zfp_field* field;  // array meta data
    zfp_stream* zfp;   // compressed stream
    size_t bufsize;    // byte size of compressed buffer
    bitstream* stream; // bit stream to write to or read from
    size_t zfpsize;    // byte size of compressed stream

    // allocate meta data for the 3D array a[nz][ny][nx]
    if(dtype == "int"){<commit_msg>streaming workflow worked for automatic decompressing<commit_after>#include "ZfpMan.h"
#include <zfp.h>

ZfpMan::ZfpMan()
    :CompressMan()
{
}

ZfpMan::~ZfpMan(){
}

int ZfpMan::init(json p_jmsg){
    return 0;
}

int ZfpMan::put(const void *p_data, json p_jmsg){
    put_begin(p_data, p_jmsg);

    void *compressed_data = NULL;
    if (check_json(p_jmsg, {"doid", "var", "dtype", "putshape"}, "ZfpMan")){
        if (p_jmsg["compression_rate"] == nullptr){
            p_jmsg["compression_rate"] = 4;
        }
        compressed_data = compress(const_cast<void*>(p_data), p_jmsg);
    }

    put_end(compressed_data, p_jmsg);
    if(compressed_data) free(compressed_data);
    return 0;
}

int ZfpMan::get(void *p_data, json &p_jmsg){
    return 0;
}

void ZfpMan::flush(){
    flush_next();
}

void* ZfpMan::compress(void* p_data, json &p_jmsg){

    string dtype = p_jmsg["dtype"];
    vector<size_t> shape = p_jmsg["putshape"].get<vector<size_t>>();
    int compression_rate = p_jmsg["compression_rate"].get<int>();

    int status = 0;    // return value: 0 = success
    uint dim = 1;
    zfp_type type = zfp_type_none;     // array scalar type
    zfp_field* field;  // array meta data
    zfp_stream* zfp;   // compressed stream
    size_t bufsize;    // byte size of compressed buffer
    bitstream* stream; // bit stream to write to or read from
    size_t zfpsize;    // byte size of compressed stream

    // allocate meta data for the 3D array a[nz][ny][nx]
    if(dtype == "int"){
{'fraction_non_alphanumeric': 0.1439265056141545, 'fraction_numerical': 0.005444028581150051, 'mean_word_length': 3.375, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '174544', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1086, 'n_words': 257}