Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

PLM Namespace Reference

PLMBase main namespace. More...


Enumerations

enum  Direction
enum  Alignment
enum  Deletion { DEL_NONE = 0, DEL_SIMPLE = 1, DEL_ARRAY = 2 }
enum  SortFlags {
  SORT_NONE = 0, SORT_NAME = 0x1, SORT_SIZE = 0x2, SORT_DATE = 0x3,
  SORT_EXT = 0x4, SORT_REVERSE = 0x10, SORT_CASE = 0x20, SORT_DIRS = 0x40
}
enum  
enum  LogLevel {
  LOGLVL_NONE = 0, LOGLVL_ERROR = 1, LOGLVL_WARNING = 10, LOGLVL_NORMAL = 100,
  LOGLVL_DEBUG = 200, LOGLVL_ALL = 255
}
enum  LogTarget { LOGTGT_STDOUT, LOGTGT_STDERR, LOGTGT_FILE }

Functions

PLMColor RGBA (u8 r, u8 g, u8 b, u8 a)
PLMColor RGBA (u8 *rgba)
PLMColor RGB (u8 r, u8 g, u8 b)
PLMColor RGB (u8 *rgb)
u8 R (PLMColor c)
u8 G (PLMColor c)
u8 B (PLMColor c)
u8 A (PLMColor c)
PLMDLL const PLMVersionVersionv ()
PLMDLL int Versioni ()
PLMDLL const char * Versiont ()
u16 SWAP16 (u16 X)
u32 SWAP32 (u32 X)
float SWAPFL (float X)
double SWAPDBL (double D)
u16 TOLE16 (u16 X)
u32 TOLE32 (u32 X)
float TOLEFL (float X)
double TOLEDBL (double X)
u16 TOBE16 (u16 X)
u32 TOBE32 (u32 X)
float TOBEFL (float X)
double TOBEDBL (double X)
u16 HTON16 (u16 X)
u32 HTON32 (u32 X)
float HTONFL (float X)
double HTONDBL (double X)
u16 NTOH16 (u16 X)
u32 NTOH32 (u32 X)
float NTOHFL (float X)
double NTOHDBL (double X)
PLMDLL void SetLogLevel (unsigned int level)
PLMDLL unsigned int GetLogLevel ()
PLMDLL bool SetLogTarget (unsigned int type, const char *file=0)
PLMDLL unsigned int GetLogTarget ()
PLMDLL void LOGL (unsigned int level, const char *format,...)
PLMDLL void ERROR (const char *format,...)
PLMDLL void WARNING (const char *format,...)
PLMDLL void LOG (const char *format,...)
PLMDLL void DBG (const char *format,...)
PLMDLL void CloseLog ()
PLMDLL bool Equalf (float a, float b, float epsilon=PLM::EPSILON)
PLMDLL bool Equald (double a, double b, double epsilon=PLM::EPSILON)
PLMDLL float Angle2PI (float a)
PLMDLL float VectorAngle (float x1, float y1, float x2, float y2)
PLMDLL float AngleDiff (float angle1, float angle2)
PLMDLL void RandomInit (u32 seed=0)
PLMDLL u32 Randomi ()
PLMDLL u32 Randomi (u32 max)
PLMDLL float Randomf ()
PLMDLL float Randomf (float maxf)

Variables

const char PATH_SEP = '/'
const char *const PATH_SEP_STR = "/"
const char PATHLIST_SEP = ':'
const u32 PATH_LEN = 1024


Detailed Description

PLMBase main namespace.

Defines some global typedefs and enums.


Enumeration Type Documentation

enum PLM::Direction
 

Directions.

enum PLM::Alignment
 

Position and alignment constants.

enum PLM::Deletion
 

Memory management in data structures (on destruction and remove).

Enumeration values:
DEL_NONE  no delete
DEL_SIMPLE  delete a normal object
DEL_ARRAY  delete an array

enum PLM::SortFlags
 

Sorting options.

Enumeration values:
SORT_NONE  no specific order (only)
SORT_NAME  sort by name (only)
SORT_SIZE  sort by size (only)
SORT_DATE  sort by date (only)
SORT_EXT  sort by extension (only)
SORT_REVERSE  reverse order (flag)
SORT_CASE  case sensitive (flag)
SORT_DIRS  put all directories first (flag)

anonymous enum
 

Error value returned by some container classes, or used as a default argument value.

enum PLM::LogLevel
 

Log output level.

Enumeration values:
LOGLVL_NONE  ignore all messages
LOGLVL_ERROR  only print error messages
LOGLVL_WARNING  only print errors and warnings
LOGLVL_NORMAL  only print normal messages and errors/warnings
LOGLVL_DEBUG  also print debug messages
LOGLVL_ALL  print all messages

enum PLM::LogTarget
 

Log target types.

Enumeration values:
LOGTGT_STDOUT  output = standard console
LOGTGT_STDERR  output = error console
LOGTGT_FILE  output = given file


Function Documentation

PLMColor RGBA u8    r,
u8    g,
u8    b,
u8    a
[inline]
 

Build a 32-bits color from 8-bits Red, Green, Blue and Alpha components (0-255).

PLMColor RGBA u8 *    rgba [inline]
 

Build a 32-bits color from 8-bits Red, Green, Blue and Alpha components (0-255).

PLMColor RGB u8    r,
u8    g,
u8    b
[inline]
 

Build a 32-bits color from 8-bits Red, Green and Blue components (0-255).

PLMColor RGB u8 *    rgb [inline]
 

Build a 32-bits color from 8-bits Red, Green and Blue components (0-255).

u8 R PLMColor    c [inline]
 

Extract the red component from a 32-bits color.

u8 G PLMColor    c [inline]
 

Extract the green component from a 32-bits color.

u8 B PLMColor    c [inline]
 

Extract the blue component from a 32-bits color.

u8 A PLMColor    c [inline]
 

Extract the alpha component from a 32-bits color.

PLMDLL const PLMVersion* Versionv  
 

Get the run time version of the library (in a static struct, never modify).

PLMDLL int Versioni  
 

Get the run time version of the library (as an integer of the form "10203" for version 1.2.3).

PLMDLL const char* Versiont  
 

Get the run time version of the library (text format = "x.y.z" z may have 2 digits).

u16 SWAP16 u16    X [inline]
 

Swap the two bytes of a 16 bits integer (ab -> ba).

u32 SWAP32 u32    X [inline]
 

Swap the four bytes of a 32 bits integer (abcd -> dcba).

float SWAPFL float    X [inline]
 

Swap the four bytes of a standard float (abcd -> dcba).

double SWAPDBL double    D [inline]
 

Swap the 8 bytes of a double float (abcdefgh -> hgfedcba).

u16 TOLE16 u16    X [inline]
 

Convert a 16 bits integer into Little Endian format (do nothing on a LE system).

u32 TOLE32 u32    X [inline]
 

Convert a 32 bits integer into Little Endian format (do nothing on a LE system).

float TOLEFL float    X [inline]
 

Convert a float into Little Endian format (do nothing on a LE system).

double TOLEDBL double    X [inline]
 

Convert a double into Little Endian format (do nothing on a LE system).

u16 TOBE16 u16    X [inline]
 

Convert a 16 bits integer into Big Endian format (do nothing on a BE system).

u32 TOBE32 u32    X [inline]
 

Convert a 32 bits integer into Big Endian format (do nothing on a BE system).

float TOBEFL float    X [inline]
 

Convert a float into Big Endian format (do nothing on a BE system).

double TOBEDBL double    X [inline]
 

Convert a double into Big Endian format (do nothing on a BE system).

u16 HTON16 u16    X [inline]
 

Convert a 16 bits integer into Network byte order.

u32 HTON32 u32    X [inline]
 

Convert a 32 bits integer into Network byte order.

float HTONFL float    X [inline]
 

Convert a float into Network byte order.

double HTONDBL double    X [inline]
 

Convert a double into Network byte order.

u16 NTOH16 u16    X [inline]
 

Convert a 16 bits integer into system (Host) byte order (from Network).

u32 NTOH32 u32    X [inline]
 

Convert a 32 bits integer into system (Host) byte order (from Network).

float NTOHFL float    X [inline]
 

Convert a float into system (Host) byte order (from Network).

double NTOHDBL double    X [inline]
 

Convert a double into system (Host) byte order (from Network).

PLMDLL void SetLogLevel unsigned int    level
 

Change the current output level.

The level controls which messages are displayed and which are ignored. Only log messages with a level equal or smaller than the current level will be displayed. Use LogLevel enum for level, default level is LVL_NORMAL, or LVL_DEBUG if DEBUG macro is defined. Any value between 0 (LOGLVL_ALL) and 255 (LOGLVL_NONE) can be used as long as you know what you do.

PLMDLL unsigned int GetLogLevel  
 

Get the current level of output. Usually one of the LogLevel enums.

PLMDLL bool SetLogTarget unsigned int    type,
const char *    file = 0
 

Change the output target.

Parameters:
type  the type of target to use, use one of the LogTarget enums. A file must be provided for type LOGTGT_FILE (preferably with complete path). In this case, if another file is already in use, it is closed properly. Note that you can not combine many targets, only one can be selected.
file  a filename to use as output if type is LOGTGT_FILE.
Returns:
true on success, false usually means that a file error happend, the type is then set to LOGTGT_STDOUT.

PLMDLL unsigned int GetLogTarget  
 

Get the current output target, as a LogTarget enum.

PLMDLL void LOGL unsigned int    level,
const char *    format,
...   
 

Print a message on the current output (flushed).

No carriage return is added.

Parameters:
level  the level of the message, see SetLogLevel() for details. Use a LogLevel value.
format  the content of the message, as a printf format string. You can then provide additionnal arguments, based on the data types you specified in the format string.

PLMDLL void ERROR const char *    format,
...   
 

Add an error level message to the current output (flushed). No carriage return is added.

PLMDLL void WARNING const char *    format,
...   
 

Add a warning level message to the current output (flushed). No carriage return is added.

PLMDLL void LOG const char *    format,
...   
 

Add a normal level message to the current output (flushed). No carriage return is added.

PLMDLL void DBG const char *    format,
...   
 

Add a debug level message to the current output (flushed). No carriage return is added.

PLMDLL void CloseLog  
 

This function should only be called once, usually at the very end of the program.

PLMDLL bool Equalf float    a,
float    b,
float    epsilon = PLM::EPSILON
 

Compare two floats, return true if their difference is smaller than epsilon.

PLMDLL bool Equald double    a,
double    b,
double    epsilon = PLM::EPSILON
 

Compare two doubles, return true if their difference is smaller than epsilon.

PLMDLL float Angle2PI float    a
 

Modify the angle a so that it fits in the interval [0..2*pi].

PLMDLL float VectorAngle float    x1,
float    y1,
float    x2,
float    y2
 

Compute the angle in degrees between the X axis (angle 0) and the 2D vector formed by the points (x1,y1) and (x2,y2).

Return an angle in the range [0..360].

PLMDLL float AngleDiff float    angle1,
float    angle2
 

Compute the difference between the two angles angle1 and angle2.

Return a signed angle in the range ]-180..180[, 0 means ==, a positive value means angle2 > angle1, a negative value means angle1 > angle2. Can be seen as the angle to move from angle1 to angle2.

PLMDLL void RandomInit u32    seed = 0
 

Set the seed used to generate the random numbers.

Using the same seed allows to get the same sequence of numbers (with Random*()). The default seed is 1 (if RandomInit() is not called), but RandomInit(0) will use current time as seed.

PLMDLL u32 Randomi  
 

Get a random integer value in the intervall (0 <= i < RAND_MAX).

PLMDLL u32 Randomi u32    max
 

Get a random integer value in the intervall (0 <= i < max).

PLMDLL float Randomf  
 

Get a random floating point value in the intervall (0.0f <= float < 1.0f).

PLMDLL float Randomf float    maxf
 

Get a random floating point value in the intervall (0.0f <= float < maxf).

maxf can be negative (maxf < float <= 0.0f).


Variable Documentation

const char PLM::PATH_SEP = '/'
 

Directory separator (system/OS dependant), char version.

const char* const PLM::PATH_SEP_STR = "/"
 

Directory separator (system/OS dependant), string version.

const char PLM::PATHLIST_SEP = ':'
 

Path separator in a list (system/OS dependant).

const u32 PLM::PATH_LEN = 1024
 

Maximum length for a directory / absolute file name.


Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:45 2004.