Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial/incremental decompression of clusters #411

Closed
wants to merge 13 commits into from
51 changes: 51 additions & 0 deletions src/bufdatastream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Veloman Yunkan
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
* NON-INFRINGEMENT. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/

#ifndef ZIM_BUFDATASTREAM_H
#define ZIM_BUFDATASTREAM_H

#include "idatastream.h"
#include "debug.h"

#include <string.h>

namespace zim
{

class BufDataStream : public IDataStream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class seems never used at all (except in test).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I thought it was used in an intermediate state but it only enables unit-testing DecodedDataStream.

{
public: // functions
explicit BufDataStream(const char* data, size_t size)
: data_(data)
, size_(size)
{}

protected:
void readImpl(void* buf, size_t nbytes) override;
Blob readBlobImpl(size_t size) override;


private: // data
const char* data_;
size_t size_;
Comment on lines +45 to +46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a zim::Buffer associated with a offset ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have wicked plans of getting rid of zim::Buffer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please stop wicked plans :) Let's talk together before.

};

} // namespace zim

#endif // ZIM_BUFDATASTREAM_H
Loading