Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros
Macro.h File Reference

Detailed Description

Helper macros.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DISALLOW_COPY_AND_ASSIGN(TypeName)
 Creates dummy copy constructor and assignment operator declarations.
#define OLA_UNUSED
 Mark unused arguments & types.
#define STATIC_ASSERT(x)   extern int __dummy[static_cast<int>x]
 Compile time assert().
#define PACK(__Declaration__)   __Declaration__ __attribute__((__packed__))
 Pack structures.

Macro Definition Documentation

#define DISALLOW_COPY_AND_ASSIGN (   TypeName)
Value:
TypeName(const TypeName&); \
void operator=(const TypeName&)

Creates dummy copy constructor and assignment operator declarations.

Use this in the private: section of a class to prevent copying / assignment.

Example
class Foo {
public:
Foo() { ... }
private:
};
#define OLA_UNUSED

Mark unused arguments & types.

Example
void Foo(OLA_UNUSED int bar) {}
OLA_UNUSED typedef int Baz;
#define PACK (   __Declaration__)    __Declaration__ __attribute__((__packed__))

Pack structures.

In order to account for platform differences with regard to packing, we need to use the following macro while declaring types that need to have a specific binary layout. Taken from: http://stackoverflow.com/questions/1537964/ visual-c-equivalent-of-gccs-attribute-packed

Example
struct foo_s {
uint16_t bar;
});
#define STATIC_ASSERT (   x)    extern int __dummy[static_cast<int>x]

Compile time assert().

Example
struct foo_s {
uint16_t bar;
});
STATIC_ASSERT(sizeof(foo_s) == 2);