Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_base_macros.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00003
    00004 //               O S C L B A S E _ M A C R O S
    00005
    00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00007
    00018 #ifndef OSCL_BASE_MACROS_H_INCLUDED
    00019 #define OSCL_BASE_MACROS_H_INCLUDED
    00020
    00021 // Pick up any platform-specific definitions for the common
    00022 // macros.
    00023 #include "osclconfig.h"
    00024
    00025 // Define default values for the common macros
    00026 #ifndef OSCL_EXPORT_REF
    00027 #define OSCL_EXPORT_REF
    00028 #endif
    00029
    00030 #ifndef OSCL_IMPORT_REF
    00031 #define OSCL_IMPORT_REF
    00032 #endif
    00033
    00035 //static const char NULL_TERM_CHAR = '\0';
    00036 #ifndef NULL_TERM_CHAR
    00037 #define NULL_TERM_CHAR '\0'
    00038 #endif
    00039
    00041 #ifndef NULL
    00042 #define NULL (0)
    00043 #endif
    00044
    00045 #if (OSCL_DISABLE_INLINES)
    00046 #define OSCL_INLINE
    00047 #define OSCL_COND_EXPORT_REF OSCL_EXPORT_REF
    00048 #define OSCL_COND_IMPORT_REF OSCL_IMPORT_REF
    00049 #else
    00050 #define OSCL_INLINE inline
    00051 #define OSCL_COND_EXPORT_REF
    00052 #define OSCL_COND_IMPORT_REF
    00053 #endif
    00054
    00055 //this macro may not be defined in all configurations
    00056 //so a default is defined here.
    00057
    00059
    00064 #define OSCL_CONST_CAST(type,exp)           ((type)(exp))
    00065 #define OSCL_STATIC_CAST(type,exp)          ((type)(exp))
    00066 #define OSCL_REINTERPRET_CAST(type,exp)     ((type)(exp))
    00067 #define OSCL_DYNAMIC_CAST(type, exp)        ((type)(exp))
    00068 #define OSCL_VIRTUAL_BASE(type)               type
    00069
    00070
    00085 #define OSCL_UNUSED_ARG(vbl) (void)(vbl)
    00086 #define OSCL_UNUSED_RETURN(value) return value
    00087
    00088 /* The __TFS__ macro is used to optionally expand to "<>" depending on the
    00089  * compiler.  Some compilers require it to indicate that the friend function
    00090  * is a template function as specified in the standard, but others don't
    00091  * like it so it will handled with a macro expansion that depends on the
    00092  * compiler.
    00093  */
    00094 #ifndef __TFS__
    00095 #define __TFS__
    00096 #endif
    00097
    00098 #define OSCL_MIN(a,b) ((a) < (b) ? (a) : (b))
    00099 #define OSCL_MAX(a,b) ((a) > (b) ? (a) : (b))
    00100 #define OSCL_ABS(a) ((a) > (0) ? (a) : -(a))
    00101
    00102 // the syntax for explicitly calling the destructor varies on some platforms
    00103 // below is the default syntax as defined in the C++ standard
    00104 #ifndef OSCL_TEMPLATED_DESTRUCTOR_CALL
    00105 #define OSCL_TEMPLATED_DESTRUCTOR_CALL(type,simple_type) type :: ~simple_type ()
    00106 #endif
    00107
    00108
    00109 /*
    00110  * The OSCL_UNSIGNED_CONST macro is used to optionally add a suffix to the
    00111  * end of integer constants to identify them as unsigned constants.  It is
    00112  * usually only necessary to do that for very large constants that are too
    00113  * big to fit within the range of a signed integer. Some compilers will issue
    00114  * warnings for that.  The default behavior will be to add no suffix.
    00115  */
    00116
    00117 #ifndef OSCL_UNSIGNED_CONST
    00118 #define OSCL_UNSIGNED_CONST(x) x
    00119 #endif
    00120
    00121 /*
    00122  * These macros are used by MTP to avoid byte aligning structures.
    00123  */
    00124 #ifndef OSCL_PACKED_VAR
    00125 #define OSCL_PACKED_VAR     "error"
    00126 #endif
    00127
    00128
    00131 #endif  // OSCL_BASE_MACROS_H_INCLUDED