SILICON
Loading...
Searching...
No Matches
Reader Class Referencefinal

High-level zero-overhead wrapper around libfst reader APIs. More...

#include <fstWrapper.hpp>

Classes

struct  EnumTable
 Decoded enum table extracted from libfst. More...
struct  FstVarNode
 Represents a single waveform variable/signal. More...
struct  FstScopeNode
 Recursive hierarchy node representing scopes/modules/packages/etc. More...

Public Member Functions

 Reader (std::string_view fileName)
 Opens an FST file for reading.
 ~Reader ()=default
 Reader (const Reader &)=delete
Reader & operator= (const Reader &)=delete
 Reader (Reader &&) noexcept=default
Reader & operator= (Reader &&) noexcept=default
const std::string & getFileName () const
uint64_t getStartTime () const
uint64_t getEndTime () const
uint64_t getVarCount () const
uint64_t getScopeCount () const
int8_t getTimescale () const
 Returns the exponent used by the timescale.
std::string getVersion () const
std::string getDate () const
template<typename Func>
void iterateHierarchy (Func &&callback)
 Generic hierarchy iterator.
FstScopeNode buildHierarchyTree ()
 Reconstructs hierarchy into a recursive tree structure.
void setLimitTimeRange (uint64_t start_time, uint64_t end_time)
 Restricts waveform iteration to a bounded time window.
void setUnlimitedTimeRange ()
 Removes any previously configured time restrictions.
void setFacProcessMaskAll ()
 Enables processing for all signals.
void clearFacProcessMaskAll ()
 Disables processing for all signals.
void setFacProcessMask (fstHandle facidx)
 Enables a specific signal for processing.
void clearFacProcessMask (fstHandle facidx)
 Disables a specific signal for processing.
template<typename Func>
void readIterateBlocks (Func &&callback)
 Iterates waveform blocks and forwards value changes to a callback.

Static Public Member Functions

static EnumTable parseEnumTable (std::string_view enumString)
 Parses a textual enum encoding into structured data.

Private Attributes

std::string fn
std::unique_ptr< fstReaderContext, ReaderDeleter > context

Detailed Description

High-level zero-overhead wrapper around libfst reader APIs.

The existence of an Reader instance guarantees that the FST file is successfully opened and the underlying reader context is valid.

Definition at line 78 of file fstWrapper.hpp.

Constructor & Destructor Documentation

◆ Reader() [1/3]

Reader ( std::string_view fileName)
explicit

Opens an FST file for reading.

Throws immediately on failure.

This constructor establishes the class invariant that a successfully constructed object always owns a valid reader context.

Definition at line 27 of file fstWrapper.cpp.

◆ ~Reader()

~Reader ( )
default

◆ Reader() [2/3]

Reader ( const Reader & )
delete

Copying is forbidden because the underlying libfst context is a unique ownership resource.

◆ Reader() [3/3]

Reader ( Reader && )
defaultnoexcept

Moving is safe because ownership transfers cleanly through unique_ptr.

Member Function Documentation

◆ buildHierarchyTree()

Reader::FstScopeNode buildHierarchyTree ( )
nodiscard

Reconstructs hierarchy into a recursive tree structure.

Internally this performs a single linear pass over the hierarchy event stream using a stack-based AST construction algorithm.

Definition at line 57 of file fstWrapper.cpp.

◆ clearFacProcessMask()

void clearFacProcessMask ( fstHandle facidx)
inline

Disables a specific signal for processing.

Definition at line 328 of file fstWrapper.hpp.

◆ clearFacProcessMaskAll()

void clearFacProcessMaskAll ( )
inline

Disables processing for all signals.

Definition at line 310 of file fstWrapper.hpp.

◆ getDate()

std::string getDate ( ) const
nodiscard

Definition at line 48 of file fstWrapper.cpp.

◆ getEndTime()

uint64_t getEndTime ( ) const
inlinenodiscard

Definition at line 193 of file fstWrapper.hpp.

◆ getFileName()

const std::string & getFileName ( ) const
inlinenodiscard

Definition at line 183 of file fstWrapper.hpp.

◆ getScopeCount()

uint64_t getScopeCount ( ) const
inlinenodiscard

Definition at line 205 of file fstWrapper.hpp.

◆ getStartTime()

uint64_t getStartTime ( ) const
inlinenodiscard

Definition at line 187 of file fstWrapper.hpp.

◆ getTimescale()

int8_t getTimescale ( ) const
inlinenodiscard

Returns the exponent used by the timescale.

Example: -9 => nanoseconds -12 => picoseconds

Definition at line 218 of file fstWrapper.hpp.

◆ getVarCount()

uint64_t getVarCount ( ) const
inlinenodiscard

Definition at line 199 of file fstWrapper.hpp.

◆ getVersion()

std::string getVersion ( ) const
nodiscard

Definition at line 40 of file fstWrapper.cpp.

◆ iterateHierarchy()

template<typename Func>
void iterateHierarchy ( Func && callback)
inline

Generic hierarchy iterator.

This uses a templated callable rather than std::function in order to avoid:

  • heap allocation
  • virtual dispatch
  • type erasure overhead

The callback is fully inlinable by the compiler.

Example:

reader.iterateHierarchy([](const fstHier* h) { ... });

Definition at line 246 of file fstWrapper.hpp.

◆ operator=() [1/2]

Reader & operator= ( const Reader & )
delete

◆ operator=() [2/2]

Reader & operator= ( Reader && )
defaultnoexcept

◆ parseEnumTable()

Reader::EnumTable parseEnumTable ( std::string_view enumString)
static

Parses a textual enum encoding into structured data.

libfst internally allocates the intermediate structure. This wrapper copies the data into STL-owned memory before releasing the libfst allocation.

Definition at line 98 of file fstWrapper.cpp.

◆ readIterateBlocks()

template<typename Func>
void readIterateBlocks ( Func && callback)
inline

Iterates waveform blocks and forwards value changes to a callback.

This is the hottest execution path in waveform processing, so the design is aggressively optimized:

  • no std::function
  • no heap allocation
  • no virtual dispatch
  • no dynamic polymorphism

libfst expects C function pointers, so stateless lambdas are used as trampoline adapters.

Definition at line 348 of file fstWrapper.hpp.

◆ setFacProcessMask()

void setFacProcessMask ( fstHandle facidx)
inline

Enables a specific signal for processing.

Definition at line 319 of file fstWrapper.hpp.

◆ setFacProcessMaskAll()

void setFacProcessMaskAll ( )
inline

Enables processing for all signals.

Definition at line 301 of file fstWrapper.hpp.

◆ setLimitTimeRange()

void setLimitTimeRange ( uint64_t start_time,
uint64_t end_time )
inline

Restricts waveform iteration to a bounded time window.

Definition at line 283 of file fstWrapper.hpp.

◆ setUnlimitedTimeRange()

void setUnlimitedTimeRange ( )
inline

Removes any previously configured time restrictions.

Definition at line 292 of file fstWrapper.hpp.

Member Data Documentation

◆ context

std::unique_ptr<fstReaderContext, ReaderDeleter> context
private

Sole owner of the underlying libfst reader context.

Definition at line 388 of file fstWrapper.hpp.

◆ fn

std::string fn
private

Cached filename for diagnostics/debugging.

Definition at line 383 of file fstWrapper.hpp.


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