summaryrefslogtreecommitdiff
path: root/tools/src/asset_processor/offsets.h
blob: 9f7d2bfee505f8609922f4c8667f9df6819794af (plain)
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
26
#ifndef OFFSETS_H
#define OFFSETS_H
#include <filesystem>
#include <fstream>
#include <string>

class OffsetCalculator {

  public:
    OffsetCalculator(const std::filesystem::path& asmOffsetsFile, const std::filesystem::path& cOffsetsFile, int baseOffset_);
    void addAsset(int start, const std::string& symbol);
    [[nodiscard]] int getLastEnd() const {
        return lastEnd;
    }
    void setLastEnd(int lastEnd_) {
        this->lastEnd = lastEnd_;
    }
  private:
    std::ofstream asmOutput;
    std::ofstream cOutput;
    int baseOffset;
    // Store the end of the previously added asset
    int lastEnd;
};

#endif