PIP  0.4.0_beta2
Platform-Independent Primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
piincludes.h File Reference

Global includes of PIP. More...

Classes

class  PIFlags< Enum >
 This class used as container for bit flags. More...
 
class  PICout
 Class for formatted output similar std::cout. More...
 

Namespaces

 PICoutManipulators
 Namespace contains enums controlled PICout.
 

Macros

#define PIP_VERSION   0x000400
 Version of PIP in hex - 0x##(Major)##(Minor)##(Revision)
 
#define PIP_VERSION_MAJOR   (PIP_VERSION & 0xFF0000) >> 16
 Major value of PIP version.
 
#define PIP_VERSION_MINOR   (PIP_VERSION & 0xFF00) >> 8
 Minor value of PIP version.
 
#define PIP_VERSION_REVISION   PIP_VERSION & 0xFF
 Revision value of PIP version.
 
#define PIP_VERSION_SUFFIX   "_beta2"
 Suffix of PIP version.
 
#define PIP_DEBUG
 Macro is defined when compile-time debug is enabled.
 
#define WINDOWS
 Macro is defined when host is any Windows.
 
#define QNX
 Macro is defined when host is QNX.
 
#define FREE_BSD
 Macro is defined when host is FreeBSD.
 
#define MAC_OS
 Macro is defined when host is Mac OS.
 
#define ANDROID
 Macro is defined when host is Android.
 
#define LINUX
 Macro is defined when host is any Linux.
 
#define CC_GCC
 Macro is defined when compiler is GCC or MinGW.
 
#define HAS_LOCALE
 Macro is defined when PIP is decided that host is support language.
 
#define CC_VC
 Macro is defined when compiler is Visual Studio.
 
#define CC_OTHER
 Macro is defined when compiler is unknown.
 
#define PIP_TIMER_RT
 Macro is defined when PIP use "rt" library for timers implementation.
 
#define PIP_CONTAINERS_STL
 Define this macro to use STL implementation of containers, else PIP implementation will be used.
 
#define CC_OTHER
 Macro is defined when compiler is unknown.
 
#define FOREVER   for (;;)
 Macro used for infinite loop.
 
#define FOREVER_WAIT   FOREVER msleep(1);
 Macro used for infinite wait.
 
#define WAIT_FOREVER   FOREVER msleep(1);
 Macro used for infinite wait.
 
#define piCout
 Macro used for conditional (piDebug) output to PICout.
 

Enumerations

enum  PICoutManipulators::PICoutSpecialChar {
  PICoutManipulators::Null, PICoutManipulators::NewLine, PICoutManipulators::Tab, PICoutManipulators::Esc,
  PICoutManipulators::Quote
}
 Enum contains special characters. More...
 
enum  PICoutManipulators::PICoutAction {
  PICoutManipulators::Flush, PICoutManipulators::Backspace, PICoutManipulators::ShowCursor, PICoutManipulators::HideCursor,
  PICoutManipulators::ClearScreen, PICoutManipulators::SaveContol, PICoutManipulators::RestoreControl
}
 Enum contains immediate action. More...
 
enum  PICoutManipulators::PICoutControl {
  PICoutManipulators::AddNone = 0x0, PICoutManipulators::AddSpaces = 0x1, PICoutManipulators::AddNewLine = 0x2, PICoutManipulators::AddQuotes = 0x4,
  PICoutManipulators::AddAll = 0xFFFFFFFF
}
 Enum contains control of PICout. More...
 
enum  PICoutManipulators::PICoutFormat {
  PICoutManipulators::Bin = 0x01, PICoutManipulators::Oct = 0x02, PICoutManipulators::Dec = 0x04, PICoutManipulators::Hex = 0x08,
  PICoutManipulators::Bold = 0x10 , PICoutManipulators::Underline = 0x80, PICoutManipulators::Blink = 0x100, PICoutManipulators::Black = 0x400,
  PICoutManipulators::Red = 0x800, PICoutManipulators::Green = 0x1000, PICoutManipulators::Blue = 0x2000, PICoutManipulators::Yellow = 0x4000,
  PICoutManipulators::Magenta = 0x8000, PICoutManipulators::Cyan = 0x10000, PICoutManipulators::White = 0x20000, PICoutManipulators::BackBlack = 0x40000,
  PICoutManipulators::BackRed = 0x80000, PICoutManipulators::BackGreen = 0x100000, PICoutManipulators::BackBlue = 0x200000, PICoutManipulators::BackYellow = 0x400000,
  PICoutManipulators::BackMagenta = 0x800000, PICoutManipulators::BackCyan = 0x1000000, PICoutManipulators::BackWhite = 0x2000000, PICoutManipulators::Default = 0x4000000
}
 Enum contains output format. More...
 

Functions

template<typename T >
void piSwap (T &f, T &s)
 Templated function for swap two values. More...
 
template<typename T >
void piSwapBinary (T &f, T &s)
 Templated function for swap two values without "=". More...
 
template<typename T >
int piRound (const T &v)
 Templated function return round of float falue. More...
 
template<typename T >
int piFloor (const T &v)
 Templated function return floor of float falue. More...
 
template<typename T >
int piCeil (const T &v)
 Templated function return ceil of float falue. More...
 
template<typename T >
piAbs (const T &v)
 Templated function return absolute of numeric falue. More...
 
template<typename T >
piMin (const T &f, const T &s)
 Templated function return minimum of two values. More...
 
template<typename T >
piMin (const T &f, const T &s, const T &t)
 Templated function return minimum of tree values. More...
 
template<typename T >
piMax (const T &f, const T &s)
 Templated function return maximum of two values. More...
 
template<typename T >
piMax (const T &f, const T &s, const T &t)
 Templated function return maximum of tree values. More...
 
template<typename T >
piClamp (const T &v, const T &min, const T &max)
 Templated function return clamped value. More...
 
void piLetobe (void *data, int size)
 Function inverse byte order in memory block.
 
template<typename T >
void piLetobe (T *v)
 Templated function that inverse byte order of value "v".
 
template<typename T >
piLetobe (const T &v)
 Templated function that returns "v" with inversed byte order. More...
 
ushort letobe_s (ushort v)
 Use piLetobe() instead of this function. More...
 
uint letobe_i (uint v)
 Use piLetobe() instead of this function. More...
 
string errorString ()
 Return readable error description in format "code <number> - <description>".
 
string PIPVersion ()
 Return readable version of PIP.
 

Variables

bool piDebug
 global variable enabling output to piCout
 

Detailed Description

Global includes of PIP.

This file include all needed system headers, STL and declare many useful macros and functions

Function Documentation

template<typename T >
void piSwap ( T &  f,
T &  s 
)
inline

Templated function for swap two values.

Example:

int v1 = 1, v2 = 2;
piCout << v1 << v2; // 1 2
piSwap<int>(v1, v2);
piCout << v1 << v2; // 2 1
template<typename T >
void piSwapBinary ( T &  f,
T &  s 
)
inline

Templated function for swap two values without "=".

Example:

template<typename T >
int piRound ( const T &  v)
inline

Templated function return round of float falue.

Round is the nearest integer value
There are some macros:

  • piRoundf for "float"
  • piRoundd for "double"

Example:

piCout << piRoundf(0.6f) << piRoundd(0.2); // 1 0
piCout << piRoundf(-0.6f) << piRoundd(-0.2); // -1 0
template<typename T >
int piFloor ( const T &  v)
inline

Templated function return floor of float falue.

Floor is the largest integer that is not greater than value
There are some macros:

  • piFloorf for "float"
  • piFloord for "double"

Example:

piCout << piFloorf(0.6f) << piFloorf(0.2); // 0 0
piCout << piFloorf(-0.6f) << piFloorf(-0.2f); // -1 -1
template<typename T >
int piCeil ( const T &  v)
inline

Templated function return ceil of float falue.

Ceil is the smallest integer that is not less than value
There are some macros:

  • piCeilf for "float"
  • piCeild for "double"

Example:

piCout << piCeilf(0.6f) << piCeilf(0.2); // 1 1
piCout << piCeilf(-0.6f) << piCeilf(-0.2f); // 0 0
template<typename T >
T piAbs ( const T &  v)
inline

Templated function return absolute of numeric falue.

Absolute is the positive or equal 0 value
There are some macros:

  • piAbss for "short"
  • piAbsi for "int"
  • piAbsl for "long"
  • piAbsll for "llong"
  • piAbsf for "float"
  • piAbsd for "double"

Example:

piCout << piAbsi(5) << piAbsi(-11); // 5 11
piCout << piAbsf(-0.6f) << piAbsf(-0.2f); // 0.6 0.2
template<typename T >
T piMin ( const T &  f,
const T &  s 
)
inline

Templated function return minimum of two values.

There are some macros:

  • piMins for "short"
  • piMini for "int"
  • piMinl for "long"
  • piMinll for "llong"
  • piMinf for "float"
  • piMind for "double"

Example:

piCout << piMini(5, 1); // 1
piCout << piMinf(-0.6f, -0.2f); // -0.6
template<typename T >
T piMin ( const T &  f,
const T &  s,
const T &  t 
)
inline

Templated function return minimum of tree values.

There are some macros:

  • piMins for "short"
  • piMini for "int"
  • piMinl for "long"
  • piMinll for "llong"
  • piMinf for "float"
  • piMind for "double"

Example:

piCout << piMini(5, 1, -1); // -1
piCout << piMinf(-0.6f, -0.2f, 1.f); // -0.6
template<typename T >
T piMax ( const T &  f,
const T &  s 
)
inline

Templated function return maximum of two values.

There are some macros:

  • piMaxs for "short"
  • piMaxi for "int"
  • piMaxl for "long"
  • piMaxll for "llong"
  • piMaxf for "float"
  • piMaxd for "double"

Example:

piCout << piMaxi(5, 1); // 5
piCout << piMaxf(-0.6f, -0.2f); // -0.2
template<typename T >
T piMax ( const T &  f,
const T &  s,
const T &  t 
)
inline

Templated function return maximum of tree values.

There are some macros:

  • piMaxs for "short"
  • piMaxi for "int"
  • piMaxl for "long"
  • piMaxll for "llong"
  • piMaxf for "float"
  • piMaxd for "double"

Example:

piCout << piMaxi(5, 1, -1); // 5
piCout << piMaxf(-0.6f, -0.2f, 1.f); // 1
template<typename T >
T piClamp ( const T &  v,
const T &  min,
const T &  max 
)
inline

Templated function return clamped value.

Clamped is the not greater than "max" and not lesser than "min" value
There are some macros:

  • piClamps for "short"
  • piClampi for "int"
  • piClampl for "long"
  • piClampll for "llong"
  • piClampf for "float"
  • piClampd for "double"

Example:

piCout << piClampf(-5, -3, 2); // -3
piCout << piClampf(1, -3, 2); // 1
piCout << piClampf(5, -3, 2); // 2
template<typename T >
T piLetobe ( const T &  v)
inline

Templated function that returns "v" with inversed byte order.

This function used to convert values between little and big endian
There are some macros:

  • piLetobes for "ushort"
  • piLetobei for "uint"
  • piLetobel for "ulong"
  • piLetobell for "ullong"

Example:

ushort letobe_s ( ushort  v)

Use piLetobe() instead of this function.

Deprecated:
uint letobe_i ( uint  v)

Use piLetobe() instead of this function.

Deprecated: