Classes | |
class | APtr |
A reference counting ptr that auto-deletes what it points to when the last copy leaves scope or is otherwise destructed. More... | |
class | Bitfield |
A bounds-safe one-dimensional vector-like structure of efficiently packed bits. More... | |
class | Bitfield2D |
A bounds-safe two-dimensional structure of efficiently packed bits. More... | |
class | Bitfield3D |
A bounds-safe three-dimensional structure of efficiently packed bits. More... | |
class | UntypedCaller |
The base class of Caller without return type or parameters specified. More... | |
class | Caller |
A general purpose function class which can refer to any static method, member method, functor, or lambda function. More... | |
class | DynCaller |
A typeless container for a Caller, which has methods for dynamically casting it to the correct type. More... | |
class | Data1D |
A bounds-safe one-dimensional vector-like structure. More... | |
class | Data2D |
A bounds-safe two-dimensional resizeable structure. More... | |
class | Data3D |
A bounds-safe three-dimensional resizeable structure. More... | |
class | ErrorMsg |
An exception class that records where the exception was thrown and provides a stack trace. More... | |
class | ErrorMsgFatal |
A subtype of RC::ErrorMsg for Fatal errors. More... | |
class | ErrorMsgNull |
A subtype of RC::ErrorMsg for Null errors. More... | |
class | ErrorMsgBounds |
A subtype of RC::ErrorMsg for Bounds errors. More... | |
class | ErrorMsgMemory |
A subtype of RC::ErrorMsg for Memory errors. More... | |
class | ErrorMsgCast |
A subtype of RC::ErrorMsg for Bad Cast errors. More... | |
class | ErrorMsgFile |
A subtype of RC::ErrorMsg for File related errors. More... | |
class | ErrorMsgNet |
A subtype of RC::ErrorMsg for Networking related errors. More... | |
class | Segfault |
A static class for catching and throwing segfaults. More... | |
class | FileBase |
Provides the common methods for the FileRead/FileWrite/FileRW classes. More... | |
class | FileRead |
A file reading class that provides buffered and unbuffered access to files with support for non-POD classes. More... | |
class | FileWrite |
A file writing class that provides buffered and unbuffered output to files with support for non-POD classes. More... | |
class | FileRW |
A file class for both reading and writing that provides buffered and unbuffered output to files. More... | |
class | File |
A class with static methods for file and directory info and manipulation. More... | |
class | RAIter |
A bounds-checked iterator for random-access containers that knows when its target was deleted. More... | |
class | Sock |
A portable socket interface for reading and writing to an open socket. More... | |
class | Net |
Provides both client and server sides of blocking TCP connections. More... | |
class | Ptr |
A safe pointer class that throws an RC::ErrorMsgNull if a null dereference is attempted. More... | |
class | LoopIndex |
A size_t like integer class which automatically stays within its range. More... | |
class | HoldRelated |
Stores the value of type Hold while providing access via type Provide. More... | |
class | DebugTrack |
Inherit this class to add construction, destruction, and assignment output tracking. More... | |
class | DynamicLibrary |
Opens a dynamic library filename and stores a handle to it. Use as second parameter for RC_DYNAMIC_LOAD_FUNC(FuncName,DynLib) More... | |
class | RevPtr |
A reference counting pointer that revokes (NULLs) all copies when one set to AutoRevoke(true) leaves scope. More... | |
class | BaseRND |
An abstract class which provides functions for obtaining randomness in convenient forms. More... | |
class | RND |
A Mersenne Twister random number generator class with integer, array, or time-based seeding. More... | |
class | EntropyRND |
Provides true random numbers sourced from environmental noise. More... | |
class | URand |
Cryptographically strong RNG, uses /dev/urandom. More... | |
class | RStr |
A bounds-safe string class which provides an identical interface to std::string plus many convenience functions for string manipulation. More... | |
class | PluralStr |
Provides number-based singular/plural string management. More... | |
class | Time |
Accesses and formats the system date and time, and provides high precision timing. More... | |
class | TimeOfDay |
A class which obeys periodic time-of-day boundaries, and can manage times being within a daily time frame. More... | |
class | Tuple |
An efficient Tuple class with Set, Get, and an Apply function to pass the tuple contents on to any function. More... | |
class | Endian |
Auto-detects the endianness of the compilation target, and provides automatic endian conversion features. More... | |
Typedefs | |
typedef RAIter< RStr, char > | RStrIter |
The random-access iterator for RStr begin() and end() | |
template<class FT > | |
using | FuncPtr = FT * |
Clean C-style function pointers: FuncPtr<void(int)> f = &func; f(4);. | |
template<class C , class FT > | |
using | MemFuncPtr = FT(C::*) |
Clean function pointer syntax for member function. More... | |
Enumerations | |
enum | WriteMode { TRUNCATE =0 , KEEP , APPEND , NEWONLY } |
Valid write modes for a FileWrite or FileRW. More... | |
enum | RStr_IntStyle { DEC =100000 , HEX , HEX0x , OCT , OCT0 , BIN , CHAR } |
The styles in which an integral number can be formatted. More... | |
enum | RStr_FloatStyle { AUTO =100000 , FIXED , SCI } |
The styles in which a floating point number can be formatted. More... | |
Functions | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, APtr< T > obj) |
A convenience stream output for displaying the enclosed object. | |
template<class T , class... Args> | |
APtr< T > | MakeAPtr (Args &&... args) |
Create a new APtr<T> constructed with the given arguments. | |
std::ostream & | operator<< (std::ostream &out, const Bitfield &b) |
Outputs data to a stream as a character series of '1's and '0's. More... | |
std::ostream & | operator<< (std::ostream &out, const Bitfield2D &b) |
Outputs data to a stream as a character series of '1's and '0's, with newlines trailing each entry of dimension 2. More... | |
std::ostream & | operator<< (std::ostream &out, const Bitfield3D &b) |
Outputs data to a stream as a character series of '1's and '0's, with newlines trailing each entry of dimension 2, and double-spaces after entries of dimension 3. More... | |
template<class C , class Ret , class... Params> | |
Caller< Ret, Params... > | MakeCaller (C *obj, Ret(C::*func)(Params...)) |
Generates a Caller for the member function of the given object, with type inference. | |
template<class C , class Ret , class... Params> | |
Caller< Ret, Params... > | MakeCaller (C &obj, Ret(C::*func)(Params...)) |
Generates a Caller for the member function of the given object, with type inference. | |
template<class C , class Ret , class... Params> | |
Caller< Ret, C &, Params... > | MakeCaller (Ret(C::*func)(Params...)) |
Generates a Caller for the member function with type inference, inserting a first parameter with a reference to the object. | |
template<class Ret , class... Params> | |
Caller< Ret, Params... > | MakeCaller (Ret(*func)(Params...)) |
Generates a Caller for the specified static function, with type inference. | |
template<class Ret , class... Params, class Functor > | |
Caller< Ret, Params... > | MakeFunctor (Functor func) |
A special generator for functors, which requires specifying the return type and arguments. More... | |
template<class C , class MemberFunc > | |
auto | MakeCaller (Ptr< C > obj, MemberFunc func) -> decltype(MakeCaller(obj.Raw(), func)) |
Generates a Caller for the member function of the given object, with type inference. | |
template<class C , class MemberFunc > | |
auto | MakeCaller (APtr< C > obj, MemberFunc func) -> decltype(MakeCaller(obj.Raw(), func)) |
Generates a Caller for the member function of the given object, with type inference. | |
template<class C , class MemberFunc > | |
auto | MakeCaller (RevPtr< C > obj, MemberFunc func) -> decltype(MakeCaller(obj.Raw(), func)) |
Generates a Caller for the member function of the given object, with type inference. | |
std::ostream & | operator<< (std::ostream &out, const Data1D< char > &d) |
Outputs all chars to a stream without terminating at null. More... | |
std::ostream & | operator<< (std::ostream &out, const Data1D< u8 > &d) |
Outputs data to a stream as { 61, 62, ... }. More... | |
std::ostream & | operator<< (std::ostream &out, const Data1D< i8 > &d) |
Outputs data to a stream as { 61, -42, ... }. More... | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, const Data1D< T > &d) |
Outputs data to a stream as { elem0, elem1, ... }. More... | |
template<class T > | |
void | swap (RC::Data1D< T > &a, RC::Data1D< T > &b) |
Efficiently swap all the contents of a and b. | |
template<class T , size_t N> | |
auto | MakeData1D (T(&arr)[N]) -> RC::Data1D< T > |
Convenience generator for safely converting C-style arrays. | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, const Data2D< T > &d) |
Outputs data to a stream as { { x_0_0, x_1_0, ...}, { x_0_1, x_1_1, ...}, ... }. More... | |
template<class T2 > | |
void | swap (Data2D< T2 > &a, Data2D< T2 > &b) |
Efficiently swap all the contents of a and b. | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, const Data3D< T > &d) |
Outputs data to a stream. More... | |
template<class T2 > | |
void | swap (Data3D< T2 > &a, Data3D< T2 > &b) |
Efficiently swap all the contents of a and b. | |
template<class T > | |
bool | FileGetWrapper (FileRead &fr, T &data) |
Overload this with a specialization to support Get on a custom type. More... | |
template<class T > | |
void | FilePutWrapper (FileWrite &fw, const T &data) |
Overload this with a specialization to support Put on a custom type. More... | |
template<> | |
bool | FileGetWrapper< std::string > (FileRead &fr, std::string &data) |
A specialization for handling std::string objects. | |
template<> | |
void | FilePutWrapper< std::string > (FileWrite &fw, const std::string &data) |
A specialization for handling std::string objects. | |
template<class Cont , class T > | |
RAIter< Cont, T > | operator+ (size_t x, const RAIter< Cont, T > &iter) |
Returns a new iterator with an offset incremented by x. | |
template<class T > | |
void | UnusedVar (const T &) |
Mark an unused variable to suppress warnings. | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, Ptr< T > obj) |
A convenience stream output for displaying the enclosed object. | |
template<class T , class... Args> | |
Ptr< T > | MakePtr (Args &&... args) |
Create a new Ptr<T> constructed with the given arguments. | |
template<class T > | |
BetwCompare< T > | Betw (const T &x) |
Returns a comparator that can be used for range comparisons. More... | |
template<class... Args> | |
OneOfCompare< Args... > | OneOf (Args... args) |
Returns a comparator that can be used to check if something is in a list. More... | |
template<class T > | |
RangeHelper< T > | Range (const T &start, const T &past_the_end) |
Provides an iterator which dereferences to the iterated values [start,past_the_end). More... | |
template<class T2 > | |
auto | IndexOf (const T2 &cont) -> RangeHelper< decltype(cont.size())> |
Provides an iterator which dereferences to the indices of cont from [0,cont.size()). More... | |
template<class T , class T2 > | |
T | CheckedCast (const T2 &x) |
For integer and floating point types, Throws RC::ErrorMsgBounds if the value of x does not fit into T. Use as CheckedCast<T>(x) | |
template<class T , class T2 > | |
T | CappedCast (const T2 &x) |
For integer and floating point types, caps the cast value of x to be within bounds of type T. Use as CappedCast<T>(x) | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, RevPtr< T > obj) |
A convenience stream output for displaying the enclosed object. | |
template<class T , class... Args> | |
RevPtr< T > | MakeRevPtr (Args &&... args) |
Create a new RevPtr<T> constructed with the given arguments. | |
u64 | RND_Get_Range (u64 range) |
Uses RND as a RandomNumberGenerator, e.g. for random_shuffle. More... | |
u64 | EntropyRND_Get_Range (u64 range) |
Uses EntropyRND as a RandomNumberGenerator, e.g. for random_shuffle. More... | |
u64 | URand_Get_Range (u64 range) |
Uses URand as a RandomNumberGenerator, e.g. for random_shuffle. More... | |
RND & | RND_Gen () |
This returns a singleton of RND . | |
EntropyRND & | EntropyRND_Gen () |
This returns a singleton of EntropyRND . | |
URand & | URand_Gen () |
This returns a singleton of URand . | |
RStr | operator+ (const RStr &lhs, const RStr &rhs) |
Concatenates two RStr'ings. | |
std::istream & | operator>> (std::istream &in, RStr &rstr) |
Input text from a std::istream (e.g., std::cin) into an RStr. | |
std::ostream & | operator<< (std::ostream &out, const RStr &rstr) |
Output text from an RStr to a std::ostream (e.g., std::cout). | |
void | swap (RStr &lhs, RStr &rhs) |
Swaps two RStr'ings. | |
std::istream & | getline (std::istream &is, RStr &str, char delim='\n') |
Sets str equal to one line from the input stream, up to end of file or the delim, which is discarded. | |
bool | operator== (const RStr &lhs, const RStr &rhs) |
True if lhs equals rhs. | |
bool | operator!= (const RStr &lhs, const RStr &rhs) |
True if lhs does not equal rhs. | |
bool | operator< (const RStr &lhs, const RStr &rhs) |
True if lhs is less than rhs. | |
bool | operator> (const RStr &lhs, const RStr &rhs) |
True if lhs is greater than rhs. | |
bool | operator<= (const RStr &lhs, const RStr &rhs) |
True if lhs is less than or equal to rhs. | |
bool | operator>= (const RStr &lhs, const RStr &rhs) |
True if lhs is greater than or equal to rhs. | |
const RStr | REG_FLT ("[-+]?[0-9]*\\.?[0-9]+[eE][-+]?[0-9]+|[-+]?[0-9]*\\.?[0-9]+") |
A regular expression component to match a floating point number. | |
const RStr | REG_FLTP ("([-+]?[0-9]*\\.?[0-9]+[eE][-+]?[0-9]+|[-+]?[0-9]*\\.?[0-9]+)") |
A regular expression component to match and return a floating point number. | |
template<class... Types> | |
Tuple< Types... > | MakeTuple (Types... types) |
A convenience generator to make a Tuple from the given elements with type inference. | |
template<class T > | |
bool | IsSignedType (const T &x __attribute__((unused))=0) |
True if the type is signed. More... | |
template<class T > | |
bool | IsIntegerType (const T &x __attribute__((unused))=1) |
True if the type is an integer type. More... | |
template<class T > | |
void | AssertFloat () |
For generating compilation errors if the type is not a float. | |
template<class T > | |
void | AssertInteger () |
For generating compilation errors if the type is not an integer. | |
template<class T > | |
auto | ForceFloat (T val) -> typename ForceFloatHelper< T, FloatType< T >::value >::type |
If T is a float type, return the same type. Otherwise return it as an f64. | |
template<class T > | |
std::make_unsigned< T >::type | ForceUnsigned (T val) |
Returns the unsigned equivalent to the given type. | |
template<class T > | |
std::make_signed< T >::type | ForceSigned (T val) |
Returns the signed equivalent to the given type. | |
template<class T > | |
T | MIN_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::min()) |
Provide the minimum value held by this type. For floats, the smallest positive value. More... | |
template<class T > | |
T | MAX_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::max()) |
Provide the maximum value held by this type. More... | |
template<class T > | |
T | LOW_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::lowest()) |
Provide the lowest value held by this type, for which no value is less. More... | |
template<class T > | |
T | MIN_POS (const T &x __attribute__((unused))=MIN_POS_Helper< T, FloatType< T >::value >::F()) |
Provide the minimum positive value held by this type. More... | |
Variables | |
const size_t | ErrorMsg_text_size = 4095 |
The maximum size of the char array returned by ErrorMsg::what() and ErrorMsg::GetError(), including the null. | |
const size_t | ErrorMsg_type_bufsize = 256 |
The maximum size of the char array returned by ErrorMsg::GetType(), including the null. | |
Note: RC_EMPTY, RC_ARGS_NUM, RC_ARGS_EACH, RC_ARGS_BET, RC_ARGS_LIST, and RC_DEBOUT require each of their parameters to begin with a letter, number, or underscore.
using RC::MemFuncPtr = typedef FT(C::*) |
Clean function pointer syntax for member function.
MemFuncPtr<A, void(int)> f = &A::func; A a; (a.*f)(4);
enum RC::RStr_FloatStyle |
The styles in which a floating point number can be formatted.
AUTO == determine the format automatically, FIXED == as 0.0000123, SCI == as 1.23e-5 SCI treats the precision parameter as a count of significant digits. FIXED treats the precision parameter as digits right of the decimal point. AUTO treats the precision parameter as the most significant digits to show, but trims trailing zeros.
enum RC::RStr_IntStyle |
The styles in which an integral number can be formatted.
DEC == decimal, HEX == hexadecimal, HEX0x == hexadecimal with "0x" prepended, OCT == octal, OCT0 == octal with "0" prepended, BIN == binary, CHAR == treated as a character.
enum RC::WriteMode |
Valid write modes for a FileWrite or FileRW.
TRUNCATE sets the file size to 0. KEEP preserves the file contents, setting the initial position to the beginning of the file. APPEND starts the read position at the beginning of the file but all Write/Put operations are forced to the end of the file. NEWONLY will only succeed if the file does not already exist.
BetwCompare<T> RC::Betw | ( | const T & | x | ) |
Returns a comparator that can be used for range comparisons.
Usage exmple: if (3.14 < Betw(5) <= 7) { cout << "Yes\n"; } Works for any comparable types, as long as one of the left-most two in the chain is wrapped in Betw.
Uses EntropyRND as a RandomNumberGenerator, e.g. for random_shuffle.
range | The range of values that can be returned, starting with 0. |
|
inline |
Overload this with a specialization to support Get on a custom type.
The default FileGetWrapper for plain old data, which calls RawGet.
An implementation of this should use the FileRead's methods Get and RawGet to read other supported types or primitives, then place the result in data.
|
inline |
Overload this with a specialization to support Put on a custom type.
The default FilePutWrapper for plain old data, which calls RawPut.
An implementation of this should take the value of data and use the FileWrite's methods Put and RawPut to write other supported types or primitives.
|
inline |
Provides an iterator which dereferences to the indices of cont from [0,cont.size()).
Usage example: for (auto i : IndexOf(cont)) { cout << cont[i]; }
|
inline |
True if the type is an integer type.
Use as IsIntegerType<u32>() or u32 x; IsIntegerType(x);
|
inline |
True if the type is signed.
Use as IsSignedType<u32>() or u32 x; IsSignedType(x);
|
inline |
Provide the lowest value held by this type, for which no value is less.
Use as LOW_VAL<f32>() or as f32 x = LOW_VAL(x);
Caller<Ret, Params...> RC::MakeFunctor | ( | Functor | func | ) |
A special generator for functors, which requires specifying the return type and arguments.
Template parameters are specified as the return type followed by a list of the arguments.
|
inline |
Provide the maximum value held by this type.
Use as MAX_VAL<u32>() or as u32 x = MAX_VAL(x);
|
inline |
Provide the minimum positive value held by this type.
Use as MIN_POS<f32>() or as f32 x = MIN_POS(x);
|
inline |
Provide the minimum value held by this type. For floats, the smallest positive value.
Use as MIN_VAL<u32>() or as u32 x = MIN_VAL(x);
OneOfCompare<Args...> RC::OneOf | ( | Args... | args | ) |
Returns a comparator that can be used to check if something is in a list.
Each element given as a parameter to OneOf is constructed with the type of the object left of the == or != operator. Usage exmple: RStr str = "foo"; if (str != OneOf("bar", -3.54, "blah")) { cout << "Not Found\n"; } int x = 8; if (5 == OneOf(3.14, 5, x)) { cout << "Found\n"; }
|
inline |
Outputs data to a stream as a character series of '1's and '0's.
Usage like Bitfield bf; std::cout << bf << std::endl;
|
inline |
Outputs data to a stream as a character series of '1's and '0's, with newlines trailing each entry of dimension 2.
Usage like Bitfield2D bf; std::cout << bf << std::endl;
|
inline |
Outputs data to a stream as a character series of '1's and '0's, with newlines trailing each entry of dimension 2, and double-spaces after entries of dimension 3.
Usage like Bitfield3D bf; std::cout << bf << std::endl;
|
inline |
Outputs all chars to a stream without terminating at null.
Usage like: Data1D<char> data; std::cout << data << std::endl;
Outputs data to a stream as { 61, -42, ... }.
Usage like: Data1D<i8> data; std::cout << data << std::endl;
|
inline |
Outputs data to a stream as { elem0, elem1, ... }.
Usage like: Data1D<RStr> data; std::cout << data << std::endl;
Outputs data to a stream as { 61, 62, ... }.
Usage like: Data1D<u8> data; std::cout << data << std::endl;
|
inline |
Outputs data to a stream as { { x_0_0, x_1_0, ...}, { x_0_1, x_1_1, ...}, ... }.
Usage like: Data2D<RStr> data; std::cout << data << std::endl;
|
inline |
Outputs data to a stream.
For d_x_y_z, formatted as { { { d_0_0_0, d_1_0_0, ...}, { d_0_1_0, d_1_1_0, ...}, ... }, { { d_0_0_1, d_1_0_1, ...}, { d_0_1_1, d_1_1_1, ...}, ... }, ... } Usage like: Data3D<RStr> data; std::cout << data << std::endl;
|
inline |
Provides an iterator which dereferences to the iterated values [start,past_the_end).
Usage example, outputs 5 through 9: for (auto i : Range(5, 10)) { cout << i << endl; } This is a generalization, since: for (auto iter : Range(cont.begin(), cont.end())) { ... } is equivalent to the canonical: for (auto iter : cont) { ... }
Uses RND as a RandomNumberGenerator, e.g. for random_shuffle.
range | The range of values that can be returned, starting with 0. |