Go to the previous, next section.
#include <nihcl/Object.h>
NIHCL
is a "module" class--a class containing only static members--which encapsulates member variables and functions which would otherwise be global. This makes it easier to combine the NIH Class Library with other class libraries in the same program since there is less chance of duplicate names.
All
NIH Library classes are derived either directly or indirectly from class
NIHCL
so that they can access its members without the need to use the scope resolution operator.
static unsigned char charBitMask(int
i)
static unsigned short shortBitMask(int
i)
static unsigned int intBitMask(int
i)
charBitMask(0)
is 1. The type of the mask is
char
,
short
, or
int
, respectively. The argument must be less than the number of bits in the return type.
static unsigned char bitCount(unsigned
i)
BitCount()
member function returns a count of the number of 1 bits in the argument. For example,
bitCount(5)
is 2. The argument must be in the range 0 to 255.
static unsigned char bitReverse(unsigned
i)
bitReverse()
member function returns its argument with its bits reversed left to right. For example,
bitReverse(0x80)
is 1. The argument must be in the range 0 to 255.
static void setError(int
error, int
sev, ...)
nihclerrs.h
, and
sev
should be one of the severity level codes:
SUCCESS
,
INFO
,
WARNING
,
ERROR
,
FATAL
, or
DEFAULT
@refill.
By default,
setError()
prints the message associated with the specified error on
stderr
and aborts the program. However, a programmer can arrange to have
setError()
call a function he supplies before aborting the program (see class
ExceptionTrap)
, or can have the error raised as an exception (see class
RaiseException
). Using the NIHCL exception mechanism is slow and error prone, and is
not recommended.
When used outside the scope of a class derived from class
NIHCL
, the severity codes must be referenced as:
NIHCL::SUCCESS
,
NIHCL::INFO
,
NIHCL::WARNING
,
NIHCL::ERROR
,
NIHCL::FATAL
, or
NIHCL::DEFAULT
@refill.
Go to the previous, next section.