PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::detail::ScratchFile Class Reference

#include <scratch_file.hpp>

Public Types

enum class  IoRaiser {
  report_sink ,
  auxiliary
}
 

Public Member Functions

 ScratchFile (IoRaiser raiser=IoRaiser::report_sink)
 
 ScratchFile (const ScratchFile &)=delete
 
ScratchFile & operator= (const ScratchFile &)=delete
 
 ScratchFile (ScratchFile &&other) noexcept
 
ScratchFile & operator= (ScratchFile &&other) noexcept
 
 ~ScratchFile ()
 
void bind_scratch (const std::shared_ptr< ScratchSlab > &slab, ScratchResource resource)
 
const std::shared_ptr< ScratchSlab > & scratch_owner () const noexcept
 
ScratchResource scratch_resource () const noexcept
 
void set_store (ScratchStore store) noexcept
 
void bound_cache ()
 
void set_directory (const std::string &value)
 
void clear () noexcept
 
bool opened () const noexcept
 
bool arena_backed () const noexcept
 
int descriptor () const noexcept
 
void truncate (std::uint64_t bytes)
 
void open (const char *prefix)
 
void open_bounded (const char *, std::uint64_t max_bytes)
 
void ensure_size (std::uint64_t bytes, std::uint64_t needed_bytes_lower_bound=0)
 
ssize_t write_some (std::uint64_t offset, const void *data, std::size_t length)
 
ssize_t read_some (std::uint64_t offset, void *data, std::size_t length) const
 
void write (std::uint64_t offset, const void *data, std::size_t length)
 
void read (std::uint64_t offset, void *data, std::size_t length) const
 

Static Public Member Functions

static void check_extent (std::uint64_t offset, std::size_t length, bool arena=false, IoRaiser raiser=IoRaiser::report_sink)
 

Static Public Attributes

static constexpr std::size_t kCacheBytes = 64 * 1024
 

Detailed Description

Definition at line 36 of file scratch_file.hpp.

Member Enumeration Documentation

◆ IoRaiser

Enumerator
report_sink 
auxiliary 

Definition at line 41 of file scratch_file.hpp.

Constructor & Destructor Documentation

◆ ScratchFile() [1/3]

pineforge::detail::ScratchFile::ScratchFile ( IoRaiser raiser = IoRaiser::report_sink)
inlineexplicit

Definition at line 42 of file scratch_file.hpp.

References report_sink.

Referenced by operator=(), operator=(), ScratchFile(), and ScratchFile().

◆ ScratchFile() [2/3]

pineforge::detail::ScratchFile::ScratchFile ( const ScratchFile & )
delete

References ScratchFile().

◆ ScratchFile() [3/3]

pineforge::detail::ScratchFile::ScratchFile ( ScratchFile && other)
inlinenoexcept

Definition at line 45 of file scratch_file.hpp.

References ScratchFile().

◆ ~ScratchFile()

pineforge::detail::ScratchFile::~ScratchFile ( )
inline

Definition at line 63 of file scratch_file.hpp.

References clear().

Member Function Documentation

◆ operator=() [1/2]

ScratchFile & pineforge::detail::ScratchFile::operator= ( const ScratchFile & )
delete

References ScratchFile().

◆ operator=() [2/2]

ScratchFile & pineforge::detail::ScratchFile::operator= ( ScratchFile && other)
inlinenoexcept

Definition at line 46 of file scratch_file.hpp.

References clear(), and ScratchFile().

◆ bind_scratch()

void pineforge::detail::ScratchFile::bind_scratch ( const std::shared_ptr< ScratchSlab > & slab,
ScratchResource resource )
inline

Definition at line 67 of file scratch_file.hpp.

References clear(), and pineforge::resource.

◆ scratch_owner()

const std::shared_ptr< ScratchSlab > & pineforge::detail::ScratchFile::scratch_owner ( ) const
inlinenoexcept

Definition at line 74 of file scratch_file.hpp.

◆ scratch_resource()

ScratchResource pineforge::detail::ScratchFile::scratch_resource ( ) const
inlinenoexcept

Definition at line 75 of file scratch_file.hpp.

◆ set_store()

void pineforge::detail::ScratchFile::set_store ( ScratchStore store)
inlinenoexcept

Definition at line 86 of file scratch_file.hpp.

◆ bound_cache()

void pineforge::detail::ScratchFile::bound_cache ( )
inline

Definition at line 90 of file scratch_file.hpp.

◆ set_directory()

void pineforge::detail::ScratchFile::set_directory ( const std::string & value)
inline

Definition at line 94 of file scratch_file.hpp.

References pineforge::detail::value.

◆ clear()

void pineforge::detail::ScratchFile::clear ( )
inlinenoexcept

Definition at line 100 of file scratch_file.hpp.

Referenced by bind_scratch(), open(), operator=(), and ~ScratchFile().

◆ opened()

bool pineforge::detail::ScratchFile::opened ( ) const
inlinenoexcept

Definition at line 110 of file scratch_file.hpp.

Referenced by ensure_size(), open(), and open_bounded().

◆ arena_backed()

bool pineforge::detail::ScratchFile::arena_backed ( ) const
inlinenoexcept

Definition at line 111 of file scratch_file.hpp.

◆ descriptor()

int pineforge::detail::ScratchFile::descriptor ( ) const
inlinenoexcept

Definition at line 114 of file scratch_file.hpp.

◆ truncate()

void pineforge::detail::ScratchFile::truncate ( std::uint64_t bytes)
inline

Definition at line 115 of file scratch_file.hpp.

References check_extent(), and pineforge::detail::io_error.

◆ open()

◆ open_bounded()

void pineforge::detail::ScratchFile::open_bounded ( const char * ,
std::uint64_t max_bytes )
inline

◆ ensure_size()

void pineforge::detail::ScratchFile::ensure_size ( std::uint64_t bytes,
std::uint64_t needed_bytes_lower_bound = 0 )
inline

Definition at line 209 of file scratch_file.hpp.

References check_extent(), pineforge::detail::io_error, and opened().

◆ check_extent()

static void pineforge::detail::ScratchFile::check_extent ( std::uint64_t offset,
std::size_t length,
bool arena = false,
IoRaiser raiser = IoRaiser::report_sink )
inlinestatic

◆ write_some()

ssize_t pineforge::detail::ScratchFile::write_some ( std::uint64_t offset,
const void * data,
std::size_t length )
inline

Definition at line 244 of file scratch_file.hpp.

References check_extent(), pineforge::detail::data, and kCacheBytes.

◆ read_some()

ssize_t pineforge::detail::ScratchFile::read_some ( std::uint64_t offset,
void * data,
std::size_t length ) const
inline

Definition at line 265 of file scratch_file.hpp.

References check_extent(), pineforge::detail::data, and kCacheBytes.

◆ write()

void pineforge::detail::ScratchFile::write ( std::uint64_t offset,
const void * data,
std::size_t length )
inline

◆ read()

void pineforge::detail::ScratchFile::read ( std::uint64_t offset,
void * data,
std::size_t length ) const
inline

Field Documentation

◆ kCacheBytes

std::size_t pineforge::detail::ScratchFile::kCacheBytes = 64 * 1024
staticconstexpr

Definition at line 39 of file scratch_file.hpp.

Referenced by read(), read_some(), write(), and write_some().


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