One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
81 lines
2.0 KiB
C++
81 lines
2.0 KiB
C++
#ifndef QUANT_ENGINE_HPP
|
|
#define QUANT_ENGINE_HPP
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace quant {
|
|
constexpr std::size_t channel_count = 8;
|
|
constexpr std::size_t frame_capacity = 32;
|
|
enum class Policy { keep = 0, reject = 1, clamp = 2 };
|
|
struct Profile {
|
|
bool present = false;
|
|
std::int32_t zero = 0;
|
|
double scale = 1;
|
|
double bias = 0;
|
|
double lower = -1;
|
|
double upper = 1;
|
|
std::uint64_t revision = 0;
|
|
};
|
|
struct Sample {
|
|
unsigned channel = 0;
|
|
std::int32_t code = 0;
|
|
};
|
|
struct Value {
|
|
unsigned channel = 0;
|
|
std::int32_t code = 0;
|
|
double decoded = 0;
|
|
double delivered = 0;
|
|
bool outside = false;
|
|
std::uint64_t revision = 0;
|
|
};
|
|
struct Statistics {
|
|
std::uint64_t count = 0;
|
|
std::uint64_t outside = 0;
|
|
double sum = 0;
|
|
double minimum = 0;
|
|
double maximum = 0;
|
|
double weighted = 0;
|
|
};
|
|
struct State {
|
|
std::uint64_t configured = 0;
|
|
std::uint64_t epoch = 0;
|
|
std::uint64_t accepted = 0;
|
|
std::uint64_t rejected = 0;
|
|
std::uint64_t canceled = 0;
|
|
std::uint64_t samples = 0;
|
|
std::uint64_t outside = 0;
|
|
bool active = false;
|
|
std::uint64_t frame = 0;
|
|
std::size_t pending = 0;
|
|
std::uint64_t last_frame = 0;
|
|
std::size_t last_size = 0;
|
|
};
|
|
class Engine {
|
|
public:
|
|
Engine();
|
|
void reset();
|
|
int configure(unsigned, std::int32_t, double, double, double, double);
|
|
int erase(unsigned);
|
|
int begin(std::uint64_t);
|
|
int append(unsigned, std::int32_t);
|
|
int commit(Policy);
|
|
int cancel();
|
|
State state() const;
|
|
Profile profile(unsigned) const;
|
|
Statistics statistics(unsigned) const;
|
|
const std::vector<Value>& last() const;
|
|
private:
|
|
double convert(std::int32_t, const Profile&) const;
|
|
void accumulate(Statistics&, const Value&);
|
|
void close_pending();
|
|
std::array<Profile, channel_count> profiles_;
|
|
std::array<Statistics, channel_count> stats_;
|
|
std::vector<Sample> pending_;
|
|
std::vector<Value> last_;
|
|
State state_;
|
|
};
|
|
}
|
|
#endif
|