<commit_before>#pragma once

#include "internal/sys.hpp"
#include "window_hw_interface.hpp"

#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>

namespace blobs
{

class LpcMapperAspeed : public HardwareMapperInterface
{
  public:
    static std::unique_ptr<HardwareMapperInterface>
        createAspeedMapper(std::uint32_t regionAddress, std::size_t regionSize);

    LpcMapperAspeed(std::uint32_t regionAddress, std::size_t regionSize,
                    const internal::Sys* sys = &internal::sys_impl) :
        regionAddress(regionAddress),
        regionSize(regionSize), sys(sys){};

    void close() override;

    std::pair<std::uint32_t, std::uint32_t>
        mapWindow(std::uint32_t address, std::uint32_t length) override;

    std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;

    /**
     * Attempt to mmap the region.
     *
     * @return true on success, false otherwise.
     */
    bool mapRegion();

  private:
    static const std::string lpcControlPath;
    int mappedFd = -1;
    std::uint8_t* mappedRegion = nullptr;
    std::uint32_t regionAddress;
    std::size_t regionSize;
    const internal::Sys* sys;
};

} // namespace blobs<commit_msg>lpc_aspeed: delete copy/assignment of object<commit_after>#pragma once

#include "internal/sys.hpp"
#include "window_hw_interface.hpp"

#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>

namespace blobs
{

class LpcMapperAspeed : public HardwareMapperInterface
{
  public:
    static std::unique_ptr<HardwareMapperInterface>
        createAspeedMapper(std::uint32_t regionAddress, std::size_t regionSize);

    /* NOTE: This object is created and then never destroyed (unless ipmid
     * stops/crashes, etc)
     */
    LpcMapperAspeed(std::uint32_t regionAddress, std::size_t regionSize,
                    const internal::Sys* sys = &internal::sys_impl) :
        regionAddress(regionAddress),
        regionSize(regionSize), sys(sys){};

    LpcMapperAspeed(const LpcMapperAspeed&) = delete;
    LpcMapperAspeed& operator=(const LpcMapperAspeed&) = delete;
    LpcMapperAspeed(LpcMapperAspeed&&) = default;
    LpcMapperAspeed& operator=(LpcMapperAspeed&&) = default;

    void close() override;

    std::pair<std::uint32_t, std::uint32_t>
        mapWindow(std::uint32_t address, std::uint32_t length) override;

    std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;

    /**
     * Attempt to mmap the region.
     *
     * @return true on success, false otherwise.
     */
    bool mapRegion();

  private:
    static const std::string lpcControlPath;
    int mappedFd = -1;
    std::uint8_t* mappedRegion = nullptr;
    std::uint32_t regionAddress;
    std::size_t regionSize;
    const internal::Sys* sys;
};

} // namespace blobs
{'fraction_non_alphanumeric': 0.11527581329561527, 'fraction_numerical': 0.013437057991513438, 'mean_word_length': 3.945804195804196, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '5124585', 'n_tokens_mistral': 931, 'n_tokens_neox': 912, 'n_words': 202}