Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Ascii_Frame_Sink< Palette > Class Template Reference

Stream sink that writes textual frames to an output stream. More...

#include <ca-ascii.H>

Collaboration diagram for Aleph::CA::Ascii_Frame_Sink< Palette >:
[legend]

Public Member Functions

 Ascii_Frame_Sink (std::ostream &out, Palette palette, Ascii_Render_Options opts={}, const bool include_step_header=true)
 Build a stream-backed ASCII sink.
 
template<typename Lattice >
void accept (const std::size_t step, const Lattice &frame)
 Write one textual frame.
 
void flush ()
 Flush the wrapped stream.
 

Private Attributes

std::ostream * out_ = nullptr
 
Palette palette_
 
Ascii_Render_Options opts_ {}
 
bool include_step_header_ = true
 

Detailed Description

template<typename Palette>
class Aleph::CA::Ascii_Frame_Sink< Palette >

Stream sink that writes textual frames to an output stream.

Each accepted frame is preceded by a compact step marker unless include_step_header is disabled.

Template Parameters
Paletteinvocable state_type -> std::string.

Definition at line 286 of file ca-ascii.H.

Constructor & Destructor Documentation

◆ Ascii_Frame_Sink()

template<typename Palette >
Aleph::CA::Ascii_Frame_Sink< Palette >::Ascii_Frame_Sink ( std::ostream &  out,
Palette  palette,
Ascii_Render_Options  opts = {},
const bool  include_step_header = true 
)
inline

Build a stream-backed ASCII sink.

Parameters
[in,out]outdestination stream.
[in]palettestate-to-text mapper.
[in]optsrendering options.
[in]include_step_headerwrite # step N before each frame.

Definition at line 300 of file ca-ascii.H.

Member Function Documentation

◆ accept()

template<typename Palette >
template<typename Lattice >
void Aleph::CA::Ascii_Frame_Sink< Palette >::accept ( const std::size_t  step,
const Lattice &  frame 
)
inline

Write one textual frame.

Template Parameters
Lattice2D lattice type.
Parameters
[in]stepsimulation step.
[in]frameframe to render.

Definition at line 314 of file ca-ascii.H.

References Aleph::CA::Ascii_Frame_Sink< Palette >::include_step_header_, Aleph::CA::Ascii_Frame_Sink< Palette >::opts_, Aleph::CA::Ascii_Frame_Sink< Palette >::out_, Aleph::CA::Ascii_Frame_Sink< Palette >::palette_, and Aleph::CA::render_ascii().

◆ flush()

Member Data Documentation

◆ include_step_header_

template<typename Palette >
bool Aleph::CA::Ascii_Frame_Sink< Palette >::include_step_header_ = true
private

Definition at line 291 of file ca-ascii.H.

Referenced by Aleph::CA::Ascii_Frame_Sink< Palette >::accept().

◆ opts_

◆ out_

template<typename Palette >
std::ostream* Aleph::CA::Ascii_Frame_Sink< Palette >::out_ = nullptr
private

◆ palette_

template<typename Palette >
Palette Aleph::CA::Ascii_Frame_Sink< Palette >::palette_
private

Definition at line 289 of file ca-ascii.H.

Referenced by Aleph::CA::Ascii_Frame_Sink< Palette >::accept().


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