MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
max_matrix::Batch Class Reference

Holds the sending back for as long as it exists, as std::lock_guard holds a mutex. More...

#include <MaxMatrix.h>

Public Member Functions

 Batch (Matrix &matrix)
 Turns auto update of matrix off until the end of the block.
 ~Batch ()
 Puts auto update back as it was, which sends the picture if it was on.
 Batch (Batch const &)=delete
 Not copyable: a copy would put auto update back twice.
Batch & operator= (Batch const &)=delete
 Not assignable, as it is not copyable.

Detailed Description

Holds the sending back for as long as it exists, as std::lock_guard holds a mutex.

The constructor turns auto update off, the destructor puts back what was there before. So the picture is sent at the end of the block, also on a return or break out of it, and of nested ones only the outermost sends.

{
max_matrix::Batch batch(matrix);
matrix.Clear();
matrix.SetText("Hi");
} // sent here, at once
Holds the sending back for as long as it exists, as std::lock_guard holds a mutex.
Definition MaxMatrix.h:670
Warning
It has to be a named variable: an unnamed Batch{matrix}; is destroyed at once and holds nothing back.

A picture built over several calls of loop() does not fit into a block; that is what Matrix::SetAutoUpdate() and Matrix::Update() are for.

Constructor & Destructor Documentation

◆ Batch()

max_matrix::Batch::Batch ( Matrix & matrix)
inlineexplicit

Turns auto update of matrix off until the end of the block.

Parameters
[in,out]matrixThe matrix; it has to outlive the batch.

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