#ifndef DATAVECTOR_H
#define DATAVECTOR_H

#include <cstddef>

class DataVector final {
public:
    DataVector(size_t capacity = 5 * 1024 * 1024);
    DataVector(const DataVector& orig);
    DataVector(DataVector&& other);
    ~DataVector();

    DataVector& operator=(const DataVector& other);
    DataVector& operator=(DataVector&& other);

    bool read(size_t fromIndex, void* buffer, size_t length) const;
    bool write(size_t toIndex, const void* data, size_t length);

    bool readSocket(int socket, size_t& readBytes);
    void sendToSocket(int socket, size_t toIndex) const;

private:
    size_t capacity;
    char* data;
};

#endif