JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
Loading...
Searching...
No Matches
jaffarPlus::InputHistoryRaw Class Referencefinal

Stores the full bit-packed input sequence in every state (JaffarPlus's classic behavior): self-contained per state, but the largest per-state footprint. More...

#include <inputHistoryRaw.hpp>

Inheritance diagram for jaffarPlus::InputHistoryRaw:
[legend]

Public Member Functions

 InputHistoryRaw (const uint32_t maxInputIndex, const uint32_t maxSize)
 Constructs the strategy and sizes the per-state bit-packed buffer.
 
void reset () override
 Resets the cursor to the empty path.
 
void pushInput (const size_t stepCount, const InputSet::inputIndex_t input) override
 Records one applied input at path position stepCount (the runner's current step counter).
 
void serializeCold (jaffarCommon::serializer::Base &s) const override
 Writes the compact "cold" path representation (stored in each StateDb slot), excluding the count.
 
void deserializeCold (jaffarCommon::deserializer::Base &d) override
 Restores the cursor from a "cold" representation (the count is restored by the runner).
 
void serializeFull (jaffarCommon::serializer::Base &s) const override
 Writes the self-contained "full" path representation (for standalone snapshot buffers), excluding the count.
 
void deserializeFull (jaffarCommon::deserializer::Base &d, const size_t) override
 Restores the cursor from a "full" representation.
 
std::string toString (const std::map< InputSet::inputIndex_t, std::string > &inputStringMap, const size_t stepCount) const override
 Reconstructs the path as a newline-separated string of input strings (the solution).
 
size_t getColdSize () const override
 Size, in bytes, of the cold path representation in a StateDb slot (EXCLUDING the runner's count).
 
size_t getFullSize () const override
 Size, in bytes, of the full (self-contained) path representation in a snapshot buffer (EXCLUDING the count).
 
void captureColdToFull (const void *cold, void *full) const override
 Converts a stored cold path into a self-contained full one (best/worst snapshot).
 
virtual void initColdSlot (void *cold) const
 Prepares a fresh/recycled cold slot (e.g. marks it as holding no trie node). Default: no-op.
 
virtual void releaseColdSlot (void *cold, const size_t shard) const
 Releases any shared resource a freed cold slot was holding (trie GC).
 
virtual size_t getApproxMemoryBytes () const
 Approximate resident memory of any shared structure (e.g. the trie), in bytes. Default: 0.
 

Private Member Functions

void setInput (const size_t step, const InputSet::inputIndex_t input)
 Writes the input index for step into the bit-packed buffer.
 
InputSet::inputIndex_t getInput (const size_t step) const
 Reads the input index recorded for step from the bit-packed buffer.
 

Private Attributes

const uint32_t _maxSize
 Maximum number of steps recorded.
 
size_t _bits = 0
 Bits used to encode one input index.
 
std::vector< uint8_t > _buffer
 Bit-packed input sequence.
 

Static Private Attributes

static std::atomic< bool > _truncationWarned = false
 Set once after the first over-Max-Size push.
 

Detailed Description

Stores the full bit-packed input sequence in every state (JaffarPlus's classic behavior): self-contained per state, but the largest per-state footprint.

Selected with {"Type": "Raw", ...}.

Definition at line 23 of file inputHistoryRaw.hpp.

Constructor & Destructor Documentation

◆ InputHistoryRaw()

jaffarPlus::InputHistoryRaw::InputHistoryRaw ( const uint32_t  maxInputIndex,
const uint32_t  maxSize 
)
inline

Constructs the strategy and sizes the per-state bit-packed buffer.

Parameters
maxInputIndexOne past the highest input index (sets the per-step bit width).
maxSizeMaximum number of steps recorded; longer solutions are truncated.

Definition at line 29 of file inputHistoryRaw.hpp.

Member Function Documentation

◆ captureColdToFull()

void jaffarPlus::InputHistoryRaw::captureColdToFull ( const void *  cold,
void *  full 
) const
inlineoverridevirtual

Converts a stored cold path into a self-contained full one (best/worst snapshot).

Operates on the path only; the runner's count prefix is copied separately by the StateDb.

Implements jaffarPlus::InputHistory.

Definition at line 66 of file inputHistoryRaw.hpp.

◆ deserializeCold()

void jaffarPlus::InputHistoryRaw::deserializeCold ( jaffarCommon::deserializer::Base &  d)
inlineoverridevirtual

Restores the cursor from a "cold" representation (the count is restored by the runner).

Implements jaffarPlus::InputHistory.

Definition at line 47 of file inputHistoryRaw.hpp.

◆ deserializeFull()

void jaffarPlus::InputHistoryRaw::deserializeFull ( jaffarCommon::deserializer::Base &  d,
const size_t  stepCount 
)
inlineoverridevirtual

Restores the cursor from a "full" representation.

stepCount is the runner's already-restored step counter, needed by strategies (the trie) that rebuild their cursor from the path length.

Implements jaffarPlus::InputHistory.

Definition at line 49 of file inputHistoryRaw.hpp.

◆ getApproxMemoryBytes()

virtual size_t jaffarPlus::InputHistory::getApproxMemoryBytes ( ) const
inlinevirtualinherited

Approximate resident memory of any shared structure (e.g. the trie), in bytes. Default: 0.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 94 of file inputHistory.hpp.

◆ getColdSize()

size_t jaffarPlus::InputHistoryRaw::getColdSize ( ) const
inlineoverridevirtual

Size, in bytes, of the cold path representation in a StateDb slot (EXCLUDING the runner's count).

Implements jaffarPlus::InputHistory.

Definition at line 63 of file inputHistoryRaw.hpp.

◆ getFullSize()

size_t jaffarPlus::InputHistoryRaw::getFullSize ( ) const
inlineoverridevirtual

Size, in bytes, of the full (self-contained) path representation in a snapshot buffer (EXCLUDING the count).

Implements jaffarPlus::InputHistory.

Definition at line 64 of file inputHistoryRaw.hpp.

◆ getInput()

InputSet::inputIndex_t jaffarPlus::InputHistoryRaw::getInput ( const size_t  step) const
inlineprivate

Reads the input index recorded for step from the bit-packed buffer.

Definition at line 75 of file inputHistoryRaw.hpp.

◆ initColdSlot()

virtual void jaffarPlus::InputHistory::initColdSlot ( void *  cold) const
inlinevirtualinherited

Prepares a fresh/recycled cold slot (e.g. marks it as holding no trie node). Default: no-op.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 81 of file inputHistory.hpp.

◆ pushInput()

void jaffarPlus::InputHistoryRaw::pushInput ( const size_t  stepCount,
const InputSet::inputIndex_t  input 
)
inlineoverridevirtual

Records one applied input at path position stepCount (the runner's current step counter).

Implements jaffarPlus::InputHistory.

Definition at line 38 of file inputHistoryRaw.hpp.

◆ releaseColdSlot()

virtual void jaffarPlus::InputHistory::releaseColdSlot ( void *  cold,
const size_t  shard 
) const
inlinevirtualinherited

Releases any shared resource a freed cold slot was holding (trie GC).

shard is the freeing thread's id, used to recycle into a contention-free per-thread pool. Default: no-op.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 84 of file inputHistory.hpp.

◆ reset()

void jaffarPlus::InputHistoryRaw::reset ( )
inlineoverridevirtual

Resets the cursor to the empty path.

Implements jaffarPlus::InputHistory.

Definition at line 36 of file inputHistoryRaw.hpp.

◆ serializeCold()

void jaffarPlus::InputHistoryRaw::serializeCold ( jaffarCommon::serializer::Base &  s) const
inlineoverridevirtual

Writes the compact "cold" path representation (stored in each StateDb slot), excluding the count.

Implements jaffarPlus::InputHistory.

Definition at line 46 of file inputHistoryRaw.hpp.

◆ serializeFull()

void jaffarPlus::InputHistoryRaw::serializeFull ( jaffarCommon::serializer::Base &  s) const
inlineoverridevirtual

Writes the self-contained "full" path representation (for standalone snapshot buffers), excluding the count.

Implements jaffarPlus::InputHistory.

Definition at line 48 of file inputHistoryRaw.hpp.

◆ setInput()

void jaffarPlus::InputHistoryRaw::setInput ( const size_t  step,
const InputSet::inputIndex_t  input 
)
inlineprivate

Writes the input index for step into the bit-packed buffer.

Definition at line 70 of file inputHistoryRaw.hpp.

◆ toString()

std::string jaffarPlus::InputHistoryRaw::toString ( const std::map< InputSet::inputIndex_t, std::string > &  inputStringMap,
const size_t  stepCount 
) const
inlineoverridevirtual

Reconstructs the path as a newline-separated string of input strings (the solution).

stepCount is the runner's step counter, bounding how many recorded steps are rendered.

Implements jaffarPlus::InputHistory.

Definition at line 51 of file inputHistoryRaw.hpp.

Member Data Documentation

◆ _bits

size_t jaffarPlus::InputHistoryRaw::_bits = 0
private

Bits used to encode one input index.

Definition at line 83 of file inputHistoryRaw.hpp.

◆ _buffer

std::vector<uint8_t> jaffarPlus::InputHistoryRaw::_buffer
private

Bit-packed input sequence.

Definition at line 84 of file inputHistoryRaw.hpp.

◆ _maxSize

const uint32_t jaffarPlus::InputHistoryRaw::_maxSize
private

Maximum number of steps recorded.

Definition at line 82 of file inputHistoryRaw.hpp.

◆ _truncationWarned

std::atomic<bool> jaffarPlus::InputHistoryRaw::_truncationWarned = false
inlinestaticprivate

Set once after the first over-Max-Size push.

Definition at line 85 of file inputHistoryRaw.hpp.


The documentation for this class was generated from the following file: