ME507 Utility Library  0.2.1
Mechatronics Course Support Software for ARM/Arduino/FreeRTOS
devnull.cpp File Reference
#include "devnull.h"
Include dependency graph for devnull.cpp:

Functions

DevNulloperator<< (DevNull &no, const __FlashStringHelper *s)
 
DevNulloperator<< (DevNull &no, const String &s)
 
DevNulloperator<< (DevNull &no, const char s[])
 
DevNulloperator<< (DevNull &no, char c)
 
DevNulloperator<< (DevNull &no, unsigned char c)
 
DevNulloperator<< (DevNull &no, int i)
 
DevNulloperator<< (DevNull &no, unsigned int i)
 
DevNulloperator<< (DevNull &no, int8_t i)
 
DevNulloperator<< (DevNull &no, long i)
 
DevNulloperator<< (DevNull &no, unsigned long i)
 
DevNulloperator<< (DevNull &no, double d)
 
DevNulloperator<< (DevNull &no, const Printable &p)
 
DevNulloperator<< (DevNull &no, bool b)
 
DevNulloperator<< (DevNull &no, manipulator pf)
 
DevNulloperator<< (DevNull &no, _Setbase __f)
 
DevNulloperator<< (DevNull &no, _Setprecision __f)
 
DevNulloperator<< (DevNull &no, _Setbytesep __f)
 

Variables

DevNull Debug
 Defining this macro causes debugging printouts to be suppressed. More...
 

Detailed Description

This file allows debugging printouts to be conveniently turned on and off. It contains a class which doesn't print anything when given things which are not to be printed using the << operator, and it creates a single object called Debug. In this file are lines which either define or undefine the macro DEBUG_PRINT_OFF.

  • If the macro DEBUG_PRINT_OFF is defined, the Debug object will be a member of class DevNull (named for the Unix file /dev/null which is sort of a black hole for data, never mind the black hole quantum information paradox) and whenever code sends information to Debug with the shift operator using code such as
    Debug << "Velocity is " << velocity << endl;
    Nothing will be printed (in fact, pretty much nothing will happen at all).
  • If the macro DEBUG_PRINT_OFF is undefined, the Debug object will be a reference to Serial and debugging information will be printed there.
  • TODO: Add the ability to send debugging information to other children of class Print such as SD cards or other serial ports.
Author
JR Ridgely
Date
2021-Nov-26 JRR Original file

License: This file is copyright 2021 by JR Ridgely and released under the Lesser GNU Public License, version 2. It intended for educational use only, but its use is not limited thereto.

Variable Documentation

◆ Debug

DevNull Debug

Defining this macro causes debugging printouts to be suppressed.

If debugging printouts have been turned off, create an object of class DevNull which doesn't cause anything to be printed. This should be the only such object which ever needs to be created, unless there are several independently activated and/or deactivated debug-print things.

Debug
DevNull Debug
Defining this macro causes debugging printouts to be suppressed.
Definition: devnull.cpp:52