FreeNOS
Namespaces | Data Structures | Macros | Typedefs | Functions | Variables
libstd

Contains standard algorithms and datastructures for generic programming. More...

Namespaces

 Character
 
 Number
 

Data Structures

class  Array< T, N >
 This is a wrapper class for a fixed size array. More...
 
class  Associative< K, V >
 Associatives are containers that provide a mapping of keys to values. More...
 
class  BitArray
 Represents an array of bits. More...
 
class  CallbackFunction
 Represents a callback function. More...
 
class  Callback< Base, ParamType >
 Abstraction for providing a callback function to a object instance. More...
 
class  Comparable< T >
 Objects which can be compared to each other. More...
 
class  ConstHashIterator< K, V >
 Iterate through a constant (read-only) HashTable. More...
 
class  ConstIterator< T >
 Abstracts an iteration process for a constant. More...
 
class  Container
 Containers provide access to stored items. More...
 
class  Factory< T >
 Factory design pattern providing a standard creation function. More...
 
class  AbstractFactory< T >
 Abstract Factory pattern providing a creation function declaration. More...
 
class  HashIterator< K, V >
 Iterate through a HashTable. More...
 
class  HashTable< K, V >
 Efficient key -> value lookups. More...
 
class  Index< T, N >
 Index is a N-sized array of pointers to items of type T. More...
 
class  Iterator< T >
 Abstracts an iteration process. More...
 
class  List< T >
 Simple linked list template class. More...
 
class  ListIterator< T >
 Iterate through a List. More...
 
class  Log
 Logging class. More...
 
class  MemoryBlock
 Memory block operations class. More...
 
class  Queue< T, N >
 Array of items as a First-In-First-Out (FIFO) datastructure. More...
 
class  Randomizer
 Produces random integers using the Linear congruential generator algorithm. More...
 
class  Sequence< T >
 Sequences are containers that provide indexed based storage of items. More...
 
class  StrictSingleton< T >
 Singleton design pattern: only one instance is allowed. More...
 
class  WeakSingleton< T >
 Singleton design pattern: only one instance is allowed. More...
 
class  String
 Abstraction of strings. More...
 
struct  DeviceID
 Describes a device ID number. More...
 
class  Vector< T >
 Vectors are dynamically resizeable Arrays. More...
 

Macros

#define FNV_PRIME   16777619
 Prime number used by FNV hashing. More...
 
#define FNV_INIT   0x811c9dc5
 Initial value of the FNV internal state. More...
 
#define MAKE_LOG(type, typestr, msg)
 Output a log line to the system log (syslog). More...
 
#define FATAL(msg)
 Output a critical message and terminate program immediatly. More...
 
#define ERROR(msg)   MAKE_LOG(Log::Error, "Error", msg)
 Output an error message. More...
 
#define WARNING(msg)   MAKE_LOG(Log::Warning, "Warning", msg)
 Output a warning message. More...
 
#define NOTICE(msg)   MAKE_LOG(Log::Notice, "Notice", msg)
 Output a notice message. More...
 
#define INFO(msg)   MAKE_LOG(Log::Info, "Info", msg)
 Output a regular message to standard output. More...
 
#define DEBUG(msg)   MAKE_LOG(Log::Debug, "Debug", msg)
 Output a debug message to standard output. More...
 
#define TRUE   1
 Binary 1 means true. More...
 
#define FALSE   0
 Binary zero means false. More...
 
#define NULL   (void *)0
 NULL means zero. More...
 
#define ZERO   0
 Zero value. More...
 
#define QUOTE(x)   #x
 Stringfies the given input. More...
 
#define IQUOTE(x)   QUOTE(x)
 Indirect quoting. More...
 
#define KiloByte(v)   ((v) * 1024)
 Convert kilobytes to bytes. More...
 
#define MegaByte(v)   ((v) * 1024 * 1024)
 Convert megabytes to bytes. More...
 
#define GigaByte(v)   ((v) * 1024 * 1024 * 1024)
 Convert gigabytes to bytes. More...
 
#define LONG_MIN   -2147483647L
 Minimum value of an object of type long int. More...
 
#define LONG_MAX   2147483647L
 Maximum value of an object of type long int. More...
 
#define ULONG_MIN   0LU
 
#define ULONG_MAX   4294967295LU
 
#define INT_MIN   -2147483647
 
#define INT_MAX   2147483647
 
#define UINT_MIN   0U
 
#define UINT_MAX   4294967295U
 
#define CEIL(number, divisor)
 Calculate a division, and round to up any remaining. More...
 
#define offsetof(TYPE, MEMBER)   ((Size) &((TYPE *)0)->MEMBER)
 Calculates offsets in data structures. More...
 
#define C   "C"
 Used to define external C functions. More...
 
#define CPP
 
#define SECTION(s)   __attribute__((__section__(s)))
 Can be used to link a symbol inside a specific section. More...
 
#define USED   __attribute__((__used__))
 Declares an symbol to be forcibly "used". More...
 
#define PACKED   __attribute__((__packed__))
 Ensures strict minimum memory requirements. More...
 
#define ALIGN(n)   __attribute__((aligned(n)))
 Aligns a symbol at the given boundary. More...
 
#define STRING_DEFAULT_SIZE   64
 Default maximum length of a String's value. More...
 
#define BITWISE
 Restrict bit operations. More...
 
#define VECTOR_DEFAULT_SIZE   64
 Default size of an Vector. More...
 

Typedefs

typedef unsigned int Size
 Any sane size indicator cannot go negative. More...
 
typedef unsigned long Address
 A memory address. More...
 
typedef unsigned short UserID
 User Identity. More...
 
typedef unsigned short GroupID
 Group Identity. More...
 
typedef u32 ProcessID
 Process Identification Number. More...
 
typedef struct DeviceID DeviceID
 Describes a device ID number. More...
 
typedef slong Error
 Error code defined in Error.h. More...
 

Functions

template<class T >
operator~ (T a)
 
template<class T >
operator| (T a, T b)
 
template<class T >
operator& (T a, T b)
 
template<class T >
operator^ (T a, T b)
 
template<class T >
T & operator|= (T &a, T b)
 
template<class T >
T & operator&= (T &a, T b)
 
template<class T >
T & operator^= (T &a, T b)
 
Size hash (const String &key, Size mod)
 Compute a hash using the FNV algorithm. More...
 
Size hash (int key, Size mod)
 Compute a hash using the FNV algorithm. More...
 
bool isPowerOfTwo (unsigned number)
 Check if a number is power of two. More...
 
double doubleAbsolute (double number)
 Absolute value of a double. More...
 
bool doubleEquals (double a, double b, double epsilon)
 Compare two doubles using a epsilon number as precision indicator. More...
 

Variables

static T * WeakSingleton< T >::m_instance = 0
 One and only instance. More...
 

Preprocessor assertion

#define assert(exp)
 Verify that a given expression evaluates to true. More...
 
#define SWAP16(x)
 Byte swap functions. More...
 
#define SWAP32(x)
 Byte swap a 32-bit integer. More...
 
#define SWAP64(x)
 Byte swap a 64-bit integer. More...
 
#define cpu_to_le64(x)   ((le64)(u64)(x))
 Integer conversion functions. More...
 
#define le64_to_cpu(x)   ((u64)(le64)(x))
 Little endian 64-bit to CPU byte order. More...
 
#define cpu_to_le32(x)   ((le32)(u32)(x))
 CPU byte order to little endian 32-bit. More...
 
#define le32_to_cpu(x)   ((u32)(le32)(x))
 Little endian 32-bit to CPU byte order. More...
 
#define cpu_to_le16(x)   ((le16)(u16)(x))
 CPU byte order to little endian 16-bit. More...
 
#define le16_to_cpu(x)   ((u16)(le16)(x))
 Little endian 16-bit to CPU byte order. More...
 
#define cpu_to_be64(x)   ((be64)SWAP64((x)))
 CPU byte order to big endian 64-bit. More...
 
#define be64_to_cpu(x)   SWAP64((u64)(be64)(x))
 Big endian 64-bit to CPU byte order. More...
 
#define cpu_to_be32(x)   ((be32)SWAP32((x)))
 CPU byte order to big endian 32-bit. More...
 
#define be32_to_cpu(x)   SWAP32((u32)(be32)(x))
 Big endian 32-bit to CPU byte order. More...
 
#define cpu_to_be16(x)   ((be16)SWAP16((x)))
 CPU byte order to big endian 16-bit. More...
 
#define be16_to_cpu(x)   SWAP16((u16)(be16)(x))
 Big endian 16-bit to CPU byte order. More...
 
const u64 read64 (const void *data)
 Memory read/write functions. More...
 
const u32 read32 (const void *data)
 Read 32-bit integer (no conversion) More...
 
const u16 read16 (const void *data)
 Read 16-bit integer (no conversion) More...
 
const u8 read8 (const void *data)
 Read 8-bit integer. More...
 
void write64 (void *data, const u64 input)
 Write 64-bit integer (no conversion) More...
 
void write32 (void *data, const u32 input)
 Write 32-bit integer (no conversion) More...
 
void write16 (void *data, const u16 input)
 Write 16-bit integer (no conversion) More...
 
void write8 (void *data, const u8 input)
 Write 8-bit integer. More...
 
const u64 readLe64 (const void *data)
 Read 64-bit little endian integer. More...
 
const u32 readLe32 (const void *data)
 Read 32-bit little endian integer. More...
 
const u16 readLe16 (const void *data)
 Read 16-bit little endian integer. More...
 
const u64 readBe64 (const void *data)
 Read 64-bit big endian integer. More...
 
const u32 readBe32 (const void *data)
 Read 32-bit big endian integer. More...
 
const u16 readBe16 (const void *data)
 Read 16-bit big endian integer. More...
 
void writeLe64 (void *data, const u64 input)
 Write 64-bit little endian integer. More...
 
void writeLe32 (void *data, const u32 input)
 Write 32-bit little endian integer. More...
 
void writeLe16 (void *data, const u16 input)
 Write 16-bit little endian integer. More...
 
void writeBe64 (void *data, const u64 input)
 Write 64-bit big endian integer. More...
 
void writeBe32 (void *data, const u32 input)
 Write 32-bit big endian integer. More...
 
void writeBe16 (void *data, const u16 input)
 Write 16-bit big endian integer. More...
 

Operators to output various standard types to the log

Logoperator<< (Log &log, const char *str)
 
Logoperator<< (Log &log, int number)
 
Logoperator<< (Log &log, const char character)
 
Logoperator<< (Log &log, unsigned number)
 
Logoperator<< (Log &log, unsigned long number)
 
Logoperator<< (Log &log, void *ptr)
 

Unsigned integers.

typedef unsigned int uint
 Unsigned integer number. More...
 
typedef unsigned long ulong
 Unsigned long number. More...
 
typedef unsigned long long u64
 Unsigned 64-bit number. More...
 
typedef unsigned int u32
 Unsigned 32-bit number. More...
 
typedef unsigned short u16
 Unsigned 16-bit number. More...
 
typedef unsigned char u8
 Unsigned 8-bit number. More...
 

Signed integers.

typedef signed int sint
 Signed integer number. More...
 
typedef signed long slong
 Signed long number. More...
 
typedef signed long long s64
 Signed 64-bit number. More...
 
typedef signed int s32
 Signed 32-bit number. More...
 
typedef signed short int s16
 Signed 16-bit number. More...
 
typedef signed char s8
 Signed 8-bit number. More...
 

Bitwise checked integers.

See also
http://kerneltrap.org/node/3848
typedef u64 BITWISE le64
 Unsigned 64-bit little endian number. More...
 
typedef u64 BITWISE be64
 Unsigned 64-bit big endian number. More...
 
typedef u32 BITWISE le32
 Unsigned 32-bit little endian number. More...
 
typedef u32 BITWISE be32
 Unsigned 32-bit big endian number. More...
 
typedef u16 BITWISE le16
 Unsigned 16-bit little endian number. More...
 
typedef u16 BITWISE be16
 Unsigned 16-bit big endian number. More...
 
typedef u8 BITWISE le8
 Unsigned 8-bit little endian number. More...
 
typedef u8 BITWISE be8
 Unsigned 8-bit big endian number. More...
 

Detailed Description

Contains standard algorithms and datastructures for generic programming.

Macro Definition Documentation

◆ ALIGN

#define ALIGN (   n)    __attribute__((aligned(n)))

Aligns a symbol at the given boundary.

Parameters
nBoundary to align.

Definition at line 167 of file Macros.h.

◆ assert

#define assert (   exp)
Value:
if (!(exp)) \
{ \
FATAL("*** Assertion `" << QUOTE(#exp) << "' failed ***"); \
}

Verify that a given expression evaluates to true.

Parameters
expBoolean expression.

Definition at line 43 of file Assert.h.

◆ be16_to_cpu

#define be16_to_cpu (   x)    SWAP16((u16)(be16)(x))

Big endian 16-bit to CPU byte order.

Parameters
xbe16 type integer.
Returns
CPU byte ordered 16-bit integer.

Definition at line 207 of file ByteOrder.h.

◆ be32_to_cpu

#define be32_to_cpu (   x)    SWAP32((u32)(be32)(x))

Big endian 32-bit to CPU byte order.

Parameters
xbe32 type integer.
Returns
CPU byte ordered 32-bit integer.

Definition at line 189 of file ByteOrder.h.

◆ be64_to_cpu

#define be64_to_cpu (   x)    SWAP64((u64)(be64)(x))

Big endian 64-bit to CPU byte order.

Parameters
xbe64 type integer.
Returns
CPU byte ordered 64-bit integer.

Definition at line 171 of file ByteOrder.h.

◆ BITWISE

#define BITWISE

Restrict bit operations.

See also
http://kerneltrap.org/node/3848

Definition at line 36 of file Types.h.

◆ C

#define C   "C"

Used to define external C functions.

Definition at line 134 of file Macros.h.

◆ CEIL

#define CEIL (   number,
  divisor 
)
Value:
( (number) % (divisor) ? \
((number) / (divisor)) + 1 : (number) / (divisor))

Calculate a division, and round to up any remaining.

Parameters
numberInput number.
divisorDivisor number.
Returns
Ceiled number.

Definition at line 88 of file Macros.h.

◆ CPP

#define CPP

Definition at line 135 of file Macros.h.

◆ cpu_to_be16

#define cpu_to_be16 (   x)    ((be16)SWAP16((x)))

CPU byte order to big endian 16-bit.

Parameters
xInput integer.
Returns
be16 type integer.

Definition at line 198 of file ByteOrder.h.

◆ cpu_to_be32

#define cpu_to_be32 (   x)    ((be32)SWAP32((x)))

CPU byte order to big endian 32-bit.

Parameters
xInput integer.
Returns
be32 type integer.

Definition at line 180 of file ByteOrder.h.

◆ cpu_to_be64

#define cpu_to_be64 (   x)    ((be64)SWAP64((x)))

CPU byte order to big endian 64-bit.

Parameters
xInput integer.
Returns
be64 type integer.

Definition at line 162 of file ByteOrder.h.

◆ cpu_to_le16

#define cpu_to_le16 (   x)    ((le16)(u16)(x))

CPU byte order to little endian 16-bit.

Parameters
xInput integer.
Returns
le16 type integer.

Definition at line 144 of file ByteOrder.h.

◆ cpu_to_le32

#define cpu_to_le32 (   x)    ((le32)(u32)(x))

CPU byte order to little endian 32-bit.

Parameters
xInput integer.
Returns
le32 type integer.

Definition at line 126 of file ByteOrder.h.

◆ cpu_to_le64

#define cpu_to_le64 (   x)    ((le64)(u64)(x))

Integer conversion functions.

CPU byte order to little endian 64-bit.

Parameters
xInput integer.
Returns
le64 type integer.

Definition at line 108 of file ByteOrder.h.

◆ DEBUG

#define DEBUG (   msg)    MAKE_LOG(Log::Debug, "Debug", msg)

Output a debug message to standard output.

Parameters
msgThe debug message to output

Definition at line 89 of file Log.h.

◆ ERROR

#define ERROR (   msg)    MAKE_LOG(Log::Error, "Error", msg)

Output an error message.

Parameters
msgThe error message.

Definition at line 61 of file Log.h.

◆ FALSE

#define FALSE   0

Binary zero means false.

Definition at line 35 of file Macros.h.

◆ FATAL

#define FATAL (   msg)
Value:
{ \
MAKE_LOG(Log::Emergency, "Emergency", msg); \
if (Log::instance()) Log::instance()->terminate(); \
}

Output a critical message and terminate program immediatly.

Parameters
msgThe critical message.

Definition at line 50 of file Log.h.

◆ FNV_INIT

#define FNV_INIT   0x811c9dc5

Initial value of the FNV internal state.

Definition at line 36 of file HashFunction.h.

◆ FNV_PRIME

#define FNV_PRIME   16777619

Prime number used by FNV hashing.

Definition at line 33 of file HashFunction.h.

◆ GigaByte

#define GigaByte (   v)    ((v) * 1024 * 1024 * 1024)

Convert gigabytes to bytes.

Definition at line 60 of file Macros.h.

◆ INFO

#define INFO (   msg)    MAKE_LOG(Log::Info, "Info", msg)

Output a regular message to standard output.

Parameters
msgThe information message

Definition at line 82 of file Log.h.

◆ INT_MAX

#define INT_MAX   2147483647

Definition at line 74 of file Macros.h.

◆ INT_MIN

#define INT_MIN   -2147483647

Definition at line 72 of file Macros.h.

◆ IQUOTE

#define IQUOTE (   x)    QUOTE(x)

Indirect quoting.

Definition at line 50 of file Macros.h.

◆ KiloByte

#define KiloByte (   v)    ((v) * 1024)

Convert kilobytes to bytes.

Definition at line 54 of file Macros.h.

◆ le16_to_cpu

#define le16_to_cpu (   x)    ((u16)(le16)(x))

Little endian 16-bit to CPU byte order.

Parameters
xle16 type integer.
Returns
CPU byte ordered 16-bit integer.

Definition at line 153 of file ByteOrder.h.

◆ le32_to_cpu

#define le32_to_cpu (   x)    ((u32)(le32)(x))

Little endian 32-bit to CPU byte order.

Parameters
xle32 type integer.
Returns
CPU byte ordered 32-bit integer.

Definition at line 135 of file ByteOrder.h.

◆ le64_to_cpu

#define le64_to_cpu (   x)    ((u64)(le64)(x))

Little endian 64-bit to CPU byte order.

Parameters
xle64 type integer.
Returns
CPU byte ordered 64-bit integer.

Definition at line 117 of file ByteOrder.h.

◆ LONG_MAX

#define LONG_MAX   2147483647L

Maximum value of an object of type long int.

Definition at line 66 of file Macros.h.

◆ LONG_MIN

#define LONG_MIN   -2147483647L

Minimum value of an object of type long int.

Definition at line 63 of file Macros.h.

◆ MAKE_LOG

#define MAKE_LOG (   type,
  typestr,
  msg 
)
Value:
{\
if (Log::instance() && type <= Log::instance()->getMinimumLogLevel()) \
(*Log::instance()) << "[" typestr "] " << __FILE__ ":" << __LINE__ << " " << __FUNCTION__ << " -- " << msg << "\r\n"; \
}

Output a log line to the system log (syslog).

Parameters
typeLog level
typestrLog level string
msgMessage to output

Definition at line 39 of file Log.h.

◆ MegaByte

#define MegaByte (   v)    ((v) * 1024 * 1024)

Convert megabytes to bytes.

Definition at line 57 of file Macros.h.

◆ NOTICE

#define NOTICE (   msg)    MAKE_LOG(Log::Notice, "Notice", msg)

Output a notice message.

Parameters
msgThe notice message

Definition at line 75 of file Log.h.

◆ NULL

#define NULL   (void *)0

NULL means zero.

Definition at line 39 of file Macros.h.

◆ offsetof

#define offsetof (   TYPE,
  MEMBER 
)    ((Size) &((TYPE *)0)->MEMBER)

Calculates offsets in data structures.

Definition at line 129 of file Macros.h.

◆ PACKED

#define PACKED   __attribute__((__packed__))

Ensures strict minimum memory requirements.

This option effectively disabled extra padding by the compiler.

Definition at line 159 of file Macros.h.

◆ QUOTE

#define QUOTE (   x)    #x

Stringfies the given input.

Definition at line 46 of file Macros.h.

◆ SECTION

#define SECTION (   s)    __attribute__((__section__(s)))

Can be used to link a symbol inside a specific section.

Parameters
sSection name.

Definition at line 145 of file Macros.h.

◆ STRING_DEFAULT_SIZE

#define STRING_DEFAULT_SIZE   64

Default maximum length of a String's value.

Definition at line 36 of file String.h.

◆ SWAP16

#define SWAP16 (   x)
Value:
((u16)( \
(((u16)(x) & (u16)0x00ffU) << 8) | \
(((u16)(x) & (u16)0xff00U) >> 8)))

Byte swap functions.

Byte swap a 16-bit integer

Parameters
xInteger input
Returns
Byte-swapped integer value

Definition at line 56 of file ByteOrder.h.

◆ SWAP32

#define SWAP32 (   x)
Value:
((u32)( \
(((u32)(x) & (u32)0x000000ffUL) << 24) | \
(((u32)(x) & (u32)0x0000ff00UL) << 8) | \
(((u32)(x) & (u32)0x00ff0000UL) >> 8) | \
(((u32)(x) & (u32)0xff000000UL) >> 24)))

Byte swap a 32-bit integer.

Parameters
xInteger input
Returns
Byte-swapped integer value

Definition at line 68 of file ByteOrder.h.

◆ SWAP64

#define SWAP64 (   x)
Value:
((u64)( \
(((u64)(x) & (u64)0x00000000000000ffUL) << 56) | \
(((u64)(x) & (u64)0x000000000000ff00UL) << 40) | \
(((u64)(x) & (u64)0x0000000000ff0000UL) << 24) | \
(((u64)(x) & (u64)0x00000000ff000000UL) << 8) | \
(((u64)(x) & (u64)0x000000ff00000000UL) >> 8) | \
(((u64)(x) & (u64)0x0000ff0000000000UL) >> 24) | \
(((u64)(x) & (u64)0x00ff000000000000UL) >> 40) | \
(((u64)(x) & (u64)0xff00000000000000UL) >> 56)))

Byte swap a 64-bit integer.

Parameters
xInteger input
Returns
Byte-swapped integer value

Definition at line 82 of file ByteOrder.h.

◆ TRUE

#define TRUE   1

Binary 1 means true.

Definition at line 32 of file Macros.h.

◆ UINT_MAX

#define UINT_MAX   4294967295U

Definition at line 78 of file Macros.h.

◆ UINT_MIN

#define UINT_MIN   0U

Definition at line 76 of file Macros.h.

◆ ULONG_MAX

#define ULONG_MAX   4294967295LU

Definition at line 70 of file Macros.h.

◆ ULONG_MIN

#define ULONG_MIN   0LU

Definition at line 68 of file Macros.h.

◆ USED

#define USED   __attribute__((__used__))

Declares an symbol to be forcibly "used".

Definition at line 151 of file Macros.h.

◆ VECTOR_DEFAULT_SIZE

#define VECTOR_DEFAULT_SIZE   64

Default size of an Vector.

Definition at line 36 of file Vector.h.

◆ WARNING

#define WARNING (   msg)    MAKE_LOG(Log::Warning, "Warning", msg)

Output a warning message.

Parameters
msgThe warning message.

Definition at line 68 of file Log.h.

◆ ZERO

#define ZERO   0

Zero value.

Definition at line 43 of file Macros.h.

Typedef Documentation

◆ Address

typedef unsigned long Address

A memory address.

Definition at line 131 of file Types.h.

◆ be16

typedef u16 BITWISE be16

Unsigned 16-bit big endian number.

Definition at line 115 of file Types.h.

◆ be32

typedef u32 BITWISE be32

Unsigned 32-bit big endian number.

Definition at line 109 of file Types.h.

◆ be64

typedef u64 BITWISE be64

Unsigned 64-bit big endian number.

Definition at line 103 of file Types.h.

◆ be8

typedef u8 BITWISE be8

Unsigned 8-bit big endian number.

Definition at line 121 of file Types.h.

◆ DeviceID

typedef struct DeviceID DeviceID

Describes a device ID number.

◆ Error

typedef slong Error

Error code defined in Error.h.

See also
Error.h

Definition at line 159 of file Types.h.

◆ GroupID

typedef unsigned short GroupID

Group Identity.

Definition at line 137 of file Types.h.

◆ le16

typedef u16 BITWISE le16

Unsigned 16-bit little endian number.

Definition at line 112 of file Types.h.

◆ le32

typedef u32 BITWISE le32

Unsigned 32-bit little endian number.

Definition at line 106 of file Types.h.

◆ le64

typedef u64 BITWISE le64

Unsigned 64-bit little endian number.

Definition at line 100 of file Types.h.

◆ le8

typedef u8 BITWISE le8

Unsigned 8-bit little endian number.

Definition at line 118 of file Types.h.

◆ ProcessID

typedef u32 ProcessID

Process Identification Number.

Definition at line 140 of file Types.h.

◆ s16

typedef signed short int s16

Signed 16-bit number.

Definition at line 83 of file Types.h.

◆ s32

typedef signed int s32

Signed 32-bit number.

Definition at line 80 of file Types.h.

◆ s64

typedef signed long long s64

Signed 64-bit number.

Definition at line 77 of file Types.h.

◆ s8

typedef signed char s8

Signed 8-bit number.

Definition at line 86 of file Types.h.

◆ sint

typedef signed int sint

Signed integer number.

Definition at line 71 of file Types.h.

◆ Size

typedef unsigned int Size

Any sane size indicator cannot go negative.

Definition at line 128 of file Types.h.

◆ slong

typedef signed long slong

Signed long number.

Definition at line 74 of file Types.h.

◆ u16

typedef unsigned short u16

Unsigned 16-bit number.

Definition at line 56 of file Types.h.

◆ u32

typedef unsigned int u32

Unsigned 32-bit number.

Definition at line 53 of file Types.h.

◆ u64

typedef unsigned long long u64

Unsigned 64-bit number.

Definition at line 50 of file Types.h.

◆ u8

typedef unsigned char u8

Unsigned 8-bit number.

Definition at line 59 of file Types.h.

◆ uint

typedef unsigned int uint

Unsigned integer number.

Definition at line 44 of file Types.h.

◆ ulong

typedef unsigned long ulong

Unsigned long number.

Definition at line 47 of file Types.h.

◆ UserID

typedef unsigned short UserID

User Identity.

Definition at line 134 of file Types.h.

Function Documentation

◆ doubleAbsolute()

double doubleAbsolute ( double  number)
inline

Absolute value of a double.

Parameters
numberInput number
Returns
Absolute value

Definition at line 113 of file Macros.h.

Referenced by doubleEquals().

◆ doubleEquals()

bool doubleEquals ( double  a,
double  b,
double  epsilon 
)
inline

Compare two doubles using a epsilon number as precision indicator.

Definition at line 121 of file Macros.h.

References doubleAbsolute().

◆ hash() [1/2]

Size hash ( const String key,
Size  mod 
)

◆ hash() [2/2]

Size hash ( int  key,
Size  mod 
)

Compute a hash using the FNV algorithm.

Parameters
keyInteger key to hash.
modModulo value.
Returns
Computed hash.

Definition at line 36 of file HashFunction.cpp.

References assert, FNV_INIT, and FNV_PRIME.

◆ isPowerOfTwo()

bool isPowerOfTwo ( unsigned  number)
inline

Check if a number is power of two.

Parameters
numberInput number
Returns
True if power of two, false otherwise.

Definition at line 101 of file Macros.h.

Referenced by PoolAllocator::calculateObjectCount().

◆ operator&()

template<class T >
T operator& ( a,
b 
)
inline

Definition at line 31 of file BitOperations.h.

◆ operator&=()

template<class T >
T& operator&= ( T &  a,
b 
)
inline

Definition at line 34 of file BitOperations.h.

◆ operator<<() [1/6]

Log& operator<< ( Log log,
const char *  str 
)

Definition at line 87 of file Log.cpp.

References Log::append().

◆ operator<<() [2/6]

Log& operator<< ( Log log,
const char  character 
)

Definition at line 100 of file Log.cpp.

References Log::append().

◆ operator<<() [3/6]

Log& operator<< ( Log log,
int  number 
)

Definition at line 93 of file Log.cpp.

References Log::append().

◆ operator<<() [4/6]

Log& operator<< ( Log log,
unsigned long  number 
)

Definition at line 114 of file Log.cpp.

References Log::append().

◆ operator<<() [5/6]

Log& operator<< ( Log log,
unsigned  number 
)

Definition at line 107 of file Log.cpp.

References Log::append().

◆ operator<<() [6/6]

Log& operator<< ( Log log,
void *  ptr 
)

Definition at line 121 of file Log.cpp.

References Log::append(), and Number::Hex.

◆ operator^()

template<class T >
T operator^ ( a,
b 
)
inline

Definition at line 32 of file BitOperations.h.

◆ operator^=()

template<class T >
T& operator^= ( T &  a,
b 
)
inline

Definition at line 35 of file BitOperations.h.

◆ operator|()

template<class T >
T operator| ( a,
b 
)
inline

Definition at line 30 of file BitOperations.h.

◆ operator|=()

template<class T >
T& operator|= ( T &  a,
b 
)
inline

Definition at line 33 of file BitOperations.h.

◆ operator~()

template<class T >
T operator~ ( a)
inline

Definition at line 29 of file BitOperations.h.

◆ read16()

const u16 read16 ( const void *  data)
inline

Read 16-bit integer (no conversion)

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 16-bit integer

Definition at line 256 of file ByteOrder.h.

References MemoryBlock::copy().

Referenced by UDP::calculateSum(), and IPV4::checksum().

◆ read32()

const u32 read32 ( const void *  data)
inline

Read 32-bit integer (no conversion)

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 32-bit integer

Definition at line 242 of file ByteOrder.h.

References MemoryBlock::copy().

Referenced by UDP::checksum().

◆ read64()

const u64 read64 ( const void *  data)
inline

Memory read/write functions.

Note
These functions support unaligned memory pointers Read 64-bit integer (no conversion)
Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 64-bit integer

Definition at line 228 of file ByteOrder.h.

References MemoryBlock::copy().

◆ read8()

const u8 read8 ( const void *  data)
inline

Read 8-bit integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 8-bit integer

Definition at line 270 of file ByteOrder.h.

References MemoryBlock::copy().

Referenced by UDP::calculateSum().

◆ readBe16()

const u16 readBe16 ( const void *  data)
inline

Read 16-bit big endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 16-bit integer

Definition at line 398 of file ByteOrder.h.

References be16_to_cpu, and MemoryBlock::copy().

Referenced by IPV4::checksum(), Ethernet::process(), ARP::process(), UDPSocket::read(), and ICMP::sendPacket().

◆ readBe32()

const u32 readBe32 ( const void *  data)
inline

Read 32-bit big endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 32-bit integer

Definition at line 384 of file ByteOrder.h.

References be32_to_cpu, and MemoryBlock::copy().

Referenced by ICMP::process(), ARP::process(), IPV4::process(), UDPSocket::read(), and DhcpClient::receiveBootResponse().

◆ readBe64()

const u64 readBe64 ( const void *  data)
inline

Read 64-bit big endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 64-bit integer

Definition at line 370 of file ByteOrder.h.

References be64_to_cpu, and MemoryBlock::copy().

◆ readLe16()

const u16 readLe16 ( const void *  data)
inline

Read 16-bit little endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 16-bit integer

Definition at line 356 of file ByteOrder.h.

References MemoryBlock::copy(), and le16_to_cpu.

Referenced by Lz4Decompressor::decompress().

◆ readLe32()

const u32 readLe32 ( const void *  data)
inline

Read 32-bit little endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 32-bit integer

Definition at line 342 of file ByteOrder.h.

References MemoryBlock::copy(), and le32_to_cpu.

Referenced by Lz4Decompressor::initialize(), and Lz4Decompressor::read().

◆ readLe64()

const u64 readLe64 ( const void *  data)
inline

Read 64-bit little endian integer.

Parameters
dataMemory pointer, which can be unaligned.
Returns
Unsigned 64-bit integer

Definition at line 328 of file ByteOrder.h.

References MemoryBlock::copy(), and le64_to_cpu.

Referenced by Lz4Decompressor::initialize().

◆ write16()

void write16 ( void *  data,
const u16  input 
)
inline

Write 16-bit integer (no conversion)

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 305 of file ByteOrder.h.

References MemoryBlock::copy().

Referenced by UDP::sendPacket(), and ICMP::sendPacket().

◆ write32()

void write32 ( void *  data,
const u32  input 
)
inline

Write 32-bit integer (no conversion)

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 294 of file ByteOrder.h.

References MemoryBlock::copy().

◆ write64()

void write64 ( void *  data,
const u64  input 
)
inline

Write 64-bit integer (no conversion)

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 283 of file ByteOrder.h.

References MemoryBlock::copy().

◆ write8()

void write8 ( void *  data,
const u8  input 
)
inline

Write 8-bit integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 316 of file ByteOrder.h.

References MemoryBlock::copy().

◆ writeBe16()

void writeBe16 ( void *  data,
const u16  input 
)
inline

Write 16-bit big endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 471 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_be16.

Referenced by UDP::checksum(), Ethernet::getTransmitPacket(), IPV4::getTransmitPacket(), UDP::sendPacket(), ARP::sendReply(), and ARP::sendRequest().

◆ writeBe32()

void writeBe32 ( void *  data,
const u32  input 
)
inline

Write 32-bit big endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 459 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_be32.

Referenced by IPV4::getTransmitPacket(), DhcpClient::sendBootRequest(), ARP::sendReply(), and ARP::sendRequest().

◆ writeBe64()

void writeBe64 ( void *  data,
const u64  input 
)
inline

Write 64-bit big endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 447 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_be64.

◆ writeLe16()

void writeLe16 ( void *  data,
const u16  input 
)
inline

Write 16-bit little endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 435 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_le16.

◆ writeLe32()

void writeLe32 ( void *  data,
const u32  input 
)
inline

Write 32-bit little endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 423 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_le32.

◆ writeLe64()

void writeLe64 ( void *  data,
const u64  input 
)
inline

Write 64-bit little endian integer.

Parameters
dataMemory pointer to write to, which can be unaligned.
inputInput integer

Definition at line 411 of file ByteOrder.h.

References MemoryBlock::copy(), and cpu_to_le64.

Variable Documentation

◆ m_instance

template<class T >
T * WeakSingleton< T >::m_instance = 0
staticprivate

One and only instance.

Definition at line 94 of file Singleton.h.

Referenced by WeakSingleton< Log >::instance(), and WeakSingleton< Log >::WeakSingleton().

Log::Emergency
@ Emergency
Definition: Log.h:108
Log
Logging class.
Definition: Log.h:96
u64
unsigned long long u64
Unsigned 64-bit number.
Definition: Types.h:50
QUOTE
#define QUOTE(x)
Stringfies the given input.
Definition: Macros.h:46
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
WeakSingleton< Log >::instance
static Log * instance()
Retrieve the instance.
Definition: Singleton.h:86
type
u8 type
Definition: IntelACPI.h:63