Code
/**********************************************************************************************
Class : e_Platform
Description : encapsulated all platform related functions for portability.
Comments :
History :
**********************************************************************************************/
class e_Platform {
public:
// Modules:
static e_ModuleHandle load_module( string name );
static void free_module( e_ModuleHandle module );
static e_SymbolHandle get_symbol( e_ModuleHandle module, const string name );
// Threads:
static uint get_number_threads();
static e_ThreadHandle create_thread( e_ThreadFunction func, pvoid param );
static int wait_thread( e_ThreadHandle thread );
static void wait_multiple_threads( int num_threads, e_ThreadHandle threads[] );
static int delete_thread( e_ThreadHandle thread );
static void create_mutex( e_Mutex & mutex );
static void delete_mutex( e_Mutex & mutex );
static void lock_mutex( e_Mutex & mutex );
static void unlock_mutex( e_Mutex & mutex );
// Time:
static float get_time();
// Environment:
static string get_environment( const string name );
// Files and Directories:
static int file_exists( string name );
static void format_filename( string & name );
static e_FileHandle open_file( string name, const e_FileMode mode );
static uint read_file( e_FileHandle file, pvoid buf, const uint size );
static uint write_file( e_FileHandle file, const pvoid buf, const uint size );
static void close_file( e_FileHandle file );
static void delete_file( string name );
static string get_temp_filename( string dir, const string prefix );
static void create_directory( string name );
static void delete_directory( string name );
static void enumerate( string name, e_FileEnumerator func, pvoid param );
static string get_current_directory();
// Memory:
static pvoid alloc( size_t size );
static void dealloc( pvoid ptr );
static pvoid aligned_alloc( size_t size, size_t align );
static void aligned_dealloc( pvoid ptr );
};
/**********************************************************************************************
Class : e_Platform
Description : encapsulated all platform related functions for portability.
Comments :
History :
**********************************************************************************************/
class e_Platform {
public:
// Modules:
static e_ModuleHandle load_module( string name );
static void free_module( e_ModuleHandle module );
static e_SymbolHandle get_symbol( e_ModuleHandle module, const string name );
// Threads:
static uint get_number_threads();
static e_ThreadHandle create_thread( e_ThreadFunction func, pvoid param );
static int wait_thread( e_ThreadHandle thread );
static void wait_multiple_threads( int num_threads, e_ThreadHandle threads[] );
static int delete_thread( e_ThreadHandle thread );
static void create_mutex( e_Mutex & mutex );
static void delete_mutex( e_Mutex & mutex );
static void lock_mutex( e_Mutex & mutex );
static void unlock_mutex( e_Mutex & mutex );
// Time:
static float get_time();
// Environment:
static string get_environment( const string name );
// Files and Directories:
static int file_exists( string name );
static void format_filename( string & name );
static e_FileHandle open_file( string name, const e_FileMode mode );
static uint read_file( e_FileHandle file, pvoid buf, const uint size );
static uint write_file( e_FileHandle file, const pvoid buf, const uint size );
static void close_file( e_FileHandle file );
static void delete_file( string name );
static string get_temp_filename( string dir, const string prefix );
static void create_directory( string name );
static void delete_directory( string name );
static void enumerate( string name, e_FileEnumerator func, pvoid param );
static string get_current_directory();
// Memory:
static pvoid alloc( size_t size );
static void dealloc( pvoid ptr );
static pvoid aligned_alloc( size_t size, size_t align );
static void aligned_dealloc( pvoid ptr );
};