Classes | Macros | Enumerator | Functions | Variables | Friends
clanCore System

## Classes
class | clan::BlockAllocated
| Class with operator new/delete overloads for BlockAllocator. More...
class | clan::BlockAllocator
| Memory allocator that allocates in blocks. More...
class | clan::ConsoleWindow
| Text console window. More...
class | clan::DataBuffer
| General purpose data buffer. More...
class | clan::DateTime
| Date/Time class. More...
class | clan::Exception
| Top-level exception class. More...
class | clan::GameTime
| Tracks time elapsed in various forms useful for games. More...
class | clan::RegistryKey
| Registry key class. More...
class | clan::Service
| Service/daemon class. More...
class | clan::System
| General system helper functions. More...
class | clan::ThreadLocalStorage
| ThreadLocalStorage class. More...
class | clan::ThreadLocalStorageData
class | clan::UserData< T >
class | clan::UserDataBase
class | clan::UserDataOwner
| Helper class to store any shared_ptr as user data on an object. More...
class | clan::WorkItem
| Interface for executing work on a worker thread. More...
class | clan::WorkQueue
| Thread pool for worker threads. More...

## Macros
#define | cl_tls_variable __thread

## Functions
| clan::UserData< T >::UserData (const std::shared_ptr< T > &data)
| clan::UserDataOwner::UserDataOwner ()
| clan::WorkQueue::WorkQueue (bool serial_queue=false)
| Constructs a work queue. More...
virtual | clan::ThreadLocalStorageData::~ThreadLocalStorageData ()
virtual | clan::UserDataBase::~UserDataBase ()
| clan::UserDataOwner::~UserDataOwner ()
virtual | clan::WorkItem::~WorkItem ()
| clan::WorkQueue::~WorkQueue ()
template<typename T >
std::shared_ptr< T > | clan::UserDataOwner::get_data ()
int | clan::WorkQueue::get_items_queued () const
| Returns the number of items currently queued. More...
virtual void | clan::WorkItem::process_work ()=0
| Called by a worker thread to process work. More...
void | clan::WorkQueue::process_work_completed ()
| Process work completed queue. More...
void | clan::WorkQueue::queue (WorkItem *item)
| Queue some work to be executed on a worker thread. More...
void | clan::WorkQueue::queue (const std::function< void()> &func)
| Queue some work to be executed on a worker thread. More...
template<typename T >
void | clan::UserDataOwner::set_data (const std::shared_ptr< T > &data)
virtual void | clan::WorkItem::work_completed ()
| Called by the WorkQueue thread to complete the work. More...
void | clan::WorkQueue::work_completed (const std::function< void()> &func)
| Queue some work to be executed on the main WorkQueue thread. More...

## Variables
std::shared_ptr< T > | clan::UserData< T >::data
const float | clan::PI = 3.14159274101257f
const double | clan::PI_D = 3.141592653589793115998
const float | clan::PI_F = 3.14159274101257f

## Friends
class | clan::ThreadLocalStorage::ThreadLocalStorage_Instance

## Construction
| clan::BlockAllocator::BlockAllocator ()
| Block Allocator constructor. More...

## Operations
void * | clan::BlockAllocator::allocate (int size)
| Allocate memory (See note on this class for the allocation method) More...
void | clan::BlockAllocator::free ()
| Free the allocated memory. More...

## Operations
void * | clan::BlockAllocated::operator new (size_t size, BlockAllocator *allocator)
void | clan::BlockAllocated::operator delete (void *data, size_t size)
void | clan::BlockAllocated::operator delete (void *data, BlockAllocator *allocator)

## Construction
| clan::ConsoleWindow::ConsoleWindow (const std::string &title, int width=80, int height=25)
| Console Window constructor. More...
| clan::ConsoleWindow::~ConsoleWindow ()
| Console Window destructor. More...

## Operations
void | clan::ConsoleWindow::wait_for_key ()
| Waits until user hits a key. More...
void | clan::ConsoleWindow::display_close_message ()
| Displays 'press any key to close this console window',. More...

## Construction
| clan::DataBuffer::DataBuffer ()
| Constructs a data buffer of 0 size. More...
| clan::DataBuffer::DataBuffer (unsigned int size)
| clan::DataBuffer::DataBuffer (const void *data, unsigned int size)
| clan::DataBuffer::DataBuffer (const DataBuffer &data, unsigned int pos, unsigned int size)
| clan::DataBuffer::~DataBuffer ()

## Attributes
char * | clan::DataBuffer::get_data ()
| Returns a pointer to the data. More...
const char * | clan::DataBuffer::get_data () const
template<typename Type >
Type * | clan::DataBuffer::get_data ()
template<typename Type >
const Type * | clan::DataBuffer::get_data () const
unsigned int | clan::DataBuffer::get_size () const
| Returns the size of the data. More...
unsigned int | clan::DataBuffer::get_capacity () const
| Returns the capacity of the data buffer object. More...
char & | clan::DataBuffer::operator[] (int i)
| Returns a char in the buffer. More...
const char & | clan::DataBuffer::operator[] (int i) const
char & | clan::DataBuffer::operator[] (unsigned int i)
const char & | clan::DataBuffer::operator[] (unsigned int i) const
bool | clan::DataBuffer::is_null () const
| Returns true if the buffer is 0 in size. More...

## Operations
DataBuffer & | clan::DataBuffer::operator= (const DataBuffer &copy)
void | clan::DataBuffer::set_size (unsigned int size)
| Resize the buffer. More...
void | clan::DataBuffer::set_capacity (unsigned int capacity)
| Preallocate enough memory. More...

## Construction
enum | clan::DateTime::TimeZone { clan::DateTime::local_timezone, clan::DateTime::utc_timezone }
| clan::DateTime::DateTime ()
| Constructs a date/time object. More...
| clan::DateTime::DateTime (int year, int month, int day, int hour=0, int minute=0, int seconds=0, int nanoseconds=0, TimeZone timezone=utc_timezone)
| clan::DateTime::~DateTime ()
static DateTime | clan::DateTime::get_current_local_time ()
| Get current system time in local time zone. More...
static DateTime | clan::DateTime::get_current_utc_time ()
| Get current system time in UTC. More...
static DateTime | clan::DateTime::get_local_time_from_ticks (int64_t ticks)
| Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in the local time zone. More...
static DateTime | clan::DateTime::get_utc_time_from_ticks (int64_t ticks)
| Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in UTC. More...
static DateTime | clan::DateTime::from_short_date_string (const std::string &value)

## Attributes
bool | clan::DateTime::is_null () const
unsigned short | clan::DateTime::get_year () const
unsigned char | clan::DateTime::get_month () const
| Returns the month number in range 1-12. More...
unsigned char | clan::DateTime::get_day () const
unsigned char | clan::DateTime::get_hour () const
unsigned char | clan::DateTime::get_minutes () const
unsigned char | clan::DateTime::get_seconds () const
unsigned int | clan::DateTime::get_nanoseconds () const
TimeZone | clan::DateTime::get_timezone () const
unsigned char | clan::DateTime::get_week () const
| Returns the ISO 8601 week number of the date. More...
int | clan::DateTime::get_difference_in_days (const DateTime &other) const
| Returns the difference in days between two dates. This function is only accurate for the next few millenniums. More...
unsigned int | clan::DateTime::get_day_of_week () const
| Get the day of the week. More...
static int | clan::DateTime::get_days_in_month (int month, int year)
| Returns the number of days in the given month. More...

## Operations
void | clan::DateTime::set_null ()
void | clan::DateTime::set_date (int year, int month, int day, int hour=0, int minute=0, int seconds=0, int nanoseconds=0, TimeZone timezone=utc_timezone)
void | clan::DateTime::set_year (int year)
void | clan::DateTime::set_month (int month)
void | clan::DateTime::set_day (int day)
void | clan::DateTime::set_hour (int hour)
void | clan::DateTime::set_minutes (int minutes)
void | clan::DateTime::set_seconds (int seconds)
void | clan::DateTime::set_nanoseconds (int nanoseconds)
void | clan::DateTime::set_timezone (TimeZone timezone)
DateTime & | clan::DateTime::add_years (int years)
DateTime & | clan::DateTime::add_days (int days)
DateTime & | clan::DateTime::add_months (int months)
DateTime | clan::DateTime::to_utc () const
DateTime | clan::DateTime::to_local () const
int64_t | clan::DateTime::to_ticks () const
| Converts the date to the number of 100-nanosecond intervals since January 1, 1601 UTC. More...
std::string | clan::DateTime::to_long_date_string () const
| Mon Mar 3 2007. More...
std::string | clan::DateTime::to_short_date_string () const
| yyyy-mm-dd More...
std::string | clan::DateTime::to_short_datetime_string () const
| yyyy-mm-dd hh:mm:ss More...
std::string | clan::DateTime::to_long_time_string () const
| hh:mm:ss More...
std::string | clan::DateTime::to_short_time_string () const
| hh:mm More...
std::string | clan::DateTime::to_string () const
| Mon Feb 3 12:32:54 2008. More...
bool | clan::DateTime::operator< (const DateTime &other) const
bool | clan::DateTime::operator<= (const DateTime &other) const
bool | clan::DateTime::operator> (const DateTime &other) const
bool | clan::DateTime::operator>= (const DateTime &other) const
bool | clan::DateTime::operator== (const DateTime &other) const
bool | clan::DateTime::operator!= (const DateTime &other) const

## Construction
| clan::Exception::Exception (const std::string &message)
| Constructs an exception object. More...
virtual | clan::Exception::~Exception () throw ()
| Destructs an exception object. More...

## Attributes
std::string | clan::Exception::message
| Description of exception. More...
virtual const char * | clan::Exception::what () const override throw ()
| Returns description of exception. More...

## Operations
std::vector< std::string > | clan::Exception::get_stack_trace () const
| Returns the call stack present when the exception object was created. More...
std::string | clan::Exception::get_message_and_stack_trace () const
| Returns the message and call stack present when the exception object was created, formatted using newlines. More...

## Construction
| clan::GameTime::GameTime (int ticks_per_second=20, int max_updates_per_second=0)
| GameTime constructor. More...

## Attributes
float | clan::GameTime::get_time_elapsed () const
| Returns the time elapsed in seconds since last update. More...
int | clan::GameTime::get_time_elapsed_ms () const
| Returns the time elapsed in seconds since last update in milliseconds. More...
int | clan::GameTime::get_ticks_elapsed () const
| Returns the number of ticks that elapsed since last update. More...
float | clan::GameTime::get_tick_time_elapsed () const
| Returns the time elapsed per tick. More...
int | clan::GameTime::get_tick_time_elapsed_ms () const
| Returns the time elapsed per tick in milliseconds. More...
float | clan::GameTime::get_tick_interpolation_time () const
| Returns the current time between ticks as a normalized number. More...
float | clan::GameTime::get_updates_per_second () const
| Returns the number of updates that occurred every second (aka fps, frames per second) More...
float | clan::GameTime::get_current_time () const
| Returns the number of seconds since this class was reset() More...
uint64_t | clan::GameTime::get_current_time_microseconds () const
| Returns the number of microseconds since this class was reset() More...
uint64_t | clan::GameTime::get_current_time_ms () const
| Returns the number of milliseconds since this class was reset() More...

## Operations
void | clan::GameTime::update ()
| Updates time data for the frame to be rendered. More...
void | clan::GameTime::reset ()
| Resets the timer. More...

## Construction
enum | clan::RegistryKey::PredefinedKey { clan::RegistryKey::key_classes_root, clan::RegistryKey::key_current_config, clan::RegistryKey::key_current_user, clan::RegistryKey::key_local_machine, clan::RegistryKey::key_users }
enum | clan::RegistryKey::CreateFlags { clan::RegistryKey::create_always = 0, clan::RegistryKey::create_new = 1, clan::RegistryKey::create_volatile = 2 }
| clan::RegistryKey::RegistryKey ()
| clan::RegistryKey::RegistryKey (PredefinedKey key, const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS, unsigned int create_flags=create_always)
| clan::RegistryKey::RegistryKey (HKEY key)
| clan::RegistryKey::~RegistryKey ()

## Attributes
bool | clan::RegistryKey::is_null () const
| Returns true if this object is invalid. More...
void | clan::RegistryKey::throw_if_null () const
| Throw an exception if this object is invalid. More...
HKEY | clan::RegistryKey::get_key () const
std::vector< std::string > | clan::RegistryKey::get_subkey_names () const
std::vector< std::string > | clan::RegistryKey::get_value_names () const
int | clan::RegistryKey::get_value_int (const std::string &name, int default_value=0) const
DataBuffer | clan::RegistryKey::get_value_binary (const std::string &name, const DataBuffer &default_value=DataBuffer()) const
std::string | clan::RegistryKey::get_value_string (const std::string &name, const std::string &default_value=std::string()) const
std::vector< std::string > | clan::RegistryKey::get_value_multi_string (const std::string &name, const std::vector< std::string > &default_value=std::vector< std::string >()) const

## Operations
RegistryKey | clan::RegistryKey::open_key (const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS)
RegistryKey | clan::RegistryKey::create_key (const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS, CreateFlags create_flags=create_always)
void | clan::RegistryKey::delete_key (const std::string &subkey, bool recursive)
static void | clan::RegistryKey::delete_key (PredefinedKey key, const std::string &subkey, bool recursive)
void | clan::RegistryKey::set_value_int (const std::string &name, int value)
void | clan::RegistryKey::set_value_binary (const std::string &name, const DataBuffer &value)
void | clan::RegistryKey::set_value_string (const std::string &name, const std::string &value)
void | clan::RegistryKey::delete_value (const std::string &name)

## Construction
| clan::Service::Service (const std::string &service_name)
| Constructs a service object. More...
| clan::Service::~Service ()

## Attributes
const std::string & | clan::Service::get_service_name () const
| Returns the service name. More...

## Operations
int | clan::Service::main (int argc, char **argv)
| Process command line and run service. More...
virtual void | clan::Service::service_start (std::vector< std::string > &args)=0
| Called when the service is asked to start. More...
virtual void | clan::Service::service_stop ()=0
| Called when the service is asked to stop. More...
virtual void | clan::Service::service_reload ()=0
| Called when the service is asked to reload its configuration. More...

## Implementation
class | clan::Service::Service_Impl

## Attributes
enum | clan::System::CPU_ExtensionX86 { clan::System::mmx, clan::System::mmx_ex, clan::System::_3d_now, clan::System::_3d_now_ex, clan::System::sse, clan::System::sse2, clan::System::sse3, clan::System::ssse3, clan::System::sse4_a, clan::System::sse4_1, clan::System::sse4_2, clan::System::xop, clan::System::avx, clan::System::aes, clan::System::fma3, clan::System::fma4 }
enum | clan::System::CPU_ExtensionPPC { clan::System::altivec }
static uint64_t | clan::System::get_time ()
| Get the current time (since system boot), in milliseconds. More...
static uint64_t | clan::System::get_microseconds ()
| Get the current time microseconds. More...
static bool | clan::System::detect_cpu_extension (CPU_ExtensionX86 ext)
static bool | clan::System::detect_cpu_extension (CPU_ExtensionPPC ext)
static int | clan::System::get_num_cores ()
| Return the number of CPU cores. More...

## Operations
static void * | clan::System::aligned_alloc (size_t size, size_t alignment=16)
| Allocates aligned memory. More...
static void | clan::System::aligned_free (void *ptr)
| Frees aligned memory. More...
static int | clan::System::capture_stack_trace (int frames_to_skip, int max_frames, void **out_frames, unsigned int *out_hash=nullptr)
| Captures a stack back trace by walking up the stack and recording the information for each frame. More...
static std::vector< std::string > | clan::System::get_stack_frames_text (void **frames, int num_frames)
| Returns the function names and lines for the specified stack frame addresses. More...
static void | clan::System::sleep (int millis)
| Sleep for 'millis' milliseconds. More...
static void | clan::System::pause (int millis)
| Pause for 'millis' milliseconds. More...
static std::string | clan::System::get_exe_path ()
| Returns the full dirname of the executable that started this. More...

## Construction
| clan::ThreadLocalStorage::ThreadLocalStorage ()
| Constructs a Thread Local Storage object. More...
| clan::ThreadLocalStorage::~ThreadLocalStorage ()

## Attributes
static std::shared_ptr< ThreadLocalStorageData > | clan::ThreadLocalStorage::get_variable (const std::string &name)
| Get a variable. More...

## Operations
static void | clan::ThreadLocalStorage::set_variable (const std::string &name, std::shared_ptr< ThreadLocalStorageData > ptr)
| Set a variable. More...

## Detailed Description

## Macro Definition Documentation

#define cl_tls_variable __thread

## Enumeration Type Documentation

enum clan::System::CPU_ExtensionPPC

Enumerator
altivec |

enum clan::System::CPU_ExtensionX86

Enumerator
mmx |
mmx_ex |
_3d_now |
_3d_now_ex |
sse |
sse2 |
sse3 |
ssse3 |
sse4_a |
sse4_1 |
sse4_2 |
xop |
avx |
aes |
fma3 |
fma4 |

enum clan::RegistryKey::CreateFlags

Enumerator
create_always |
create_new |
create_volatile |

enum clan::RegistryKey::PredefinedKey

Enumerator
key_classes_root |
key_current_config |
key_current_user |
key_local_machine |
key_users |

enum clan::DateTime::TimeZone

Enumerator
local_timezone |
utc_timezone |

## Function Documentation

clan::BlockAllocator::BlockAllocator | ( |  | ) |

Block Allocator constructor.

clan::ConsoleWindow::ConsoleWindow | ( | const std::string & | title,
|  | int | width = `80`,
|  | int | height = `25`
| ) |  |

Console Window constructor.

Parameters

  title | Window title of console window.
  width | Columns in console window.
  height | Rows in console window.

clan::DataBuffer::DataBuffer | ( |  | ) |

Constructs a data buffer of 0 size.

clan::DataBuffer::DataBuffer | ( | unsigned int | size | ) |

clan::DataBuffer::DataBuffer | ( | const void * | data,
|  | unsigned int | size
| ) |  |

clan::DataBuffer::DataBuffer | ( | const DataBuffer & | data,
|  | unsigned int | pos,
|  | unsigned int | size
| ) |  |

clan::DateTime::DateTime | ( |  | ) |

Constructs a date/time object.

clan::DateTime::DateTime | ( | int | year,
|  | int | month,
|  | int | day,
|  | int | hour = `0`,
|  | int | minute = `0`,
|  | int | seconds = `0`,
|  | int | nanoseconds = `0`,
|  | TimeZone | timezone = `utc_timezone`
| ) |  |

clan::Exception::Exception | ( | const std::string & | message | ) |

Constructs an exception object.

clan::GameTime::GameTime | ( | int | ticks_per_second = `20`,
|  | int | max_updates_per_second = `0`
| ) |  |

GameTime constructor.

Parameters

  ticks_per_second | = Number of ticks per second
  max_updates_per_second | = Maximum number of updates per second (aka FPS, frames per second). 0 = Unlimited

clan::RegistryKey::RegistryKey | ( |  | ) |

clan::RegistryKey::RegistryKey | ( | PredefinedKey | key,
|  | const std::string & | subkey,
|  | unsigned int | access_rights = `KEY_ALL_ACCESS`,
|  | unsigned int | create_flags = `create_always`
| ) |  |

clan::RegistryKey::RegistryKey | ( | HKEY | key | ) |

clan::Service::Service | ( | const std::string & | service_name | ) |

Constructs a service object.

clan::ThreadLocalStorage::ThreadLocalStorage | ( |  | ) |

Constructs a Thread Local Storage object.

template<typename T>

clan::UserData< T >::UserData | ( | const std::shared_ptr< T > & | data | ) |
| inline

clan::UserDataOwner::UserDataOwner | ( |  | ) |
| inline

clan::WorkQueue::WorkQueue | ( | bool | serial_queue = `false` | ) |

Constructs a work queue.

Parameters

  serial_queue | If true, executes items in the order they are queued, one at a time

clan::ConsoleWindow::~ConsoleWindow | ( |  | ) |

Console Window destructor.

clan::DataBuffer::~DataBuffer | ( |  | ) |

clan::DateTime::~DateTime | ( |  | ) |

virtual clan::Exception::~Exception | ( |  | ) |
throw | ( |
| ) |  |
| inline virtual

Destructs an exception object.

clan::RegistryKey::~RegistryKey | ( |  | ) |

clan::Service::~Service | ( |  | ) |

clan::ThreadLocalStorage::~ThreadLocalStorage | ( |  | ) |

virtual clan::ThreadLocalStorageData::~ThreadLocalStorageData | ( |  | ) |
| inline virtual

virtual clan::UserDataBase::~UserDataBase | ( |  | ) |
| inline virtual

Referenced by clan::UserDataOwner::set_data(), and clan::UserDataOwner::~UserDataOwner().

clan::UserDataOwner::~UserDataOwner | ( |  | ) |
| inline

References clan::UserDataBase::~UserDataBase().

virtual clan::WorkItem::~WorkItem | ( |  | ) |
| inline virtual

clan::WorkQueue::~WorkQueue | ( |  | ) |

DateTime& clan::DateTime::add_days | ( | int | days | ) |

DateTime& clan::DateTime::add_months | ( | int | months | ) |

DateTime& clan::DateTime::add_years | ( | int | years | ) |

static void* clan::System::aligned_alloc | ( | size_t | size,
|  | size_t | alignment = `16`
| ) |  |
| static

Allocates aligned memory.

static void clan::System::aligned_free | ( | void * | ptr | ) |
| static

Frees aligned memory.

void* clan::BlockAllocator::allocate | ( | int | size | ) |

Allocate memory (See note on this class for the allocation method)

param: size = Size to allocate (in bytes)

Returns
  The memory

static int clan::System::capture_stack_trace | ( | int | frames_to_skip,
|  | int | max_frames,
|  | void ** | out_frames,
|  | unsigned int * | out_hash = `nullptr`
| ) |  |
| static

Captures a stack back trace by walking up the stack and recording the information for each frame.

RegistryKey clan::RegistryKey::create_key | ( | const std::string & | subkey,
|  | unsigned int | access_rights = `KEY_ALL_ACCESS`,
|  | CreateFlags | create_flags = `create_always`
| ) |  |

void clan::RegistryKey::delete_key | ( | const std::string & | subkey,
|  | bool | recursive
| ) |  |

static void clan::RegistryKey::delete_key | ( | PredefinedKey | key,
|  | const std::string & | subkey,
|  | bool | recursive
| ) |  |
| static

void clan::RegistryKey::delete_value | ( | const std::string & | name | ) |

static bool clan::System::detect_cpu_extension | ( | CPU_ExtensionX86 | ext | ) |
| static

static bool clan::System::detect_cpu_extension | ( | CPU_ExtensionPPC | ext | ) |
| static

void clan::ConsoleWindow::display_close_message | ( |  | ) |

Displays 'press any key to close this console window',.

and waits until user hits a key.

This function does not do anything on Linux.

void clan::BlockAllocator::free | ( |  | ) |

Free the allocated memory.

If required, use delete_obj() to call the destructor before using this function

static DateTime clan::DateTime::from_short_date_string | ( | const std::string & | value | ) |
| static

unsigned int clan::DataBuffer::get_capacity | ( |  | ) | const

Returns the capacity of the data buffer object.

static DateTime clan::DateTime::get_current_local_time | ( |  | ) |
| static

Get current system time in local time zone.

float clan::GameTime::get_current_time | ( |  | ) | const

Returns the number of seconds since this class was reset()

uint64_t clan::GameTime::get_current_time_microseconds | ( |  | ) | const

Returns the number of microseconds since this class was reset()

uint64_t clan::GameTime::get_current_time_ms | ( |  | ) | const

Returns the number of milliseconds since this class was reset()

static DateTime clan::DateTime::get_current_utc_time | ( |  | ) |
| static

Get current system time in UTC.

char* clan::DataBuffer::get_data | ( |  | ) |

Returns a pointer to the data.

const char* clan::DataBuffer::get_data | ( |  | ) | const

template<typename Type >

Type* clan::DataBuffer::get_data | ( |  | ) |
| inline

References clan::DataBuffer::get_data().

Referenced by clan::DataBuffer::get_data().

template<typename Type >

const Type* clan::DataBuffer::get_data | ( |  | ) | const
| inline

References clan::DataBuffer::get_data().

Referenced by clan::DataBuffer::get_data().

template<typename T >

std::shared_ptr<T> clan::UserDataOwner::get_data | ( |  | ) |
| inline

References clan::d, and clan::UserData< T >::data.

Referenced by clan::ResourceManager::get_cache().

unsigned char clan::DateTime::get_day | ( |  | ) | const

unsigned int clan::DateTime::get_day_of_week | ( |  | ) | const

Get the day of the week.

Returns
  0 = Sunday ... 6 = Saturday

static int clan::DateTime::get_days_in_month | ( | int | month,
|  | int | year
| ) |  |
| static

Returns the number of days in the given month.

Returns
  number of days: 28-31.

int clan::DateTime::get_difference_in_days | ( | const DateTime & | other | ) | const

Returns the difference in days between two dates. This function is only accurate for the next few millenniums.

Returns
  Number of days between dates. Returns a negative value if 'other' is before 'this'.

static std::string clan::System::get_exe_path | ( |  | ) |
| static

Returns the full dirname of the executable that started this.

process (aka argv[0])

This is necessary since when programms are started from the PATH there is no clean and simple way to figure out the location of the data files, thus information is read from `/proc/self/exe` under GNU/Linux and from GetModuleFileName() on Win32.

Returns
  full dirname of the executable, trailing slash is included

unsigned char clan::DateTime::get_hour | ( |  | ) | const

int clan::WorkQueue::get_items_queued | ( |  | ) | const

Returns the number of items currently queued.

HKEY clan::RegistryKey::get_key | ( |  | ) | const

static DateTime clan::DateTime::get_local_time_from_ticks | ( | int64_t | ticks | ) |
| static

Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in the local time zone.

std::string clan::Exception::get_message_and_stack_trace | ( |  | ) | const

Returns the message and call stack present when the exception object was created, formatted using newlines.

On Linux, to obtain function names, remember to link with the -rdynamic flag

static uint64_t clan::System::get_microseconds | ( |  | ) |
| static

Get the current time microseconds.

unsigned char clan::DateTime::get_minutes | ( |  | ) | const

unsigned char clan::DateTime::get_month | ( |  | ) | const

Returns the month number in range 1-12.

Returns
  1 = Jan ... 12 = December

unsigned int clan::DateTime::get_nanoseconds | ( |  | ) | const

static int clan::System::get_num_cores | ( |  | ) |
| static

Return the number of CPU cores.

unsigned char clan::DateTime::get_seconds | ( |  | ) | const

const std::string& clan::Service::get_service_name | ( |  | ) | const

Returns the service name.

unsigned int clan::DataBuffer::get_size | ( |  | ) | const

Returns the size of the data.

static std::vector<std::string> clan::System::get_stack_frames_text | ( | void ** | frames,
|  | int | num_frames
| ) |  |
| static

Returns the function names and lines for the specified stack frame addresses.

On Linux, to obtain function names, remember to link with the -rdynamic flag

std::vector<std::string> clan::Exception::get_stack_trace | ( |  | ) | const

Returns the call stack present when the exception object was created.

On Linux, to obtain function names, remember to link with the -rdynamic flag

std::vector<std::string> clan::RegistryKey::get_subkey_names | ( |  | ) | const

float clan::GameTime::get_tick_interpolation_time | ( |  | ) | const

Returns the current time between ticks as a normalized number.

If the current time is half-way between two tick updates this function returns 0.5, at the start of a tick its 0.0, and at the end its 1.0.

float clan::GameTime::get_tick_time_elapsed | ( |  | ) | const

Returns the time elapsed per tick.

int clan::GameTime::get_tick_time_elapsed_ms | ( |  | ) | const

Returns the time elapsed per tick in milliseconds.

int clan::GameTime::get_ticks_elapsed | ( |  | ) | const

Returns the number of ticks that elapsed since last update.

static uint64_t clan::System::get_time | ( |  | ) |
| static

Get the current time (since system boot), in milliseconds.

float clan::GameTime::get_time_elapsed | ( |  | ) | const

Returns the time elapsed in seconds since last update.

int clan::GameTime::get_time_elapsed_ms | ( |  | ) | const

Returns the time elapsed in seconds since last update in milliseconds.

TimeZone clan::DateTime::get_timezone | ( |  | ) | const

float clan::GameTime::get_updates_per_second | ( |  | ) | const

Returns the number of updates that occurred every second (aka fps, frames per second)

static DateTime clan::DateTime::get_utc_time_from_ticks | ( | int64_t | ticks | ) |
| static

Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in UTC.

DataBuffer clan::RegistryKey::get_value_binary | ( | const std::string & | name,
|  | const DataBuffer & | default_value = `DataBuffer()`
| ) |  | const

int clan::RegistryKey::get_value_int | ( | const std::string & | name,
|  | int | default_value = `0`
| ) |  | const

std::vector<std::string> clan::RegistryKey::get_value_multi_string | ( | const std::string & | name,
|  | const std::vector< std::string > & | default_value = `std::vector< std::string >()`
| ) |  | const

std::vector<std::string> clan::RegistryKey::get_value_names | ( |  | ) | const

std::string clan::RegistryKey::get_value_string | ( | const std::string & | name,
|  | const std::string & | default_value = `std::string()`
| ) |  | const

static std::shared_ptr<ThreadLocalStorageData> clan::ThreadLocalStorage::get_variable | ( | const std::string & | name | ) |
| static

Get a variable.

unsigned char clan::DateTime::get_week | ( |  | ) | const

Returns the ISO 8601 week number of the date.

Returns
  Week number: 1-53.

unsigned short clan::DateTime::get_year | ( |  | ) | const

bool clan::DateTime::is_null | ( |  | ) | const

bool clan::DataBuffer::is_null | ( |  | ) | const

Returns true if the buffer is 0 in size.

bool clan::RegistryKey::is_null | ( |  | ) | const
| inline

Returns true if this object is invalid.

int clan::Service::main | ( | int | argc,
|  | char ** | argv
| ) |  |

Process command line and run service.

RegistryKey clan::RegistryKey::open_key | ( | const std::string & | subkey,
|  | unsigned int | access_rights = `KEY_ALL_ACCESS`
| ) |  |

void clan::BlockAllocated::operator delete | ( | void * | data,
|  | size_t | size
| ) |  |

void clan::BlockAllocated::operator delete | ( | void * | data,
|  | BlockAllocator * | allocator
| ) |  |

void* clan::BlockAllocated::operator new | ( | size_t | size,
|  | BlockAllocator * | allocator
| ) |  |

bool clan::DateTime::operator!= | ( | const DateTime & | other | ) | const

bool clan::DateTime::operator< | ( | const DateTime & | other | ) | const

bool clan::DateTime::operator<= | ( | const DateTime & | other | ) | const

DataBuffer& clan::DataBuffer::operator= | ( | const DataBuffer & | copy | ) |

bool clan::DateTime::operator== | ( | const DateTime & | other | ) | const

bool clan::DateTime::operator> | ( | const DateTime & | other | ) | const

bool clan::DateTime::operator>= | ( | const DateTime & | other | ) | const

char& clan::DataBuffer::operator[] | ( | int | i | ) |

Returns a char in the buffer.

const char& clan::DataBuffer::operator[] | ( | int | i | ) | const

char& clan::DataBuffer::operator[] | ( | unsigned int | i | ) |

const char& clan::DataBuffer::operator[] | ( | unsigned int | i | ) | const

static void clan::System::pause | ( | int | millis | ) |
| static

Pause for 'millis' milliseconds.

This function acts as sleep, but the function "may" perform a spinlock on some operating systems to give a more accurate pause. This may have a side effect of causing 100% cpu usage. If you do not require an accurate pause, use sleep instead.

virtual void clan::WorkItem::process_work | ( |  | ) |
| pure virtual

Called by a worker thread to process work.

void clan::WorkQueue::process_work_completed | ( |  | ) |

Process work completed queue.

Needs to be called on the main WorkQueue thread periodically to finish queued work

void clan::WorkQueue::queue | ( | WorkItem * | item | ) |

Queue some work to be executed on a worker thread.

Transfers ownership of the item queued. WorkQueue will delete the item.

void clan::WorkQueue::queue | ( | const std::function< void()> & | func | ) |

Queue some work to be executed on a worker thread.

void clan::GameTime::reset | ( |  | ) |

Resets the timer.

virtual void clan::Service::service_reload | ( |  | ) |
| protected pure virtual

Called when the service is asked to reload its configuration.

virtual void clan::Service::service_start | ( | std::vector< std::string > & | args | ) |
| protected pure virtual

Called when the service is asked to start.

virtual void clan::Service::service_stop | ( |  | ) |
| protected pure virtual

Called when the service is asked to stop.

void clan::DataBuffer::set_capacity | ( | unsigned int | capacity | ) |

Preallocate enough memory.

template<typename T >

void clan::UserDataOwner::set_data | ( | const std::shared_ptr< T > & | data | ) |
| inline

References clan::UserDataBase::~UserDataBase().

Referenced by clan::ResourceManager::set_cache().

void clan::DateTime::set_date | ( | int | year,
|  | int | month,
|  | int | day,
|  | int | hour = `0`,
|  | int | minute = `0`,
|  | int | seconds = `0`,
|  | int | nanoseconds = `0`,
|  | TimeZone | timezone = `utc_timezone`
| ) |  |

void clan::DateTime::set_day | ( | int | day | ) |

void clan::DateTime::set_hour | ( | int | hour | ) |

void clan::DateTime::set_minutes | ( | int | minutes | ) |

void clan::DateTime::set_month | ( | int | month | ) |

void clan::DateTime::set_nanoseconds | ( | int | nanoseconds | ) |

void clan::DateTime::set_null | ( |  | ) |

void clan::DateTime::set_seconds | ( | int | seconds | ) |

void clan::DataBuffer::set_size | ( | unsigned int | size | ) |

Resize the buffer.

void clan::DateTime::set_timezone | ( | TimeZone | timezone | ) |

void clan::RegistryKey::set_value_binary | ( | const std::string & | name,
|  | const DataBuffer & | value
| ) |  |

void clan::RegistryKey::set_value_int | ( | const std::string & | name,
|  | int | value
| ) |  |

void clan::RegistryKey::set_value_string | ( | const std::string & | name,
|  | const std::string & | value
| ) |  |

static void clan::ThreadLocalStorage::set_variable | ( | const std::string & | name,
|  | std::shared_ptr< ThreadLocalStorageData > | ptr
| ) |  |
| static

Set a variable.

void clan::DateTime::set_year | ( | int | year | ) |

static void clan::System::sleep | ( | int | millis | ) |
| static

Sleep for 'millis' milliseconds.

It is possible for this function to sleep for more than millis, depending on the OS scheduler. If you require a more accurate sleep, consider pause.

void clan::RegistryKey::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

DateTime clan::DateTime::to_local | ( |  | ) | const

std::string clan::DateTime::to_long_date_string | ( |  | ) | const

Mon Mar 3 2007.

std::string clan::DateTime::to_long_time_string | ( |  | ) | const

hh:mm:ss

std::string clan::DateTime::to_short_date_string | ( |  | ) | const

yyyy-mm-dd

std::string clan::DateTime::to_short_datetime_string | ( |  | ) | const

yyyy-mm-dd hh:mm:ss

std::string clan::DateTime::to_short_time_string | ( |  | ) | const

hh:mm

std::string clan::DateTime::to_string | ( |  | ) | const

Mon Feb 3 12:32:54 2008.

int64_t clan::DateTime::to_ticks | ( |  | ) | const

Converts the date to the number of 100-nanosecond intervals since January 1, 1601 UTC.

DateTime clan::DateTime::to_utc | ( |  | ) | const

void clan::GameTime::update | ( |  | ) |

Updates time data for the frame to be rendered.

Call this function once at the start of a frame.

void clan::ConsoleWindow::wait_for_key | ( |  | ) |

Waits until user hits a key.

This function does not do anything on Linux.

virtual const char* clan::Exception::what | ( |  | ) | const
throw | ( |
| ) |  |
| override virtual

Returns description of exception.

virtual void clan::WorkItem::work_completed | ( |  | ) |
| inline virtual

Called by the WorkQueue thread to complete the work.

void clan::WorkQueue::work_completed | ( | const std::function< void()> & | func | ) |

Queue some work to be executed on the main WorkQueue thread.

## Variable Documentation

template<typename T>

std::shared_ptr<T> clan::UserData< T >::data

Referenced by clan::UserDataOwner::get_data().

std::string clan::Exception::message

Description of exception.

const float clan::PI = 3.14159274101257f

const double clan::PI_D = 3.141592653589793115998

const float clan::PI_F = 3.14159274101257f

## Friends

friend class Service_Impl
| friend

friend class ThreadLocalStorage_Instance
| friend