ucommon/platform.h File Reference

Various miscellaneous platform specific headers and defines. More...

#include <pthread.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
Include dependency graph for platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ucommon
 

Common namespace for all ucommon objects.


Defines

#define __EXPORT
#define __LOCAL
#define __MALLOC
#define __PRINTF(x, y)
#define __SCANF(x, y)
#define __SHARED
#define _REENTRANT   1
#define _THREADSAFE   1
#define _UCOMMON_EXTENDED_
#define crit(x, text)   if(!(x)) cpr_runtime_error(text)
#define END_NAMESPACE   }
#define EXTERN_C   extern "C"
#define INVALID_HANDLE_VALUE   -1
#define INVALID_SOCKET   -1
#define NAMESPACE_EXTERN_C   extern "C" {
#define NAMESPACE_UCOMMON   namespace ucommon {
#define PROGRAM_EXIT(code)   return code
#define PROGRAM_MAIN(argc, argv)   extern "C" int main(int argc, char **argv)
#define SERVICE_MAIN(id, argc, argv)   void service_##id(int argc, char **argv)
#define UCOMMON_ABI   6
#define UCOMMON_NAMESPACE   ucommon

Typedefs

typedef void(* cpr_service_t )(int argc, char **argv)
typedef int fd_t
typedef long Integer
typedef double Real
typedef void(* sighandler_t )(int)
 Convenient typedef for signal handlers.
typedef int socket_t
typedef unsigned long timeout_t
 Typedef for millisecond timer values.
typedef unsigned long Unsigned

Functions

template<class T >
T * init (T *memory)
 Template function to initialize memory by invoking default constructor.
void strfree (char *str)
 Matching function for strdup().

Detailed Description

Various miscellaneous platform specific headers and defines.

This is used to support ucommon on different platforms. The ucommon library assumes at least a real posix threading library is present or will build thread support native on Microsoft Windows legacy platform. This header also deals with issues related to common base types.

Definition in file platform.h.


Typedef Documentation

typedef void(* sighandler_t)(int)

Convenient typedef for signal handlers.

Definition at line 324 of file platform.h.

typedef unsigned long timeout_t

Typedef for millisecond timer values.

Definition at line 326 of file platform.h.


Function Documentation

template<class T >
T* init ( T *  memory  )  [inline]

Template function to initialize memory by invoking default constructor.

If NULL is passed, then NULL is returned without any constructor called.

Parameters:
memory to initialize.
Returns:
memory initialized.
Examples:
cipher.cpp, and ssl.cpp.

Definition at line 420 of file platform.h.

void strfree ( char *  str  )  [inline]

Matching function for strdup().

Parameters:
string to release from allocated memory.

Definition at line 431 of file platform.h.


Generated on 30 Jul 2013 for UCommon by  doxygen 1.6.1