Leonardus
watermark.h
Go to the documentation of this file.
1
18#pragma once
19
20#include "error.h"
21
22
26class Watermark {
27 size_t counter_ = 0,
31public: /* accessor */
33 size_t getCounter() const { return counter_; }
34
35
37 size_t getWatermark() const { return watermark_; }
38
39
40public: /* other */
42 void inc() {
43 if( ++counter_ > watermark_ )
45 }
46
47
49 void dec() {
50 if( counter_-- == 0 )
51 inErrExit( internal, "watermark below zero" ); /* LCOV_EXCL_LINE */ // See #88
52 }
53
54
58 void set( size_t p_size ) {
59 counter_ = p_size;
60 if( counter_ > watermark_ )
62 }
63};
Watermark class.
Definition: watermark.h:26
void set(size_t p_size)
Set and check given size.
Definition: watermark.h:58
size_t counter_
Counter.
Definition: watermark.h:27
size_t watermark_
Watermark.
Definition: watermark.h:28
size_t getWatermark() const
Getter for the watermark.
Definition: watermark.h:37
void dec()
Decrement counter.
Definition: watermark.h:49
size_t getCounter() const
Getter for counter.
Definition: watermark.h:33
void inc()
Increment counter and watermark if neccessary.
Definition: watermark.h:42
void inErrExit(InError p_err, const std::string &p_details, const std::source_location p_location)
Interpreter error message to interpreter cout_ and exit( EC_INTERPRETER / EC_CMDLINE ).
Definition: error.cpp:71
Error handling.
@ internal
float formating; context not initialized; counter less than zero; non dictionary object on dictionary...
Definition: error.h:45