FreeNOS
|
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 > | |
T | operator~ (T a) |
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) |
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 | |
Log & | operator<< (Log &log, const char *str) |
Log & | operator<< (Log &log, int number) |
Log & | operator<< (Log &log, const char character) |
Log & | operator<< (Log &log, unsigned number) |
Log & | operator<< (Log &log, unsigned long number) |
Log & | operator<< (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. | |
| |
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... | |
Contains standard algorithms and datastructures for generic programming.
#define ALIGN | ( | n | ) | __attribute__((aligned(n))) |
#define assert | ( | exp | ) |
Big endian 16-bit to CPU byte order.
x | be16 type integer. |
Definition at line 207 of file ByteOrder.h.
Big endian 32-bit to CPU byte order.
x | be32 type integer. |
Definition at line 189 of file ByteOrder.h.
Big endian 64-bit to CPU byte order.
x | be64 type integer. |
Definition at line 171 of file ByteOrder.h.
#define BITWISE |
Restrict bit operations.
#define CEIL | ( | number, | |
divisor | |||
) |
CPU byte order to big endian 16-bit.
x | Input integer. |
Definition at line 198 of file ByteOrder.h.
CPU byte order to big endian 32-bit.
x | Input integer. |
Definition at line 180 of file ByteOrder.h.
CPU byte order to big endian 64-bit.
x | Input integer. |
Definition at line 162 of file ByteOrder.h.
CPU byte order to little endian 16-bit.
x | Input integer. |
Definition at line 144 of file ByteOrder.h.
CPU byte order to little endian 32-bit.
x | Input integer. |
Definition at line 126 of file ByteOrder.h.
Integer conversion functions.
CPU byte order to little endian 64-bit.
x | Input integer. |
Definition at line 108 of file ByteOrder.h.
#define DEBUG | ( | msg | ) | MAKE_LOG(Log::Debug, "Debug", msg) |
#define ERROR | ( | msg | ) | MAKE_LOG(Log::Error, "Error", msg) |
#define FATAL | ( | msg | ) |
Output a critical message and terminate program immediatly.
msg | The critical message. |
#define FNV_INIT 0x811c9dc5 |
Initial value of the FNV internal state.
Definition at line 36 of file HashFunction.h.
#define FNV_PRIME 16777619 |
Prime number used by FNV hashing.
Definition at line 33 of file HashFunction.h.
#define GigaByte | ( | v | ) | ((v) * 1024 * 1024 * 1024) |
#define KiloByte | ( | v | ) | ((v) * 1024) |
Little endian 16-bit to CPU byte order.
x | le16 type integer. |
Definition at line 153 of file ByteOrder.h.
Little endian 32-bit to CPU byte order.
x | le32 type integer. |
Definition at line 135 of file ByteOrder.h.
Little endian 64-bit to CPU byte order.
x | le64 type integer. |
Definition at line 117 of file ByteOrder.h.
#define LONG_MAX 2147483647L |
#define LONG_MIN -2147483647L |
#define MAKE_LOG | ( | type, | |
typestr, | |||
msg | |||
) |
Output a log line to the system log (syslog).
#define MegaByte | ( | v | ) | ((v) * 1024 * 1024) |
#define NOTICE | ( | msg | ) | MAKE_LOG(Log::Notice, "Notice", msg) |
#define offsetof | ( | TYPE, | |
MEMBER | |||
) | ((Size) &((TYPE *)0)->MEMBER) |
#define PACKED __attribute__((__packed__)) |
#define SECTION | ( | s | ) | __attribute__((__section__(s))) |
#define STRING_DEFAULT_SIZE 64 |
#define SWAP16 | ( | x | ) |
#define SWAP32 | ( | x | ) |
Byte swap a 32-bit integer.
x | Integer input |
Definition at line 68 of file ByteOrder.h.
#define SWAP64 | ( | x | ) |
Byte swap a 64-bit integer.
x | Integer input |
Definition at line 82 of file ByteOrder.h.
#define USED __attribute__((__used__)) |
#define WARNING | ( | msg | ) | MAKE_LOG(Log::Warning, "Warning", msg) |
typedef unsigned int Size |
|
inline |
Absolute value of a double.
number | Input number |
Definition at line 113 of file Macros.h.
Referenced by doubleEquals().
|
inline |
Compare two doubles using a epsilon number as precision indicator.
Definition at line 121 of file Macros.h.
References doubleAbsolute().
Compute a hash using the FNV algorithm.
key | Key string to hash. |
mod | Modulo value. |
Definition at line 21 of file HashFunction.cpp.
References assert, FNV_INIT, FNV_PRIME, and String::length().
Referenced by HashTable< String, FileCache * >::append(), HashTable< String, FileCache * >::at(), HashTable< String, FileCache * >::get(), HashTable< String, FileCache * >::insert(), HashTable< String, FileCache * >::remove(), HashTable< String, FileCache * >::value(), and HashTable< String, FileCache * >::values().
Compute a hash using the FNV algorithm.
key | Integer key to hash. |
mod | Modulo value. |
Definition at line 36 of file HashFunction.cpp.
|
inline |
Check if a number is power of two.
number | Input number |
Definition at line 101 of file Macros.h.
Referenced by PoolAllocator::calculateObjectCount().
|
inline |
Definition at line 31 of file BitOperations.h.
|
inline |
Definition at line 34 of file BitOperations.h.
Definition at line 87 of file Log.cpp.
References Log::append().
Definition at line 100 of file Log.cpp.
References Log::append().
Definition at line 93 of file Log.cpp.
References Log::append().
Definition at line 114 of file Log.cpp.
References Log::append().
Definition at line 107 of file Log.cpp.
References Log::append().
Definition at line 121 of file Log.cpp.
References Log::append(), and Number::Hex.
|
inline |
Definition at line 32 of file BitOperations.h.
|
inline |
Definition at line 35 of file BitOperations.h.
|
inline |
Definition at line 30 of file BitOperations.h.
|
inline |
Definition at line 33 of file BitOperations.h.
|
inline |
Definition at line 29 of file BitOperations.h.
|
inline |
Read 16-bit integer (no conversion)
data | Memory pointer, which can be unaligned. |
Definition at line 256 of file ByteOrder.h.
References MemoryBlock::copy().
Referenced by UDP::calculateSum(), and IPV4::checksum().
|
inline |
Read 32-bit integer (no conversion)
data | Memory pointer, which can be unaligned. |
Definition at line 242 of file ByteOrder.h.
References MemoryBlock::copy().
Referenced by UDP::checksum().
|
inline |
Memory read/write functions.
data | Memory pointer, which can be unaligned. |
Definition at line 228 of file ByteOrder.h.
References MemoryBlock::copy().
|
inline |
Read 8-bit integer.
data | Memory pointer, which can be unaligned. |
Definition at line 270 of file ByteOrder.h.
References MemoryBlock::copy().
Referenced by UDP::calculateSum().
|
inline |
Read 16-bit big endian integer.
data | Memory pointer, which can be unaligned. |
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().
|
inline |
Read 32-bit big endian integer.
data | Memory pointer, which can be unaligned. |
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().
|
inline |
Read 64-bit big endian integer.
data | Memory pointer, which can be unaligned. |
Definition at line 370 of file ByteOrder.h.
References be64_to_cpu, and MemoryBlock::copy().
|
inline |
Read 16-bit little endian integer.
data | Memory pointer, which can be unaligned. |
Definition at line 356 of file ByteOrder.h.
References MemoryBlock::copy(), and le16_to_cpu.
Referenced by Lz4Decompressor::decompress().
|
inline |
Read 32-bit little endian integer.
data | Memory pointer, which can be unaligned. |
Definition at line 342 of file ByteOrder.h.
References MemoryBlock::copy(), and le32_to_cpu.
Referenced by Lz4Decompressor::initialize(), and Lz4Decompressor::read().
|
inline |
Read 64-bit little endian integer.
data | Memory pointer, which can be unaligned. |
Definition at line 328 of file ByteOrder.h.
References MemoryBlock::copy(), and le64_to_cpu.
Referenced by Lz4Decompressor::initialize().
|
inline |
Write 16-bit integer (no conversion)
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 305 of file ByteOrder.h.
References MemoryBlock::copy().
Referenced by UDP::sendPacket(), and ICMP::sendPacket().
|
inline |
Write 32-bit integer (no conversion)
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 294 of file ByteOrder.h.
References MemoryBlock::copy().
|
inline |
Write 64-bit integer (no conversion)
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 283 of file ByteOrder.h.
References MemoryBlock::copy().
|
inline |
Write 8-bit integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 316 of file ByteOrder.h.
References MemoryBlock::copy().
|
inline |
Write 16-bit big endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input 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().
|
inline |
Write 32-bit big endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input 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().
|
inline |
Write 64-bit big endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 447 of file ByteOrder.h.
References MemoryBlock::copy(), and cpu_to_be64.
|
inline |
Write 16-bit little endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 435 of file ByteOrder.h.
References MemoryBlock::copy(), and cpu_to_le16.
|
inline |
Write 32-bit little endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 423 of file ByteOrder.h.
References MemoryBlock::copy(), and cpu_to_le32.
|
inline |
Write 64-bit little endian integer.
data | Memory pointer to write to, which can be unaligned. |
input | Input integer |
Definition at line 411 of file ByteOrder.h.
References MemoryBlock::copy(), and cpu_to_le64.
|
staticprivate |
One and only instance.
Definition at line 94 of file Singleton.h.
Referenced by WeakSingleton< Log >::instance(), and WeakSingleton< Log >::WeakSingleton().