File size: 484 Bytes
83607bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <vector>

class Accumulator {
public:
    void addData(const char* data, size_t size) {
        // 将新的数据块追加到累加器
        dataBlocks.insert(dataBlocks.end(), data, data + size);
    }

    size_t getDataSize() const {
        return dataBlocks.size();
    }

    const char* getData() const {
        return dataBlocks.data();
    }

    void clear() {
        dataBlocks.clear();
    }

private:
    std::vector<char> dataBlocks;
};