base Namespace Reference

Library of base code. More...


Classes

class  Array
 Array template class similar to STL vector but checks index and can be Shared. More...
class  Array2D
 2D array that clamps indexs. More...
class  SmallArray
 Pretends to have a variable-size (but underlying array is fixed-size). More...
class  TinyArray
 Light-weight fixed-length Array class with index-checking. More...
class  AssertException
 Exception thrown when ASSERT*() evaluates false. More...
class  AutoFlag
 Automatically ensures a flag is cleared before a function returns. ~AutoFlag() will be invoked regardless of an unexpected early return or exception. More...
class  Bits
 Portable bit-field class. More...
class  Conf
 Module configuration. More...
class  ConfBin
 Storing and reading configuration (key,value) to a file. More...
class  ConfTxt
 Template Method to read human-editable textual conf file via C++ stream. More...
class  Event
 Broadcasts events to registered listener functors. More...
class  Exception
 Base Exception class. More...
class  Globals
 Globals class defines the order of construction of globals. More...
class  AbstractIterator
 Abstract class for Iterator objects. More...
class  STLIterator
 Iterator object for STL vectors. More...
struct  InitArgs
 InitArgs struct is passed to Init() of every module. More...
class  Multivar
 A variable with multiple values of the same type. More...
class  Percent
 Percent. More...
class  Random
 Random number generator (sudo/real). More...
class  SafePtr
 Template class to prevent deleting an object by its pointer (see base/safe_ptr_doc.hh). More...
class  Shared
 Shared is a base class with an intrusive reference-count maintained by shptr/shptr0. More...
class  shptr
 shptr is a smart pointer that maintains a reference-count of Shared objects. More...
class  shptr0
 shptr0 is a nullable smart pointer that maintains a reference-count of Shared objects. More...
class  RefPtr
 RefPtr is an alias of osg::ref_ptr for OSG objects. More...
class  Singleton
 Singleton base class. More...
class  Stack
 Stack template class. More...
class  gzstreambuf
 Internal classes to implement gzstream. See below for user classes. More...
class  gzstreambase
 Internal classes to implement gzstream. See below for user classes. More...
class  igzstream
 C++ stream class (input) to decompress using zlib/gzip. User classes. Use igzstream and ogzstream analogously to ifstream and ofstream respectively. They read and write files based on the gz* function interface of the zlib. Files are compatible with gzip compression. http://www.cs.unc.edu/Research/compgeom/gzstream/. More...
class  ogzstream
 C++ stream class (output) to compress using zlib/gzip. http://www.cs.unc.edu/Research/compgeom/gzstream/. More...
class  StringBuf
 Basic string buffer class. More...
struct  Milliseconds
 Time units as distinct SIGNED INTEGER types. More...
struct  Microseconds
struct  Seconds
struct  Minutes
struct  Hours
class  TimeClock
 System-specific time functions. More...
class  Timer
 Singleton to register, unregister, and invoke timer-tick callbacks. More...
class  Void
 Void that can be instantiated (useful with templates). More...
class  bool0
 Fundamental type auto-initialized as zero. More...
class  int0
 Fundamental type auto-initialized as zero. More...
class  uint0
 Fundamental type auto-initialized as zero. More...

Namespaces

namespace  defs
namespace  global
namespace  RESTRICT
 Internal.

Typedefs

typedef int64 TimeInt
typedef int8_t int8
typedef uint8_t uint8
typedef int16_t int16
typedef uint16_t uint16
typedef int32_t int32
typedef uint32_t uint32
typedef int64_t int64
typedef uint64_t uint64
typedef unsigned int typesig_t

Enumerations

enum  eNumberFormat { eNumberFormat_DEFAULT = 0, eNumberFormat_NO_SHOW_BASE = (1 << 0), eNumberFormat_SHOW_PLUS = (1 << 1), eNumberFormat_PAD_ZEROS = (1 << 2) }
enum  {
  TYPESIG_INVALID = 0, TYPESIG = 0x1234aabb, TYPESIG_SHARED = (UINT_CAST('s')<<24) | (UINT_CAST('h')<<16) | (UINT_CAST('a')<<8) | UINT_CAST('r'), TYPESIG_SHARED_PTR = (UINT_CAST('s')<<24) | (UINT_CAST('h')<<16) | (UINT_CAST('p')<<8) | UINT_CAST('t'),
  TYPESIG_DLINK = (UINT_CAST('l')<<24) | (UINT_CAST('i')<<16) | (UINT_CAST('n')<<8) | UINT_CAST('k'), TYPESIG_DLIST = (UINT_CAST('l')<<24) | (UINT_CAST('i')<<16) | (UINT_CAST('s')<<8) | UINT_CAST('t'), TYPESIG_ITER = (UINT_CAST('i')<<24) | (UINT_CAST('t')<<16) | (UINT_CAST('e')<<8) | UINT_CAST('r'), TYPESIG_STACK = (UINT_CAST('s')<<24) | (UINT_CAST('t')<<16) | (UINT_CAST('a')<<8) | UINT_CAST('c'),
  TYPESIG_UNIQUE = (UINT_CAST('u')<<24) | (UINT_CAST('n')<<16) | (UINT_CAST('i')<<8) | UINT_CAST('q'), TYPESIG_UNIQUE_FACTORY = (UINT_CAST('u')<<24) | (UINT_CAST('n')<<16) | (UINT_CAST('f')<<8) | UINT_CAST('a'), TYPESIG_SORTED_ARRAY = (UINT_CAST('s')<<24) | (UINT_CAST('o')<<16) | (UINT_CAST('a')<<8) | UINT_CAST('r'), TYPESIG_CONF_TUPLE = (UINT_CAST('c')<<24) | (UINT_CAST('f')<<16) | (UINT_CAST('t')<<8) | UINT_CAST('u'),
  TYPESIG_TIMER_CALLBACK = (UINT_CAST('t')<<24) | (UINT_CAST('i')<<16) | (UINT_CAST('c')<<8) | UINT_CAST('b')
}

Functions

template<uint FIXED_SIZE, typename T>
bool operator< (const SmallArray< FIXED_SIZE, T > &a1, const SmallArray< FIXED_SIZE, T > &a2)
template<uint COUNT, typename T>
bool operator< (const TinyArray< COUNT, T > &a1, const TinyArray< COUNT, T > &a2)
NOINLINE void ASSERT_STACK_OBJECT (const void *obj)
NOINLINE void ASSERT_PERSISTENT_OBJECT (const void *obj)
template<typename T>
SetBit (const T val, const int bit)
template<typename T>
ClearBit (const T val, const int bit)
template<typename SIGNED>
SIGNED Clamp (const SIGNED n, const SIGNED limit)
template<typename T>
Clamp (const T n, const T low, const T high)
INLINE fp Clamp1 (const fp f)
INLINE uint8 ClampFF (const uint ui)
INLINE uint8 ClampFF (const int i)
INLINE uint8 ClampFF (const fp f)
ostream & operator<< (ostream &strm, const Conf &conf)
const string & GetDataDir (void)
INLINE ConfGetConf (void)
string CheckObsoleteConfFilename (const string &programName)
bool CompareTuples (const ConfBin::ConfTuple &t1, const ConfBin::ConfTuple &t2)
string GetConfTxtFilename (const string &programName)
unsigned long MemoryUsed (void)
void MeasureTime (void(*func)(long), long funcArg, const string &funcName)
void PrintException (const std::exception &ex, const string &functionName)
bool IfFileExists (const string &fname)
long FileSize (FILE *file)
long FileSize (const string &fname)
bool ReadFile (const string &fname, string &obuf)
bool ReadFile (const string &fname, StringBuf &strbuf)
bool ReadFileGzipIntoString (const string &fname, string &obuf, const uint chunkLen)
pair< void *, long > ReadFileGzipIntoMemory (const string &fname)
bool RemoveFile (const string &fname)
void RemoveSuffix (string &fname, const string &suffix)
bool IfPathIsAbsolute (const string &path)
string FileBasename (const string &path)
bool IfPathIsFilename (const string &path)
bool MakeDir (const string &path)
bool IfDirExists (const string &dirname)
bool FilesInDir (const string &dirname, vector< string > &vec)
string GetCwd (void)
template<typename T>
T * PTR (vector< T > &v)
template<typename T>
const T * CONST_PTR (const vector< T > &v)
template<typename SEQCONT>
void Expand (SEQCONT &seqcont, uint idx)
template<typename T>
void Remove (vector< T > &container, T item)
template<typename T>
void Remove (deque< T > &container, T item)
template<typename T>
void Remove (list< T > &container, T item)
template<typename KEY>
void Remove (set< KEY > &container, KEY item)
template<typename KEY, typename VAL>
void Remove (map< KEY, VAL > &container, VAL item)
template<typename CONTAINER>
bool IfDuplicate (const CONTAINER &c1, const CONTAINER &c2)
int Argi (int idx, int argc_, char **argv_)
float Argf (int idx, int argc_, char **argv_)
string Argstr (int idx, int argc_, char **argv_)
void CmdargDone (int i, int n)
bool IfCmdargDone (int i)
fp FormatMegabyte (const long bytes)
void LowerCase (string &s)
void UpperCase (string &s)
string SignedHexNumber2String (const long signedHexValue, const uint minWidth, const eNumberFormat format)
INTERN void SelfCheck (void)
void SelfCheck_IF_NAN (volatile fp *zero)
INTERN void EXIT0 (void)
void Init (const InitArgs &initArgs)
void Start (void)
void EXIT (int exitCode)
template<typename T>
bool operator== (const SafePtr< T > &ptr, const T *obj)
template<typename T>
bool operator!= (const SafePtr< T > &ptr, const T *obj)
template<typename T>
bool operator== (const T *obj, const SafePtr< T > &ptr)
template<typename T>
bool operator!= (const T *obj, const SafePtr< T > &ptr)
template<typename T1, typename T2>
bool operator== (const T1 *obj, const SafePtr< T2 > &ptr)
template<typename T1, typename T2>
bool operator!= (const T1 *obj, const SafePtr< T2 > &ptr)
template<typename T1, typename T2>
bool operator== (const SafePtr< T1 > &ptr1, const SafePtr< T2 > &ptr2)
template<typename T1, typename T2>
bool operator!= (const SafePtr< T1 > &ptr1, const SafePtr< T2 > &ptr2)
template<typename T>
bool operator< (const SafePtr< T > &ptr1, const SafePtr< T > &ptr2)
bool StreamOpen (fstream &fs, ios::openmode bits, const string &filename)
 Helpers for C++ streams.
bool StreamReadLine (istream &strm, string &line)
bool StreamToNextLine (istream &strm)
bool StreamPeek (istream &strm, const string &word)
const string DIRECTORY_SEPARATOR_STRING ("/")
template<typename NUM_TYPE>
NUM_TYPE Microseconds2Milliseconds (NUM_TYPE microseconds)
template<typename NUM_TYPE>
NUM_TYPE Milliseconds2Microseconds (NUM_TYPE milliseconds)
template<typename NUM_TYPE>
NUM_TYPE Seconds2Milliseconds (NUM_TYPE seconds)
template<typename NUM_TYPE>
NUM_TYPE Minutes2Milliseconds (NUM_TYPE minutes)
template<typename NUM_TYPE>
NUM_TYPE Microseconds2Seconds (NUM_TYPE microseconds)
template<typename NUM_TYPE>
NUM_TYPE Milliseconds2Seconds (NUM_TYPE milliseconds)
const Milliseconds TIME_CLOCK_ADEQUATE_TIMER_MILLISECONDS (1000/TIME_CLOCK_DESIRED_HZ)
 reject timer that is less frequent
const Milliseconds TICK_CLOCK_CORRECTED_DELTA_MILLISECONDS (1000/TIME_CLOCK_DESIRED_HZ)
 artificial time-delta if calendar-clock was skewed
INTERN Milliseconds ComputeElapsedTimeFromCounter (const Milliseconds startMilliseconds, const Milliseconds currentMilliseconds)
INTERN void PrintErrorTimeDelta (const Milliseconds deltaMilliseconds)
INTERN Milliseconds CorrectClockSkew (const Milliseconds delta)

Variables

INTERN char sDummyArg0 [1] = { 0 }
INTERN char * sDummyArgv [] = { sDummyArg0 }
INTERN const string BASE_CONF_BIN_VERSION_STR = "(gfx::ConfigFile v2)"
bool BASE_DEBUG_BUILD = true
const uint BASE_MAX_PATH = 256
BASE_GLOBAL Globals gGlobals
 the dreaded Globals var
INTERN bool sCmdargDone [100]
const int32 DEFAULT_RANDOM_SEED = 0x2b3e27bd
const uint TIME_CLOCK_DESIRED_HZ = 100
 desired frequency/Hz
const bool TIMER_ENABLED = true
const bool TIMER_DISABLED = false
const uint INT_BITS = sizeof(int) * 8
const uint LONG_BITS = sizeof(long) * 8
const uint POINTER_BITS = sizeof(void*) * 8


Detailed Description

Library of base code.

Typedef Documentation

typedef int16_t base::int16

typedef int32_t base::int32

typedef int64_t base::int64

typedef int8_t base::int8

typedef unsigned int base::typesig_t

typedef uint16_t base::uint16

typedef uint32_t base::uint32

typedef uint64_t base::uint64

typedef uint8_t base::uint8


Enumeration Type Documentation

anonymous enum

Enumerator:
TYPESIG_INVALID 
TYPESIG 
TYPESIG_SHARED 
TYPESIG_SHARED_PTR 
TYPESIG_DLINK 
TYPESIG_DLIST 
TYPESIG_ITER 
TYPESIG_STACK 
TYPESIG_UNIQUE 
TYPESIG_UNIQUE_FACTORY 
TYPESIG_SORTED_ARRAY 
TYPESIG_CONF_TUPLE 
TYPESIG_TIMER_CALLBACK 

Enumerator:
eNumberFormat_DEFAULT 
eNumberFormat_NO_SHOW_BASE 
eNumberFormat_SHOW_PLUS 
eNumberFormat_PAD_ZEROS 


Function Documentation

float base::Argf ( int  idx,
int  argc_,
char **  argv_ 
)

int base::Argi ( int  idx,
int  argc_,
char **  argv_ 
)

Safely process a cmd-line arg.

Returns:
Zero if arg idx is invalid.

string base::Argstr ( int  idx,
int  argc_,
char **  argv_ 
)

void base::ASSERT_PERSISTENT_OBJECT ( const void *  obj  ) 

void base::ASSERT_STACK_OBJECT ( const void *  obj  ) 

ASSERT_PERSISTENT_OBJECT(): Assert that an object is in persistent storage (ie, not on call stack).

ASSERT_STACK_OBJECT(): Assert that an object is a local object on call stack.

Technically, these aren't portable. But in fact, most OSs place a grow-down stack at the top of the address space of a process.

These are real functions, rather than macros, to induce a function call to place the object and a known stack variable in separate stack frames. Otherwise, if both were on the same stack frame, there's no way to predict whether the compiler places one above or below the other.

string base::CheckObsoleteConfFilename ( const string &  programName  ) 

Check for obsolete ~/.palomino.cfg. It was obsoleted 2008/08/10.

Returns:
Obsolete filename or empty string.

template<typename T>
T base::Clamp ( const T  n,
const T  low,
const T  high 
) [inline]

Clamp number to range {low,..,high} inclusive.

template<typename SIGNED>
SIGNED base::Clamp ( const SIGNED  n,
const SIGNED  limit 
) [inline]

Clamp SIGNED number in range {0,...,limit} inclusive. For unsigned numbers, use MAX(limit) which is faster.

INLINE fp base::Clamp1 ( const fp  f  ) 

Clamp fp to within range {0.0,...,1.0} inclusive.

INLINE uint8 base::ClampFF ( const fp  f  ) 

INLINE uint8 base::ClampFF ( const int  i  ) 

INLINE uint8 base::ClampFF ( const uint  ui  ) 

Clamp number to 8-bit range {0x00,..,0xff}. ClampFF(uint) is the fastest.

template<typename T>
T base::ClearBit ( const T  val,
const int  bit 
) [inline]

void base::CmdargDone ( int  i,
int  n 
)

bool base::CompareTuples ( const ConfBin::ConfTuple t1,
const ConfBin::ConfTuple t2 
)

Used to sort firstly by type, secondly by key.

INTERN Milliseconds base::ComputeElapsedTimeFromCounter ( const Milliseconds  startMilliseconds,
const Milliseconds  currentMilliseconds 
)

Specifically for counters (not calendar-clocks). Compute elapsed seconds as delta of start and current counter. Throws exception if counter overflowed.

template<typename T>
const T* base::CONST_PTR ( const vector< T > &  v  )  [inline]

INTERN Milliseconds base::CorrectClockSkew ( const Milliseconds  delta  ) 

Detect/correct clock-skew in a delta of time.

const string base::DIRECTORY_SEPARATOR_STRING ( "/"   ) 

void base::EXIT ( int  exitCode  ) 

Exit to MSDOS.

INTERN void base::EXIT0 ( void   ) 

template<typename SEQCONT>
void base::Expand ( SEQCONT &  seqcont,
uint  idx 
) [inline]

Expand a sequential STL container if necessary. Useful before operator[] to ensure container can hold it.

string base::FileBasename ( const string &  path  ) 

Returns:
Base part of filename without directories.

bool base::FilesInDir ( const string &  dirname,
vector< string > &  vec 
)

Fills a STL vector with filenames from a directory.

 * Example of usage:
 *  vector<string> files;
 *  if ( FilesInDir( "/tmp", files ) )
 *  {
 *      vector<string>::iterator iter;
 *      for ( iter = files.begin(); iter != files.end(); ++iter )
 *          cout << *iter << "\n";
 *  }
 * 

long base::FileSize ( const string &  fname  ) 

Returns:
Size of a file else -1.

long base::FileSize ( FILE *  file  ) 

Returns:
Size of an opened file else -1.

fp base::FormatMegabyte ( const long  bytes  ) 

cygwin lacks strcasestr(). This code came from FreeBSD. http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/string/strcasestr.c?rev=1.4;content-type=text%2Fplain Convert bytes for printing as "n.nMB".

INLINE Conf& base::GetConf ( void   ) 

string base::GetConfTxtFilename ( const string &  programName  ) 

Returns:
Filename of textual conf file (for ConfTxt).

string base::GetCwd ( void   ) 

Returns:
CWD as a C++ string.

const string & base::GetDataDir ( void   ) 

Returns:
Directory pathname containing the data/ subdirectory.
Precondition:
BASE_CONF.mProgramName was assigned.

bool base::IfCmdargDone ( int  i  ) 

bool base::IfDirExists ( const string &  dirname  ) 

Returns:
True if directory exists.

template<typename CONTAINER>
bool base::IfDuplicate ( const CONTAINER &  c1,
const CONTAINER &  c2 
) [inline]

Returns:
True if two STL containers have duplicates.

bool base::IfFileExists ( const string &  fname  ) 

Returns:
True if file exists.

bool base::IfPathIsAbsolute ( const string &  path  ) 

Returns:
True if a pathname is absolute.

bool base::IfPathIsFilename ( const string &  path  ) 

Returns:
True if a pathname is purely a filename (no directory slashes nor drive names).

void view::Init ( const InitArgs initArgs  ) 

Initialize module.

void base::LowerCase ( string &  s  ) 

Conver string in-place to lower-case.

bool base::MakeDir ( const string &  path  ) 

Make a directory.

void base::MeasureTime ( void(*)(long)  func,
long  funcArg,
const string &  funcName 
)

Measure the amount of time a function takes.

unsigned long base::MemoryUsed ( void   ) 

Return total amount of bytes allocated.

template<typename NUM_TYPE>
NUM_TYPE base::Microseconds2Milliseconds ( NUM_TYPE  microseconds  )  [inline]

template<typename NUM_TYPE>
NUM_TYPE base::Microseconds2Seconds ( NUM_TYPE  microseconds  )  [inline]

template<typename NUM_TYPE>
NUM_TYPE base::Milliseconds2Microseconds ( NUM_TYPE  milliseconds  )  [inline]

template<typename NUM_TYPE>
NUM_TYPE base::Milliseconds2Seconds ( NUM_TYPE  milliseconds  )  [inline]

template<typename NUM_TYPE>
NUM_TYPE base::Minutes2Milliseconds ( NUM_TYPE  minutes  )  [inline]

template<typename T1, typename T2>
bool base::operator!= ( const SafePtr< T1 > &  ptr1,
const SafePtr< T2 > &  ptr2 
) [inline]

template<typename T1, typename T2>
bool base::operator!= ( const T1 *  obj,
const SafePtr< T2 > &  ptr 
) [inline]

template<typename T>
bool base::operator!= ( const T *  obj,
const SafePtr< T > &  ptr 
) [inline]

template<typename T>
bool base::operator!= ( const SafePtr< T > &  ptr,
const T *  obj 
) [inline]

template<typename T>
bool base::operator< ( const SafePtr< T > &  ptr1,
const SafePtr< T > &  ptr2 
) [inline]

template<uint COUNT, typename T>
bool base::operator< ( const TinyArray< COUNT, T > &  a1,
const TinyArray< COUNT, T > &  a2 
) [inline]

template<uint FIXED_SIZE, typename T>
bool base::operator< ( const SmallArray< FIXED_SIZE, T > &  a1,
const SmallArray< FIXED_SIZE, T > &  a2 
) [inline]

ostream & base::operator<< ( ostream &  strm,
const Conf &  conf 
)

Print Conf configuration.

template<typename T1, typename T2>
bool base::operator== ( const SafePtr< T1 > &  ptr1,
const SafePtr< T2 > &  ptr2 
) [inline]

template<typename T1, typename T2>
bool base::operator== ( const T1 *  obj,
const SafePtr< T2 > &  ptr 
) [inline]

template<typename T>
bool base::operator== ( const T *  obj,
const SafePtr< T > &  ptr 
) [inline]

template<typename T>
bool base::operator== ( const SafePtr< T > &  ptr,
const T *  obj 
) [inline]

INTERN void base::PrintErrorTimeDelta ( const Milliseconds  deltaMilliseconds  ) 

Print the incorrect time-delta caused by clock-skew.

void base::PrintException ( const std::exception &  ex,
const string &  functionName 
)

Print exception.

template<typename T>
T* base::PTR ( vector< T > &  v  )  [inline]

Get raw C array from STL vector. &v[0] is a STL idiom.

bool base::ReadFile ( const string &  fname,
StringBuf &  strbuf 
)

Read a file into a StringBuf object. A StringBuf can be used with shptr.

bool base::ReadFile ( const string &  fname,
string &  obuf 
)

Read a file into a C++ string.

pair< void *, long > base::ReadFileGzipIntoMemory ( const string &  fname  ) 

Decompress a gzip-compressed file (.gz) using zlib functions into a raw memory buffer.

bool base::ReadFileGzipIntoString ( const string &  fname,
string &  obuf,
const uint  chunkLen 
)

Decompress a gzip-compressed file (.gz) using zlib functions into a C++ string.

Parameters:
fname 
obuf Output buffer.
chunkLen Default arg. For speed, pass expected size of decompressed buffer.
Remarks:
gzread() is smart enough to function like fread() without returning an error in case a file isn't really gzip-compressed.

template<typename KEY, typename VAL>
void base::Remove ( map< KEY, VAL > &  container,
VAL  item 
) [inline]

template<typename KEY>
void base::Remove ( set< KEY > &  container,
KEY  item 
) [inline]

template<typename T>
void base::Remove ( list< T > &  container,
item 
) [inline]

template<typename T>
void base::Remove ( deque< T > &  container,
item 
) [inline]

template<typename T>
void base::Remove ( vector< T > &  container,
item 
) [inline]

Remove() is a compatible way to remove items from various STL containers. Does NOT destroy/delete items.

bool base::RemoveFile ( const string &  fname  ) 

Delete a file. Will normally return false if file doesn't exist (not really an error) since remove() is based on unlink().

void base::RemoveSuffix ( string &  fname,
const string &  suffix 
)

Remove suffix from a pathname. Pass ".txt" rather than "txt".

template<typename NUM_TYPE>
NUM_TYPE base::Seconds2Milliseconds ( NUM_TYPE  seconds  )  [inline]

INTERN void base::SelfCheck ( void   ) 

Ensure assumptions of this code hold on this platform. A serious failure causes program to exit.

void base::SelfCheck_IF_NAN ( volatile fp zero  ) 

template<typename T>
T base::SetBit ( const T  val,
const int  bit 
) [inline]

Trivial but convenient for enumerations.

string base::SignedHexNumber2String ( const long  signedHexValue,
const uint  minWidth,
const eNumberFormat  format 
)

Returns:
Signed hex number as a C++ string. Neither sprintf() nor C++ streams will produce a signed hex number.

void view::Start ( void   ) 

Start module.

bool base::StreamOpen ( fstream &  fs,
ios::openmode  bits,
const string &  filename 
)

Helpers for C++ streams.

Open a stream to a file.

Parameters:
fs File stream.
bits Open for reading and/or writing.
filename 
Returns:
False if stream error.

bool base::StreamPeek ( istream &  strm,
const string &  word 
)

Peek input stream.

Returns:
True if word is in input stream.

bool base::StreamReadLine ( istream &  strm,
string &  line 
)

Read all chars to EOL.

Returns:
False if stream error.

bool base::StreamToNextLine ( istream &  strm  ) 

Jump to the next line.

Returns:
False if stream error.

const Milliseconds base::TICK_CLOCK_CORRECTED_DELTA_MILLISECONDS ( 1000/  TIME_CLOCK_DESIRED_HZ  ) 

artificial time-delta if calendar-clock was skewed

const Milliseconds base::TIME_CLOCK_ADEQUATE_TIMER_MILLISECONDS ( 1000/  TIME_CLOCK_DESIRED_HZ  ) 

reject timer that is less frequent

void base::UpperCase ( string &  s  ) 

Convert string in-place to upper-case.


Variable Documentation

INTERN const string base::BASE_CONF_BIN_VERSION_STR = "(gfx::ConfigFile v2)"

const int32 base::DEFAULT_RANDOM_SEED = 0x2b3e27bd

BASE_GLOBAL Globals base::gGlobals

the dreaded Globals var

const uint base::INT_BITS = sizeof(int) * 8

const uint base::LONG_BITS = sizeof(long) * 8

const uint base::POINTER_BITS = sizeof(void*) * 8

INTERN bool base::sCmdargDone[100]

Functions for marking a command-line arg as "done". For helping to catch unrecognized args.

Parameters:
i argv[i]
n How many consecutive args are "done" (default n=1).

INTERN char base::sDummyArg0[1] = { 0 }

INTERN char* base::sDummyArgv[] = { sDummyArg0 }

desired frequency/Hz

const bool base::TIMER_DISABLED = false

const bool base::TIMER_ENABLED = true

Palomino Flight Simulator documents generated by doxygen 1.5.6 on Tue Sep 28 11:37:49 2010