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::Event
 OS level event. More...
 
class  clan::EventProvider
 OS level event provider. More...
 
class  clan::Exception
 Top-level exception class. More...
 
class  clan::GameTime
 Tracks time elapsed in various forms useful for games. More...
 
class  clan::Mutex
 Mutex class. More...
 
class  clan::MutexSection
 Mutex locking helper. More...
 
class  clan::Runnable
 Thread runnable object. More...
 
class  clan::RunnableMember_v0< C >
 (Internal ClanLib Class) More...
 
class  clan::RunnableMember_v1< C, P1 >
 (Internal ClanLib Class) More...
 
class  clan::RunnableMember_v2< C, P1, P2 >
 (Internal ClanLib Class) More...
 
class  clan::RunnableMember_v3< C, P1, P2, P3 >
 (Internal ClanLib Class) More...
 
class  clan::RunnableMember_v4< C, P1, P2, P3, P4 >
 (Internal ClanLib Class) More...
 
class  clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >
 (Internal ClanLib Class) More...
 
class  clan::Service
 Service/daemon class. More...
 
class  clan::SetupCore
 Library initializer class. More...
 
class  clan::System
 General system helper functions. More...
 
class  clan::Thread
 Thread class. More...
 
class  clan::ThreadLocalStorage
 Thread 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
 

Typedefs

typedef short clan::byte16
 
typedef int clan::byte32
 
typedef long long clan::byte64
 
typedef char clan::byte8
 
typedef unsigned short clan::ubyte16
 
typedef unsigned int clan::ubyte32
 
typedef unsigned long long clan::ubyte64
 
typedef unsigned char clan::ubyte8
 

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 ()
 
virtual void clan::WorkItem::process_work ()=0
 Called by a worker thread to process work. 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::SetupCore_Impl
 

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 (byte64 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 (byte64 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
 
byte64 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

virtual clan::EventProvider::~EventProvider ()
 

Attributes

enum  clan::EventProvider::EventType { clan::EventProvider::type_fd_read, clan::EventProvider::type_fd_write, clan::EventProvider::type_fd_exception }
 
virtual EventType clan::EventProvider::get_event_type (int index)=0
 Returns the type of event provided. More...
 
virtual int clan::EventProvider::get_event_handle (int index)=0
 Returns the OS handle for the event. More...
 
virtual int clan::EventProvider::get_num_event_handles ()=0
 Returns the number of OS handles relevant for this event. More...
 

Operations

virtual bool clan::EventProvider::check_before_wait ()
 Prepare for OS event waiting. More...
 
virtual bool clan::EventProvider::check_after_wait (int)
 Check for flagging after OS event waiting. More...
 
virtual bool clan::EventProvider::set ()
 Raise flag. More...
 
virtual bool clan::EventProvider::reset ()
 Reset flag. More...
 

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 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...
 
ubyte64 clan::GameTime::get_current_time_microseconds () const
 Returns the number of microseconds since this class was reset() More...
 
ubyte64 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

 clan::Mutex::Mutex ()
 Constructs a mutex object. More...
 
 clan::Mutex::~Mutex ()
 

Operations

void clan::Mutex::lock ()
 Lock mutex. More...
 
bool clan::Mutex::try_lock ()
 Attempt to lock mutex. More...
 
void clan::Mutex::unlock ()
 Unlock mutex. More...
 

Construction

 clan::MutexSection::MutexSection (Mutex *mutex, bool lock_mutex=true)
 Constructs a mutex section. More...
 
 clan::MutexSection::~MutexSection ()
 

Attributes

int clan::MutexSection::get_lock_count () const
 Returns the amounts of recursive mutex locks performed by this section. More...
 

Operations

void clan::MutexSection::lock ()
 Lock the mutex. More...
 
bool clan::MutexSection::try_lock ()
 Attempt to lock mutex. More...
 
void clan::MutexSection::unlock ()
 Unlock mutex. More...
 

Construction

 clan::Runnable::Runnable ()
 
virtual clan::Runnable::~Runnable ()
 

Operations

virtual void clan::Runnable::run ()=0
 
static void clan::Runnable::set_thread_name (const char *name)
 Sets the name (displayed in debuggers) of the calling thread. More...
 

Construction

typedef void(C::* clan::RunnableMember_v0< C >::PtrMemberFunc )()
 
 clan::RunnableMember_v0< C >::RunnableMember_v0 (C *instance, PtrMemberFunc func)
 

Operations

virtual void clan::RunnableMember_v0< C >::run ()
 

Construction

typedef void(C::* clan::RunnableMember_v1< C, P1 >::PtrMemberFunc )(P1 p1)
 
 clan::RunnableMember_v1< C, P1 >::RunnableMember_v1 (C *instance, PtrMemberFunc func, P1 p1)
 

Operations

virtual void clan::RunnableMember_v1< C, P1 >::run ()
 

Construction

typedef void(C::* clan::RunnableMember_v2< C, P1, P2 >::PtrMemberFunc )(P1 p1, P2 p2)
 
 clan::RunnableMember_v2< C, P1, P2 >::RunnableMember_v2 (C *instance, PtrMemberFunc func, P1 p1, P2 p2)
 

Operations

virtual void clan::RunnableMember_v2< C, P1, P2 >::run ()
 

Construction

typedef void(C::* clan::RunnableMember_v3< C, P1, P2, P3 >::PtrMemberFunc )(P1 p1, P2 p2, P3 p3)
 
 clan::RunnableMember_v3< C, P1, P2, P3 >::RunnableMember_v3 (C *instance, PtrMemberFunc func, P1 p1, P2 p2, P3 p3)
 

Operations

virtual void clan::RunnableMember_v3< C, P1, P2, P3 >::run ()
 

Construction

typedef void(C::* clan::RunnableMember_v4< C, P1, P2, P3, P4 >::PtrMemberFunc )(P1 p1, P2 p2, P3 p3, P4 p4)
 
 clan::RunnableMember_v4< C, P1, P2, P3, P4 >::RunnableMember_v4 (C *instance, PtrMemberFunc func, P1 p1, P2 p2, P3 p3, P4 p4)
 

Operations

virtual void clan::RunnableMember_v4< C, P1, P2, P3, P4 >::run ()
 

Construction

typedef void(C::* clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::PtrMemberFunc )(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
 clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::RunnableMember_v5 (C *instance, PtrMemberFunc func, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 

Operations

virtual void clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::run ()
 

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
 

Construction

 clan::SetupCore::SetupCore ()
 Initializes clanCore. More...
 
 clan::SetupCore::~SetupCore ()
 

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 ubyte64 clan::System::get_time ()
 Get the current time (since system boot), in milliseconds. More...
 
static ubyte64 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=0)
 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::Thread::Thread ()
 Constructs a thread object. More...
 
 clan::Thread::~Thread ()
 

Operations

void clan::Thread::start (Runnable *runnable)
 Starts a thread. More...
 
template<class C >
void clan::Thread::start (C *instance, void(C::*member)())
 
template<class C , class P1 >
void clan::Thread::start (C *instance, void(C::*member)(P1 p1), P1 p1)
 
template<class C , class P1 , class P2 >
void clan::Thread::start (C *instance, void(C::*member)(P1 p1, P2 p2), P1 p1, P2 p2)
 
template<class C , class P1 , class P2 , class P3 >
void clan::Thread::start (C *instance, void(C::*member)(P1 p1, P2 p2, P3 p3), P1 p1, P2 p2, P3 p3)
 
template<class C , class P1 , class P2 , class P3 , class P4 >
void clan::Thread::start (C *instance, void(C::*member)(P1 p1, P2 p2, P3 p3, P4 p4), P1 p1, P2 p2, P3 p3, P4 p4)
 
template<class C , class P1 , class P2 , class P3 , class P4 , class P5 >
void clan::Thread::start (C *instance, void(C::*member)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
void clan::Thread::join ()
 Blocks until thread has completed its execution. More...
 
void clan::Thread::kill ()
 Terminates the thread. More...
 
static void clan::Thread::set_thread_name (const char *name)
 Sets the name (displayed in debuggers) of the calling thread. 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

Typedef Documentation

typedef short clan::byte16
typedef int clan::byte32
typedef long long clan::byte64
typedef char clan::byte8
template<class C>
typedef void(C::* clan::RunnableMember_v0< C >::PtrMemberFunc)()
template<class C, class P1>
typedef void(C::* clan::RunnableMember_v1< C, P1 >::PtrMemberFunc)(P1 p1)
template<class C, class P1, class P2>
typedef void(C::* clan::RunnableMember_v2< C, P1, P2 >::PtrMemberFunc)(P1 p1, P2 p2)
template<class C, class P1, class P2, class P3>
typedef void(C::* clan::RunnableMember_v3< C, P1, P2, P3 >::PtrMemberFunc)(P1 p1, P2 p2, P3 p3)
template<class C, class P1, class P2, class P3, class P4>
typedef void(C::* clan::RunnableMember_v4< C, P1, P2, P3, P4 >::PtrMemberFunc)(P1 p1, P2 p2, P3 p3, P4 p4)
template<class C, class P1, class P2, class P3, class P4, class P5>
typedef void(C::* clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::PtrMemberFunc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
typedef unsigned short clan::ubyte16
typedef unsigned int clan::ubyte32
typedef unsigned long long clan::ubyte64
typedef unsigned char clan::ubyte8

Enumeration Type Documentation

Enumerator
altivec 
Enumerator
mmx 
mmx_ex 
_3d_now 
_3d_now_ex 
sse 
sse2 
sse3 
ssse3 
sse4_a 
sse4_1 
sse4_2 
xop 
avx 
aes 
fma3 
fma4 
Enumerator
type_fd_read 
type_fd_write 
type_fd_exception 
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
titleWindow title of console window.
widthColumns in console window.
heightRows 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::Mutex::Mutex ( )

Constructs a mutex object.

clan::MutexSection::MutexSection ( Mutex mutex,
bool  lock_mutex = true 
)
inline

Constructs a mutex section.

clan::Runnable::Runnable ( )
template<class C>
clan::RunnableMember_v0< C >::RunnableMember_v0 ( C *  instance,
PtrMemberFunc  func 
)
inline
template<class C, class P1>
clan::RunnableMember_v1< C, P1 >::RunnableMember_v1 ( C *  instance,
PtrMemberFunc  func,
P1  p1 
)
inline
template<class C, class P1, class P2>
clan::RunnableMember_v2< C, P1, P2 >::RunnableMember_v2 ( C *  instance,
PtrMemberFunc  func,
P1  p1,
P2  p2 
)
inline
template<class C, class P1, class P2, class P3>
clan::RunnableMember_v3< C, P1, P2, P3 >::RunnableMember_v3 ( C *  instance,
PtrMemberFunc  func,
P1  p1,
P2  p2,
P3  p3 
)
inline
template<class C, class P1, class P2, class P3, class P4>
clan::RunnableMember_v4< C, P1, P2, P3, P4 >::RunnableMember_v4 ( C *  instance,
PtrMemberFunc  func,
P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline
template<class C, class P1, class P2, class P3, class P4, class P5>
clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::RunnableMember_v5 ( C *  instance,
PtrMemberFunc  func,
P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline
clan::Service::Service ( const std::string &  service_name)

Constructs a service object.

clan::SetupCore::SetupCore ( )

Initializes clanCore.

clan::Thread::Thread ( )

Constructs a thread 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_queueIf 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::EventProvider::~EventProvider ( )
inlinevirtual
virtual clan::Exception::~Exception ( )
throw (
)
inlinevirtual

Destructs an exception object.

clan::Mutex::~Mutex ( )
clan::MutexSection::~MutexSection ( )
inline
virtual clan::Runnable::~Runnable ( )
virtual
clan::Service::~Service ( )
clan::SetupCore::~SetupCore ( )
clan::Thread::~Thread ( )
clan::ThreadLocalStorage::~ThreadLocalStorage ( )
virtual clan::ThreadLocalStorageData::~ThreadLocalStorageData ( )
inlinevirtual
virtual clan::UserDataBase::~UserDataBase ( )
inlinevirtual
clan::UserDataOwner::~UserDataOwner ( )
inline
virtual clan::WorkItem::~WorkItem ( )
inlinevirtual
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 = 0 
)
static

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

virtual bool clan::EventProvider::check_after_wait ( int  )
inlinevirtual

Check for flagging after OS event waiting.

virtual bool clan::EventProvider::check_before_wait ( )
inlinevirtual

Prepare for OS event waiting.

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()

ubyte64 clan::GameTime::get_current_time_microseconds ( ) const

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

ubyte64 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
template<typename Type >
const Type* clan::DataBuffer::get_data ( ) const
inline
template<typename T >
std::shared_ptr<T> clan::UserDataOwner::get_data ( )
inline
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'.
virtual int clan::EventProvider::get_event_handle ( int  index)
pure virtual

Returns the OS handle for the event.

virtual EventType clan::EventProvider::get_event_type ( int  index)
pure virtual

Returns the type of event provided.

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
static DateTime clan::DateTime::get_local_time_from_ticks ( byte64  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.

int clan::MutexSection::get_lock_count ( ) const
inline

Returns the amounts of recursive mutex locks performed by this section.

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 ubyte64 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.

virtual int clan::EventProvider::get_num_event_handles ( )
pure virtual

Returns the number of OS handles relevant for this event.

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

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 ubyte64 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 ( byte64  ticks)
static

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

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.

void clan::Thread::join ( )

Blocks until thread has completed its execution.

void clan::Thread::kill ( )

Terminates the thread.

Warning: This is a dangerous function that should only be used in the most extreme cases. If the target thread owns a critical section, the critical section will not be released. If the target thread is allocating memory from the heap, the heap lock will not be released. Windows XP/2000: The target thread's initial stack is not freed, causing a resource leak.

void clan::Mutex::lock ( )

Lock mutex.

void clan::MutexSection::lock ( )
inline

Lock the mutex.

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

Process command line and run service.

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::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.

virtual bool clan::EventProvider::reset ( )
inlinevirtual

Reset flag.

void clan::GameTime::reset ( )

Resets the timer.

template<class C>
virtual void clan::RunnableMember_v0< C >::run ( )
inlinevirtual
template<class C, class P1>
virtual void clan::RunnableMember_v1< C, P1 >::run ( )
inlinevirtual
template<class C, class P1, class P2>
virtual void clan::RunnableMember_v2< C, P1, P2 >::run ( )
inlinevirtual
template<class C, class P1, class P2, class P3>
virtual void clan::RunnableMember_v3< C, P1, P2, P3 >::run ( )
inlinevirtual
template<class C, class P1, class P2, class P3, class P4>
virtual void clan::RunnableMember_v4< C, P1, P2, P3, P4 >::run ( )
inlinevirtual
template<class C, class P1, class P2, class P3, class P4, class P5>
virtual void clan::RunnableMember_v5< C, P1, P2, P3, P4, P5 >::run ( )
inlinevirtual
virtual void clan::Service::service_reload ( )
protectedpure virtual

Called when the service is asked to reload its configuration.

virtual void clan::Service::service_start ( std::vector< std::string > &  args)
protectedpure virtual

Called when the service is asked to start.

virtual void clan::Service::service_stop ( )
protectedpure virtual

Called when the service is asked to stop.

virtual bool clan::EventProvider::set ( )
inlinevirtual

Raise flag.

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
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.

static void clan::Runnable::set_thread_name ( const char *  name)
static
static void clan::Thread::set_thread_name ( const char *  name)
static

Sets the name (displayed in debuggers) of the calling thread.

Currently this only works with the Visual Studio compiler and debugger.

void clan::DateTime::set_timezone ( TimeZone  timezone)
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::Thread::start ( Runnable runnable)

Starts a thread.

template<class C >
void clan::Thread::start ( C *  instance,
void(C::*)()  member 
)
inline
template<class C , class P1 >
void clan::Thread::start ( C *  instance,
void(C::*)(P1 p1)  member,
P1  p1 
)
inline
template<class C , class P1 , class P2 >
void clan::Thread::start ( C *  instance,
void(C::*)(P1 p1, P2 p2)  member,
P1  p1,
P2  p2 
)
inline
template<class C , class P1 , class P2 , class P3 >
void clan::Thread::start ( C *  instance,
void(C::*)(P1 p1, P2 p2, P3 p3)  member,
P1  p1,
P2  p2,
P3  p3 
)
inline
template<class C , class P1 , class P2 , class P3 , class P4 >
void clan::Thread::start ( C *  instance,
void(C::*)(P1 p1, P2 p2, P3 p3, P4 p4)  member,
P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline
template<class C , class P1 , class P2 , class P3 , class P4 , class P5 >
void clan::Thread::start ( C *  instance,
void(C::*)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)  member,
P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline
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.

byte64 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
bool clan::Mutex::try_lock ( )

Attempt to lock mutex.

bool clan::MutexSection::try_lock ( )
inline

Attempt to lock mutex.

void clan::Mutex::unlock ( )

Unlock mutex.

void clan::MutexSection::unlock ( )
inline

Unlock mutex.

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 (
)
virtual

Returns description of exception.

virtual void clan::WorkItem::work_completed ( )
inlinevirtual

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
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 SetupCore_Impl
friend