#include "tdsystem.h"
#include "tdstrings.h"
#include "tools.icc"
Go to the source code of this file.
Functions |
void | debug (const char *string) |
card64 | getMicroTime () |
card16 | translate16 (const card16 x) |
card32 | translate32 (const card32 x) |
card64 | translate64 (const card64 x) |
card64 | translateToBinary (const double x) |
double | translateToDouble (const card64 x) |
cardinal | calculatePacketsPerSecond (const cardinal payloadBytesPerSecond, const cardinal framesPerSecond, const cardinal maxPacketSize, const cardinal headerLength) |
cardinal | calculateBytesPerSecond (const cardinal payloadBytesPerSecond, const cardinal framesPerSecond, const cardinal maxPacketSize, const cardinal headerLength) |
bool | scanURL (const String &location, String &protocol, String &host, String &path) |
bool | getUserName (char *str, const size_t size, const bool realName=false, const uid_t uid=getuid()) |
template<class T > |
void | quickSort (T *array, const integer start, const integer end) |
template<class T > |
void | quickSortPtr (T *array, const integer start, const integer end, bool(*lt)(T, T), bool(*gt)(T, T)) |
template<class T > |
void | quickSortGroupPtr (T *array, const integer start, const integer end, bool(*lt)(T, T), bool(*gt)(T, T), bool(*geq)(T, T)) |
template<class T > |
cardinal | removeDuplicates (T *array, const cardinal length) |
void | printTimeStamp (std::ostream &os=std::cout) |
Function Documentation
Calculate frames per second.
Asumption: Every frame has it's own packets.
- Parameters:
-
payloadBytesPerSecond | Byte rate of payload data. |
framesPerSecond | Frame rate. |
maxPacketSize | Maximum size of a packet. |
headerLength | Length of header for each frame. |
- Returns:
- Total frames per second.
Calculate packets per second.
Asumption: Every frame has it's own packets.
- Parameters:
-
payloadBytesPerSecond | Byte rate of payload data. |
framesPerSecond | Frame rate. |
maxPacketSize | Maximum size of a packet. |
headerLength | Length of header for each frame. |
- Returns:
- Total bytes per second.
void debug |
( |
const char * |
string | ) |
[inline] |
Debug output.
- Parameters:
-
string | Debug string to be written to cerr. |
Get microseconds since January 01, 1970.
- Returns:
- Microseconds since January 01, 1970.
bool getUserName |
( |
char * |
str, |
|
|
const size_t |
size, |
|
|
const bool |
realName = false , |
|
|
const uid_t |
uid = getuid() |
|
) |
| |
Get user name for given user ID.
- Parameters:
-
str | Buffer to store name to. |
size | Size of buffer. |
realName | true to get real name (e.g. John Miller); false to get user name (e.g. jmiller). |
uid | User ID. |
- Returns:
- true for success; false otherwise.
Print time stamp (date and time) to given output stream.
- Parameters:
-
Sort array using QuickSort algorithm.
- Parameters:
-
array | Array to be sorted. |
start | Start offset in array. |
end | End offset in array. |
Sort pointer array using QuickSort algorithm.
- Parameters:
-
array | Array to be sorted. |
start | Start offset in array. |
end | End offset in array. |
lt | Less than comparision routine for sorting. |
gt | Greater than comparision routine for sorting. |
geq | Equal routine for separation of groups. |
Sort pointer array using QuickSort algorithm.
- Parameters:
-
array | Array to be sorted. |
start | Start offset in array. |
end | End offset in array. |
lt | Less than comparision routine. |
gt | Greater than comparision routine. |
Remove duplicates from *sorted* array.
- Parameters:
-
array | Array to be sorted. |
length | Length of array. |
Scan protocol, host and path from an URL string. The protocol my be missing, if the String "protocol" is initialized with a default.
- Parameters:
-
location | String with URL. |
protocol | Place to store the protocol name. |
host | Place to store the host name. |
path | Place to store the path. |
- Returns:
- true on success; false otherwise.
Translate 16-bit value to network byte order.
- Parameters:
-
- Returns:
- Translated value.
Translate 32-bit value to network byte order.
- Parameters:
-
- Returns:
- Translated value.
Translate 64-bit value to network byte order.
- Parameters:
-
- Returns:
- Translated value.
Translate double to 64-bit binary.
- Parameters:
-
- Returns:
- Translated value.
Translate 64-bit binary to double.
- Parameters:
-
- Returns:
- Translated value.