pwxlib
0.8.9
Tools Library for C++ Development
|
Name space for the PrydWorX Library - aka 'pwxLib'. More...
Namespaces | |
constants | |
internal constants | |
Classes | |
class | CAdjLeft |
CAdjLeft. More... | |
class | CAdjRight |
CAdjRight. More... | |
class | CArgCallback |
Definition of one command line argument using a callback function. More... | |
class | CArgHandler |
Handler for command line arguments. More... | |
class | CException |
Basic exception class with tracing functionality. More... | |
class | CFormat |
CFormat a numerical stream output. More... | |
class | CLockable |
Base class to make objects lockable via atomic_flag and lock counting. More... | |
class | CLockGuard |
Basic RAII lock guard to lock/unlock one, two or three objects within its ctor/dtor. More... | |
class | CRandom |
Static class to produce unique or pseudo random numbers, hashes and names. More... | |
class | CSinCosTable |
Provides pre-calculated sine and cosine tables. More... | |
class | CWaveColor |
Class to work with the frequencies any RGB color is made of. More... | |
struct | sArgError |
tiny struct to hold an error number and text together. More... | |
struct | sFloatPoint |
basic template for floating point helpers More... | |
struct | sFloatPoint< double > |
Specialized helper to handle doubles. More... | |
struct | sFloatPoint< float > |
Specialized helper to handle floats. More... | |
struct | sFloatPoint< long double > |
Specialized helper to handle long doubles. More... | |
struct | sWave |
tiny and simple struct to store wavelengths and their gamma More... | |
struct | TArgTarget |
Definition of one command line argument using a templated member. More... | |
class | TChainHash |
Chained hash container for variable types. More... | |
struct | TCompAssert< true > |
struct | TDoubleElement |
Template for an element of a doubly linked list or ring of variable types. More... | |
class | TDoubleList |
Template to build doubly linked lists of variable types. More... | |
class | TDoubleRing |
Template to build doubly linked rings of variable types. More... | |
struct | THashElement |
Template for an element of a hash table of variable types. More... | |
class | TOpenHash |
Open hash container for variable types. More... | |
class | TQueue |
Template to build queues of variable types. More... | |
class | TSet |
Template to build sets of variable types. More... | |
struct | TSingleElement |
Template for an element of a singly linked list or ring of variable types. More... | |
class | TSingleRing |
Template to build singly linked rings of variable types. More... | |
class | TStack |
Template to build stacks of variable types. More... | |
class | TVarDeleter |
Delegation of pointer deletion to an external function. More... | |
struct | VArgTargetBase |
data collection of non-templated values for TArgTarget More... | |
class | VContainer |
Virtual base class for all containers. More... | |
class | VElement |
Virtual base class for all container elements. More... | |
class | VTHashBase |
Virtual base class for hash containers. More... | |
Typedefs | |
typedef std::atomic_bool | abool_t |
typedef std::atomic_flag | aflag_t |
typedef std::atomic_uint_fast32_t | aui32_t |
typedef std::atomic_size_t | asize_t |
typedef std::memory_order | mord_t |
Enumerations | |
enum | eArgErrorNumber { AEN_OK = 0, AEN_ARGUMENT_UNKNOWN = 0x00000001, AEN_PARAM_TYPE_MISMATCH = 0x00000002, AEN_PARAMETER_MISSING = 0x00000004, AEN_PROCESSING_ERROR = 0x00000008, AEN_MULTIPLE_SET_PARAM = 0x00000010 } |
defines valid error numbers for argument parsing More... | |
enum | eArgSetType { STT_ERROR = 0, STT_OVERWRITE = 1, STT_IGNORE = 2 } |
determine what to do when multiple parameters are submitted to an ATT_SET target. More... | |
enum | eArgTargetType { ATT_FALSE = 0, ATT_TRUE = 1, ATT_ADD = 2, ATT_INC = 3, ATT_SUB = 4, ATT_DEC = 5, ATT_SET = 6, ATT_CB = 7 } |
determine what to do with a program argument handler target More... | |
enum | eChainHashMethod { CHM_Division = 1, CHM_Multiplication } |
two-type enum determining the hashing type This allows the chained hash to use dynamic hashing types for its basic hash->idx function, while the open addressed hash uses this to determine what to use for the secondary hashing. More... | |
enum | eNameSourceType { NST_NAMES_DE = 0, NST_NAMES_EN = 1, NST_NAMES_ALL = 2, NST_TEXTS_DE = 3, NST_TEXTS_EN = 4, NST_TEXTS_ALL = 5, NST_NUM_TYPES = 6 } |
[N]ame[S]ource[T]ype enum with NST_<type>_<language> Note: The special language "all" is merged from all others. Note: The type "texts" includes everything from the type "names" | |
Functions | |
bool | operator== (const sArgError &lhs, const sArgError &rhs) noexcept |
return true if both errors have the same errno | |
bool | operator> (const sArgError &lhs, const sArgError &rhs) noexcept |
return true if lhs.errno is greater than rhs.errno | |
bool | operator== (const VArgTargetBase &lhs, const VArgTargetBase &rhs) noexcept |
return true if lhs and rhs are the same arguments. More... | |
bool | operator> (const VArgTargetBase &lhs, const VArgTargetBase &rhs) noexcept |
return true if lhs is "greater" than rhs according to the arguments. More... | |
bool | are_locked (const CLockable *objA, const CLockable *objB) noexcept |
return true if two given objects are both locked More... | |
bool | are_locked (const CLockable *objA, const CLockable *objB, const CLockable *objC) noexcept |
return true if three given objects are both locked More... | |
bool | try_locks (const CLockable *objA, const CLockable *objB) noexcept |
try to lock two objects at once More... | |
bool | try_locks (const CLockable *objA, const CLockable *objB, const CLockable *objC) noexcept |
try to lock three objects at once More... | |
bool | unlock_all (const CLockable *objA, const CLockable *objB) noexcept |
unlock two objects if both are currently locked. More... | |
bool | unlock_all (const CLockable *objA, const CLockable *objB, const CLockable *objC) noexcept |
unlock three objects if all are currently locked. More... | |
template<typename data_t , typename elem_t > | |
TChainHash< data_t, elem_t > | operator+ (const TChainHash< data_t, elem_t > &lhs, const TChainHash< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
TChainHash< data_t, elem_t > | operator- (const TChainHash< data_t, elem_t > &lhs, const TChainHash< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t , typename elem_t > | |
TDoubleList< data_t, elem_t > | operator+ (const TDoubleList< data_t, elem_t > &lhs, const TDoubleList< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
TDoubleList< data_t, elem_t > | operator- (const TDoubleList< data_t, elem_t > &lhs, const TDoubleList< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t , typename elem_t > | |
TDoubleRing< data_t, elem_t > | operator+ (const TDoubleRing< data_t, elem_t > &lhs, const TDoubleRing< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
TDoubleRing< data_t, elem_t > | operator- (const TDoubleRing< data_t, elem_t > &lhs, const TDoubleRing< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t , typename elem_t > | |
TOpenHash< data_t, elem_t > | operator+ (const TOpenHash< data_t, elem_t > &lhs, const TOpenHash< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
TOpenHash< data_t, elem_t > | operator- (const TOpenHash< data_t, elem_t > &lhs, const TOpenHash< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t , typename elem_t > | |
TSingleRing< data_t, elem_t > | operator+ (const TSingleRing< data_t, elem_t > &lhs, const TSingleRing< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
TSingleRing< data_t, elem_t > | operator- (const TSingleRing< data_t, elem_t > &lhs, const TSingleRing< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t , typename elem_t > | |
VTHashBase< data_t, elem_t > | operator+ (const VTHashBase< data_t, elem_t > &lhs, const VTHashBase< data_t, elem_t > &rhs) |
addition operator More... | |
template<typename data_t , typename elem_t > | |
VTHashBase< data_t, elem_t > | operator- (const VTHashBase< data_t, elem_t > &lhs, const VTHashBase< data_t, elem_t > &rhs) |
substraction operator More... | |
template<typename data_t > | |
TSet< data_t > * | set_difference (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the difference of two sets More... | |
template<typename data_t > | |
TSet< data_t > | set_difference (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the difference of two sets More... | |
template<typename data_t > | |
TSet< data_t > * | set_intersection (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the intersection of two sets More... | |
template<typename data_t > | |
TSet< data_t > | set_intersection (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the intersection of two sets More... | |
template<typename data_t > | |
TSet< data_t > * | set_union (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the union of two sets More... | |
template<typename data_t > | |
TSet< data_t > | set_union (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the union of two sets More... | |
template<typename data_t > | |
bool | operator== (const TSet< data_t > &lhs, const TSet< data_t > &rhs) noexcept |
return true if two sets are equal More... | |
template<typename data_t > | |
bool | operator!= (const TSet< data_t > &lhs, const TSet< data_t > &rhs) noexcept |
return true if two sets are different More... | |
template<typename data_t > | |
TSet< data_t > | operator+ (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
return the union of two sets by operation. More... | |
template<typename data_t > | |
TSet< data_t > | operator- (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the difference of two sets by operation. More... | |
template<typename data_t > | |
TSet< data_t > PWX_API * | set_difference (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the difference of two sets More... | |
template<typename data_t > | |
TSet< data_t > PWX_API | set_difference (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the difference of two sets More... | |
template<typename data_t > | |
TSet< data_t > PWX_API * | set_intersection (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the intersection of two sets More... | |
template<typename data_t > | |
TSet< data_t > PWX_API | set_intersection (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the intersection of two sets More... | |
template<typename data_t > | |
TSet< data_t > PWX_API * | set_union (const TSet< data_t > *const lhs, const TSet< data_t > *const rhs) |
build the union of two sets More... | |
template<typename data_t > | |
TSet< data_t > PWX_API | set_union (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the union of two sets More... | |
template<typename data_t > | |
bool PWX_API | operator== (const TSet< data_t > &lhs, const TSet< data_t > &rhs) noexcept |
return true if two sets are equal More... | |
template<typename data_t > | |
bool PWX_API | operator!= (const TSet< data_t > &lhs, const TSet< data_t > &rhs) noexcept |
return true if two sets are different More... | |
template<typename data_t > | |
TSet< data_t > PWX_API | operator+ (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
return the union of two sets by operation. More... | |
template<typename data_t > | |
TSet< data_t > PWX_API | operator- (const TSet< data_t > &lhs, const TSet< data_t > &rhs) |
build the difference of two sets by operation. More... | |
bool | areAlmostEqual (const float lhs, const float rhs) noexcept |
test two floats whether they are near enough to be considered equal More... | |
bool | areAlmostEqual (const double lhs, const double rhs) noexcept |
test two doubles whether they are near enough to be considered equal More... | |
bool | areAlmostEqual (const long double lhs, const long double rhs) noexcept |
test two long doubles whether they are near enough to be considered equal More... | |
template<typename T > | |
bool PWX_API | areAlmostEqual (const T &lhs, const T &rhs) noexcept |
template<typename T > | |
T PWX_API | absDistance (const T x1, const T y1, const T x2, const T y2) |
return the normalized distance of two points in 2D space More... | |
template<typename T > | |
T PWX_API | absDistance (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2) |
return the normalized distance of two points in 3D space More... | |
template<typename T > | |
double PWX_API | degToRad (T degree) |
degToRad More... | |
template<typename T > | |
double PWX_API | getNormalizedDegree (const T degree) |
getNormalizedDegree (neutral version) More... | |
eNameSourceType & | operator++ (eNameSourceType &type) |
pre-increment for the source type | |
eNameSourceType | operator++ (eNameSourceType &type, int) |
post-increment for the source type | |
eNameSourceType & | operator-- (eNameSourceType &type) |
pre-decrement for the source type | |
eNameSourceType | operator-- (eNameSourceType &type, int) |
post-decrement for the source type | |
bool PWX_API | cropShell (const char *key, std::string &data) noexcept |
Delete shell representations out of a string. More... | |
void PWX_API | forwardTo (std::ifstream &is, char value) noexcept |
forward to a specific value More... | |
void PWX_API | ltrim (std::string &text, char extra) noexcept |
delete all newline, carriage return, tabs and spaces at the beginning of a string More... | |
const char PWX_API * | makeTemp (const char *aPath, const char *aTemplate, const char *aSuffix, std::ofstream &ofs, std::ios_base::openmode mode) noexcept |
create a temporary file More... | |
void PWX_API | rtrim (std::string &text, char extra) noexcept |
delete all newline, carriage return, tabs and spaces at the end of a string More... | |
bool PWX_API | skipLineBreak (std::ifstream &is) noexcept |
skip the following line break and carriage return More... | |
void PWX_API | tabToSpace (std::string &text, size_t spacePerTab) noexcept |
convert all tabs in a string to spaces More... | |
void PWX_API | trim (std::string &text, char extra) noexcept |
delete all newline, carriage return, tabs and spaces at the beginning and end of a string More... | |
std::ostream PWX_API & | operator<< (std::ostream &os, const CAdjLeft &l) noexcept |
operator<< for moving an CAdjLeft object upon a stream More... | |
std::ostream PWX_API & | operator<< (std::ostream &os, const CAdjRight &r) noexcept |
operator<< for moving an CAdjRight object upon a stream More... | |
template<typename Tval > | |
bool PWX_API | readNextValue (Tval &value, std::ifstream &is, char separator, bool search, bool emptyAllowed) noexcept |
get the next seperated value More... | |
template<typename T > | |
bool PWX_API | to_bool (const T val) noexcept |
convert a value to bool More... | |
template<typename T > | |
float PWX_API | to_float (const T val) noexcept |
convert a value to float More... | |
template<typename T > | |
double PWX_API | to_double (const T val) noexcept |
convert a value to double More... | |
template<typename T > | |
long double PWX_API | to_long_double (const T val) noexcept |
convert a value to long double More... | |
template<typename T > | |
int8_t PWX_API | to_int8 (const T val) noexcept |
convert a value to int8_t More... | |
template<typename T > | |
uint8_t PWX_API | to_uint8 (const T val) noexcept |
convert a value to uint8_t More... | |
template<typename T > | |
int16_t PWX_API | to_int16 (const T val) noexcept |
convert a value to int16_t More... | |
template<typename T > | |
uint16_t PWX_API | to_uint16 (const T val) noexcept |
convert a value to uint16_t More... | |
template<typename T > | |
int32_t PWX_API | to_int32 (const T val) noexcept |
convert a value to int32_t More... | |
template<typename T > | |
uint32_t PWX_API | to_uint32 (const T val) noexcept |
convert a value to uint32_t More... | |
template<typename T > | |
int64_t PWX_API | to_int64 (const T val) noexcept |
convert a value to int64_t More... | |
template<typename T > | |
uint64_t PWX_API | to_uint64 (const T val) noexcept |
convert a value to uint64_t More... | |
template<typename T > | |
std::string PWX_API | to_string (const T val) noexcept |
convert a value to a string More... | |
Variables | |
template<bool > | |
struct PWX_API | TCompAssert |
compile time assertion More... | |
CRandom | RNG |
From pwx.cpp. More... | |
PWX_API CArgHandler | PAH |
Global argument handler that can be used centrally in any project. More... | |
PWX_API CSinCosTable | SCT |
Global sine-/cosine-table that can be used centrally in any project. | |
Name space for the PrydWorX Library - aka 'pwxLib'.
This file is part of the PrydeWorX Library (pwxLib).
(c) 2007 - 2018 PrydeWorX
The PrydeWorX Library is free software under MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
History and change log are maintained in pwx.h
Everything declared and defined in this name space belongs to the pwxLib. All classes, structs, constants, functions and macros should be documented. Therefore what follows are some general notes and discussions.
Thread safety
Basically there are three basic principles on how to handle multi threaded environments:
Principle | Advantages | Disadvantages |
---|---|---|
Users responsibility |
|
|
API big locks |
|
|
Internal locking on demand |
|
|
Most libraries offering functionality like the pwxLib use the first principle. It helps greatly to focus on functionality instead of tiny implementation details. However, it is a principle where single threaded usage is often better (and faster) than multi threaded. An example would be a container that has to be filled with a lot items which are simply gathered. Only if the generation of those items is very costly, a multi threaded design can be used to gain more performance.
The pwxLib basically uses the third principle. But as it is not advisable, like with the example above, to handle tasks that are better done in a single threaded way, like they were multi threaded, all objects in the library allow to override the internal locking and use the first principle instead.
This can be done in two ways:
enum pwx::eArgErrorNumber |
defines valid error numbers for argument parsing
enum pwx::eArgSetType |
determine what to do when multiple parameters are submitted to an ATT_SET target.
This enum only applies to ATT_SET targets to be able to change the default behaviour of the ATT_SET target, which is to overwrite the set value on each call to process().
Enumerator | |
---|---|
STT_ERROR | Receiving more than one parameter is an error. |
STT_OVERWRITE | Overwrite the set value (default) |
STT_IGNORE | Only set the value once, silently ignore all further parameters. |
enum pwx::eArgTargetType |
determine what to do with a program argument handler target
The value taken when adding an argument to PAH (or any other instance of CArgHAndler) decides upon what to do with a target when parsing command line arguments.
two-type enum determining the hashing type This allows the chained hash to use dynamic hashing types for its basic hash->idx function, while the open addressed hash uses this to determine what to use for the secondary hashing.
Enumerator | |
---|---|
CHM_Division | Use the division method. |
CHM_Multiplication | Use the multiplication method. |
|
inline |
return the normalized distance of two points in 2D space
[in] | x1 | X-Coordinate of the first point |
[in] | y1 | Y-Coordinate of the first point |
[in] | x2 | X-Coordinate of the second point |
[in] | y2 | Y-Coordinate of the second point |
This method returns the distance between two points.
Referenced by pwx::CWaveColor::doppler().
|
inline |
return the normalized distance of two points in 3D space
[in] | x1 | X-Coordinate of the first point |
[in] | y1 | Y-Coordinate of the first point |
[in] | z1 | Z-Coordinate of the first point |
[in] | x2 | X-Coordinate of the second point |
[in] | y2 | Y-Coordinate of the second point |
[in] | z2 | Z-Coordinate of the second point |
This method returns the distance between two points.
return true if two given objects are both locked
This function returns true if both given objects are currently locked by the calling thread. If at least one is not locked, the function returns false.
This function can handle nullptr arguments, assuming nullptr to be locked; It can't be manipulated anyway.
[in] | objA | the first object to check |
[in] | objB | the second object to check |
Referenced by unlock_all().
|
noexcept |
return true if three given objects are both locked
This function returns true if all three given objects are currently locked by the calling thread. If at least one is not locked, the function returns false.
This function can handle nullptr arguments, assuming nullptr to be locked; It can't be manipulated anyway.
[in] | objA | the first object to check |
[in] | objB | the second object to check |
[in] | objC | the third object to check |
|
noexcept |
test two floats whether they are near enough to be considered equal
This functions takes two floats and tests whether they can be considered equal. For this the tolerated difference and the tolerated ULPS difference are determined. Then an internal function can check these values.
[in] | lhs | left hand side value |
[in] | rhs | right hand side value |
Referenced by pwx::CWaveColor::getFrequency(), pwx::sWave::operator==(), and pwx::CWaveColor::setFrequency().
|
noexcept |
test two doubles whether they are near enough to be considered equal
This functions takes two doubles and tests whether they can be considered equal. For this the tolerated difference and the tolerated ULPS difference are determined. Then an internal function can check these values.
[in] | lhs | left hand side value |
[in] | rhs | right hand side value |
|
noexcept |
test two long doubles whether they are near enough to be considered equal
This functions takes two long doubles and tests whether they can be considered equal. For this the tolerated difference and the tolerated ULPS difference are determined. Then an internal function can check these values.
[in] | lhs | left hand side value |
[in] | rhs | right hand side value |
|
noexcept |
Delete shell representations out of a string.
This function is internally used to handle shell script like configuration files.
[in] | key | The key to search for |
[in,out] | data | The data string to search |
double PWX_API pwx::degToRad | ( | T | degree | ) |
degToRad
Recalculate a degree into a radiant.
Warning: Although this is a template, it is your responsibility to use it with a sensible type! Type checking would have too much impact, so if you receive weird/wrong results because of the type you use, then you have been warned. ;-) (But of course the transformation to double is done here, too.
[in] | degree | the value to re-calculate |
Referenced by pwx::CSinCosTable::setPrecision().
|
noexcept |
forward to a specific value
This method will forward the given ifstream is until a) eof() is reached, or b) the wanted value is found. Note: value is discarded, and not read! This function is meant to help forwarding to fields after specific separators or identifiers!
[in] | is | the ifstream to manipulate |
[in] | value | the value to look for and jump after |
double PWX_API pwx::getNormalizedDegree | ( | const T | degree | ) |
getNormalizedDegree (neutral version)
This helper method makes sure, that the provided degree is in a range of 0 <= result < 360
Warning: Although this is a template, it is your responsibility to use it with a sensible type! Type checking would have too much impact, so if you receive weird/wrong results because of the type you use, then you have been warned. ;-) But I guess you won't get a problem, as your degree will be transformed into a double anyway. So as long as your type can be converted, everything should be in order.
[in] | degree | the degree you want to have re-calculated into a normalized range |
|
noexcept |
delete all newline, carriage return, tabs and spaces at the beginning of a string
[in,out] | text | a string reference that will be trimmed |
[in] | extra | optional extra character to be trimmed as well, defaults to 0 |
Referenced by trim().
|
noexcept |
create a temporary file
This method is a wrapper to use mkstemp() with ofstream. Furthermore it ensures, that the template you provide is safe, meaning it is ensured to end with XXXXXX.
The return string is a malloc'd C-String, so you have to free() it!
[in] | aPath | The path where to create the file. The path will NOT be created! |
[in] | aTemplate | Your naming template. It can be anything but has to end with XXXXXX, or will be made to do so |
[in] | aSuffix | an optional suffix for your temp file, or NULL if you do not want one |
[in] | ofs | an ofstream that will be set to and opened with the created temp file |
[in] | mode | you can specify a non-default openmode if you like. |
References PWX_CATCH_AND_FORGET, and STRNE.
|
noexcept |
return true if two sets are different
Two sets are different they differ in number of elements or if one set consists of elements the other has not.
[in] | lhs | left hand side set |
[in] | rhs | right hand side set |
References operator==().
|
noexcept |
return true if two sets are different
Two sets are different they differ in number of elements or if one set consists of elements the other has not.
[in] | lhs | left hand side set |
[in] | rhs | right hand side set |
References operator==().
TSet<data_t> PWX_API pwx::operator+ | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
return the union of two sets by operation.
This is a wrapper of the pointer using version of set_union() to be able to use references with the + operator.
Please be aware that using references is rather costly, because the resulting set has to be copied thrice. You should use the pointer versions of set_union() wherever possible.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_union().
TSet<data_t> pwx::operator+ | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
return the union of two sets by operation.
This is a wrapper of the pointer using version of set_union() to be able to use references with the + operator.
Please be aware that using references is rather costly, because the resulting set has to be copied thrice. You should use the pointer versions of set_union() wherever possible.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_union().
TChainHash<data_t, elem_t> pwx::operator+ | ( | const TChainHash< data_t, elem_t > & | lhs, |
const TChainHash< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new hash consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice! Only use this operator if you really think you need a construct like 'hashC = hashA + hashB'.
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
TSingleRing<data_t, elem_t> pwx::operator+ | ( | const TSingleRing< data_t, elem_t > & | lhs, |
const TSingleRing< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new ring consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local ring is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice!
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
TOpenHash<data_t, elem_t> pwx::operator+ | ( | const TOpenHash< data_t, elem_t > & | lhs, |
const TOpenHash< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new hash consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash table is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice! Only use this operator if you really think you need a construct like 'hashC = hashA + hashB'.
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
TDoubleRing<data_t, elem_t> pwx::operator+ | ( | const TDoubleRing< data_t, elem_t > & | lhs, |
const TDoubleRing< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new ring consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local ring is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice!
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
TDoubleList<data_t, elem_t> pwx::operator+ | ( | const TDoubleList< data_t, elem_t > & | lhs, |
const TDoubleList< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new list consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local list is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice! Only use this operator if you really think you need a construct like 'listC = listA + listB'.
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
VTHashBase<data_t, elem_t> pwx::operator+ | ( | const VTHashBase< data_t, elem_t > & | lhs, |
const VTHashBase< data_t, elem_t > & | rhs | ||
) |
addition operator
Create and return a new hash consisting of all elements of lhs and rhs.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash is created on the stack. Giving it back means that it will be copied onto your result. In other words: All elements will be copied twice! Only use this operator if you really think you need a construct like 'hashC = hashA + hashB'.
[in] | lhs | left hand side reference |
[in] | rhs | right hand side reference |
References PWX_TRY_PWX_FURTHER.
TSet<data_t> PWX_API pwx::operator- | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the difference of two sets by operation.
This is a wrapper of the pointer using version of set_difference() to be able to use references with the - operator.
Please be aware that using references is rather costly, because the resulting set has to be copied thrice. You should use the pointer versions of set_difference() wherever possible.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_difference().
TSet<data_t> pwx::operator- | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the difference of two sets by operation.
This is a wrapper of the pointer using version of set_difference() to be able to use references with the - operator.
Please be aware that using references is rather costly, because the resulting set has to be copied thrice. You should use the pointer versions of set_difference() wherever possible.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_difference().
TChainHash<data_t, elem_t> pwx::operator- | ( | const TChainHash< data_t, elem_t > & | lhs, |
const TChainHash< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this hash.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the hash from which to substract. |
[in] | rhs | reference of the hash to substract. |
References pwx::TChainHash< key_t, data_t, elem_t >::clear(), and PWX_TRY_PWX_FURTHER.
TSingleRing<data_t, elem_t> pwx::operator- | ( | const TSingleRing< data_t, elem_t > & | lhs, |
const TSingleRing< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this ring.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local ring is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the ring from which to substract. |
[in] | rhs | reference of the ring to substract. |
References PWX_TRY_PWX_FURTHER.
TOpenHash<data_t, elem_t> pwx::operator- | ( | const TOpenHash< data_t, elem_t > & | lhs, |
const TOpenHash< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this hash.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the hash from which to substract. |
[in] | rhs | reference of the hash to substract. |
References pwx::TOpenHash< key_t, data_t, elem_t >::clear(), and PWX_TRY_PWX_FURTHER.
TDoubleRing<data_t, elem_t> pwx::operator- | ( | const TDoubleRing< data_t, elem_t > & | lhs, |
const TDoubleRing< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this ring.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local ring is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the ring from which to substract. |
[in] | rhs | reference of the ring to substract. |
References PWX_TRY_PWX_FURTHER.
TDoubleList<data_t, elem_t> pwx::operator- | ( | const TDoubleList< data_t, elem_t > & | lhs, |
const TDoubleList< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this list.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local list is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the list from which to substract. |
[in] | rhs | reference of the list to substract. |
References PWX_TRY_PWX_FURTHER.
VTHashBase<data_t, elem_t> pwx::operator- | ( | const VTHashBase< data_t, elem_t > & | lhs, |
const VTHashBase< data_t, elem_t > & | rhs | ||
) |
substraction operator
Remove all elements from rhs from this hash.
The destroy method from lhs will be used in the result as well.
Warning: For this to work a local hash is created on the stack. Giving it back means that it will be copied onto your result. In other words: The difference elements are copied twice!
[in] | lhs | reference of the hash from which to substract. |
[in] | rhs | reference of the hash to substract. |
References pwx::VTHashBase< key_t, data_t, elem_t >::clear(), and PWX_TRY_PWX_FURTHER.
|
noexcept |
|
noexcept |
|
noexcept |
return true if two sets are equal
Two sets are equal if one set is a subset of the other and both have the same number of elements.
[in] | lhs | left hand side set |
[in] | rhs | right hand side set |
|
noexcept |
return true if lhs and rhs are the same arguments.
[in] | lhs | left hand side instance. |
[in] | rhs | rhs hand side instance. |
|
noexcept |
return true if two sets are equal
Two sets are equal if one set is a subset of the other and both have the same number of elements.
[in] | lhs | left hand side set |
[in] | rhs | right hand side set |
|
noexcept |
return true if lhs is "greater" than rhs according to the arguments.
[in] | lhs | left hand side instance. |
[in] | rhs | rhs hand side instance. |
|
noexcept |
get the next seperated value
This function extracts a value from an ifstream into value. If a separator is given, the method fails if the next value in the stream is something else if search is false. But if search is set to true, the method will forward to the next separator in the stream, and extract the wanted value from after that. If the found separator is followed by another separator, the method either fails if emptyAllowed is set to false, or will simply not touch value if emptyAllowed is set to true.
If you use objects with this method, please make sure they support operator>>(&ifstream).
This method never throws, but returns false on failure.
Tval | a type that supports operator>> to load data into values of this type |
[in,out] | value | a read/write reference of the value to write into |
[in] | is | the stream to extract from |
[in] | separator | a char to advance to if not zero |
[in] | search | if set to true, the method forwards to the next separator, otherwise it has to be the next char |
[in] | emptyAllowed | if set to false, the method fails, if the next separator is followed by another one |
|
noexcept |
delete all newline, carriage return, tabs and spaces at the end of a string
[in,out] | text | a string reference that will be trimmed |
[in] | extra | optional extra character to be trimmed as well, defaults to 0 |
Referenced by trim().
TSet<data_t> PWX_API* pwx::set_difference | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the difference of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the difference of the sets lhs and rhs.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References pwx::TSet< data_t >::hasMember(), PWX_DOUBLE_LOCK_GUARD, PWX_THROW_STD_FURTHER, and PWX_TRY.
Referenced by operator-(), and set_difference().
TSet<data_t> PWX_API pwx::set_difference | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the difference of two sets
This is a wrapper of the pointer using version of set_difference() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_difference().
TSet<data_t>* pwx::set_difference | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the difference of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the difference of the sets lhs and rhs.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References pwx::TSet< data_t >::hasMember(), PWX_DOUBLE_LOCK_GUARD, PWX_THROW_STD_FURTHER, and PWX_TRY.
Referenced by operator-(), and set_difference().
TSet<data_t> pwx::set_difference | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the difference of two sets
This is a wrapper of the pointer using version of set_difference() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If lhs is the empty set or lhs equals rhs an empty set is returned. If rhs is the empty set a copy of lhs is returned.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_difference().
TSet<data_t> PWX_API* pwx::set_intersection | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the intersection of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the intersection of the sets lhs and rhs.
If either set is the empty set, the intersection is the empty set.
If lhs equals rhs, the intersection is a copy of lhs.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References pwx::TSet< data_t >::hasMember(), PWX_DOUBLE_LOCK_GUARD, PWX_THROW_STD_FURTHER, and PWX_TRY.
Referenced by set_intersection().
TSet<data_t> PWX_API pwx::set_intersection | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the intersection of two sets
This is a wrapper of the pointer using version of set_intersection() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If either set is the empty set, the intersection is the empty set.
If lhs equals rhs, the intersection is a copy of lhs.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_intersection().
TSet<data_t>* pwx::set_intersection | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the intersection of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the intersection of the sets lhs and rhs.
If either set is the empty set, the intersection is the empty set.
If lhs equals rhs, the intersection is a copy of lhs.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References pwx::TSet< data_t >::hasMember(), PWX_DOUBLE_LOCK_GUARD, PWX_THROW_STD_FURTHER, and PWX_TRY.
Referenced by set_intersection().
TSet<data_t> pwx::set_intersection | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the intersection of two sets
This is a wrapper of the pointer using version of set_intersection() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If either set is the empty set, the intersection is the empty set.
If lhs equals rhs, the intersection is a copy of lhs.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_intersection().
TSet<data_t> PWX_API* pwx::set_union | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the union of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the union of the sets lhs and rhs.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References PWX_LOCK_GUARD, PWX_THROW_STD_FURTHER, PWX_TRY, and PWX_TRY_PWX_FURTHER.
Referenced by operator+(), and set_union().
TSet<data_t> PWX_API pwx::set_union | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the union of two sets
This is a wrapper of the pointer using version of set_union() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_union().
TSet<data_t>* pwx::set_union | ( | const TSet< data_t > *const | lhs, |
const TSet< data_t > *const | rhs | ||
) |
build the union of two sets
This function builds a new set, created using the new operator, so you have to delete it with the delete operator, that consists of the union of the sets lhs and rhs.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | pointer to the left hand side set |
[in] | rhs | pointer to the right hand side set |
References PWX_LOCK_GUARD, PWX_THROW_STD_FURTHER, PWX_TRY, and PWX_TRY_PWX_FURTHER.
Referenced by operator+(), and set_union().
TSet<data_t> pwx::set_union | ( | const TSet< data_t > & | lhs, |
const TSet< data_t > & | rhs | ||
) |
build the union of two sets
This is a wrapper of the pointer using version of set_union() to be able to use references.
Please be aware that using references is rather costly, because the resulting set has to be copied twice. You should use the pointer versions wherever possible.
If either set is the empty set, the union is a copy of the other.
If the new set can not be created, a pwx::CException with the name "SetCreationFailed" is thrown.
If a new element can not be created, a pwx::CException with the name "ElementCreationFailed" is thrown.
[in] | lhs | reference of the left hand side set |
[in] | rhs | reference of the right hand side set |
References PWX_TRY_PWX_FURTHER, and set_union().
|
noexcept |
skip the following line break and carriage return
This function ignores all following CR/LF characters in the open ifstream is until a different character is met. If afterwards the stream is in order or eof is ahead, the function returns true, false if a different failbit is set.
[in] | is | an open ifstream |
|
noexcept |
convert all tabs in a string to spaces
This functions replaces all tabs in a string with a variable number of spaces, one space per tabulator character by default.
If the second parameter spacePerTab is set to zero, tabs are not replaced but simply deleted.
[in,out] | text | reference on the string to search |
[in] | spacePerTab | number of spaces per tab. |
|
noexcept |
convert a value to bool
This function uses a stringstream to convert val to a bool. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to double
This function uses a stringstream to convert val to a double. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to float
This function uses a stringstream to convert val to a float. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to int16_t
This function uses a stringstream to convert val to a int16_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to int32_t
This function uses a stringstream to convert val to a int32_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to int64_t
This function uses a stringstream to convert val to a int64_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to int8_t
This function uses a stringstream to convert val to a int8_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to long double
This function uses a stringstream to convert val to a long double. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to a string
This function uses a stringstream to convert val to a string. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
Referenced by pwx::CArgHandler::parseArgs().
|
noexcept |
convert a value to uint16_t
This function uses a stringstream to convert val to a uint16_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to uint32_t
This function uses a stringstream to convert val to a uint32_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to uint64_t
This function uses a stringstream to convert val to a int64_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
convert a value to uint8_t
This function uses a stringstream to convert val to a uint8_t. The value will not be type-checked, so it is the users responsibility to use a type that is compatible with stringstream. Of course the compiler will error out if the type is incompatible.
[in] | val | the value to be converted |
|
noexcept |
try to lock two objects at once
This function tries to lock two objects at once, returning true if both could be locked. If any can not be locked, the other is unlocked again if neccessary and false is returned.
This function can handle nullptr arguments, assuming nullptr to be locked; It can't be manipulated anyway.
[in] | objA | the first object to lock |
[in] | objB | the second object to lock |
References pwx::CLockable::try_lock(), and pwx::CLockable::unlock().
Referenced by pwx::CLockGuard::reset().
|
noexcept |
try to lock three objects at once
This function tries to lock three objects at once, returning true if all three could be locked. If any can not be locked, the others are unlocked again if neccessary and false is returned.
This function can handle nullptr arguments, assuming nullptr to be locked; It can't be manipulated anyway.
[in] | objA | the first object to lock |
[in] | objB | the second object to lock |
[in] | objC | the third object to lock |
References pwx::CLockable::try_lock(), and pwx::CLockable::unlock().
unlock two objects if both are currently locked.
This function unlocks two objects if both are currently locked by the calling thread. If any is not locked, the function does nothing and returns false.
This function can handle nullptr arguments, assuming nullptr to be successfully unlocked; It can't be manipulated anyway.
[in] | objA | the first object to unlock |
[in] | objB | the second object to unlock |
References are_locked(), and pwx::CLockable::unlock().
|
noexcept |
unlock three objects if all are currently locked.
This function unlocks three objects if all are currently locked by the calling thread. If any is not locked, the function does nothing and returns false.
This function can handle nullptr arguments, assuming nullptr to be successfully unlocked; It can't be manipulated anyway.
[in] | objA | the first object to unlock |
[in] | objB | the second object to unlock |
[in] | objB | the third object to unlock |
References are_locked(), and pwx::CLockable::unlock().
pwx::CArgHandler pwx::PAH |
Global argument handler that can be used centrally in any project.
This file is part of the PrydeWorX Library (pwxLib).
(c) 2007 - 2018 PrydeWorX
The PrydeWorX Library is free software under MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
History and change log are maintained in pwx.h
PWX_API CRandom pwx::RNG |
From pwx.cpp.
Global random value generator that can be used centrally in any project.
This file is part of the PrydeWorX Library (pwxLib).
(c) 2007 - 2018 PrydeWorX
The PrydeWorX Library is free software under MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
History and change log are maintained in pwx.h
struct PWX_API pwx::TCompAssert |
compile time assertion
This little trick is taken from Andrei Alexandrescu: 'Modern C++ Design'. It can be used to check an expression at compile time. Of course this does not substitute cassert completely, only expressions that are known while the compiler does its work can be checked with this.