DCMTK: ofstd/include/dcmtk/ofstd/ofalign.h File Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Macros
ofalign.h File Reference

Implements platform independent alignment, if possible similar to C++11's alignof / alignas functionality. More...

## Macros
#define | OFalignof <unspecified>
| Determine the alignment of a type T.
#define | OFalignas <unspecified>
| Align object or class like another type or as specified by an integral expression.
#define | OFalign <unspecified>
| Align a variable or data member.
#define | OFalign_typename OFTypename <unspecified>
| Alternate version of OFalign to be used within templates.

## Detailed Description

Implements platform independent alignment, if possible similar to C++11's alignof / alignas functionality.

## Macro Definition Documentation

## ◆ OFalign

#define OFalign <unspecified>

Align a variable or data member.

Note
  OFalign may not be available on your platform / compiler combination. Use `#ifdef OFalign` to query availability.

See also
  OFalign_typename

OFalign can be though of as the least common denominator of the alignment capabilities available on different platform / compiler combinations. Given a type T and an integral expression I, `OFalign(T,I)` evaluates to a type with a corresponding alignment modifier (either included in the type definition or as a modifier put next to it).
You may also use another type to specify the desired alignment, e.g. `OFalign(T,int)`. OFalign will then calculate the alignment using OFalignof (if available) or use sizeof() as approximation.
To align arrays via OFalign, simply pass the array's extents within the parameter, e.g. `OFalign(char[12],float)` to align an array containing 12 chars like a float.
When using OFalign inside a dependent scope (i.e. inside templates), you may need to use OFalign_typename instead, e.g.

typedef OFalign_typename(T,16) value_type;
OFalign_typename
#define OFalign_typename
Alternate version of OFalign to be used within templates.
Definition ofalign.h:131

OFalign should support alignments as any power of two <= 8192 (examine your compiler's manual when in doubt). Other alignments may also be supported, but may not be available on every platform. OFalign may simply ignore your request if you specify an unsupported alignment (won't output an error). You may want to check the alignment via OFalignof in case it is likely to fail. Using another type as alignment specifier should always work, as the required alignment is obviously supported in that case (at least when OFalignof is available).

## ◆ OFalign_typename

#define OFalign_typename OFTypename <unspecified>

Alternate version of OFalign to be used within templates.

Note
  OFalign_typename may not be available on your platform / compiler combination. Use `#ifdef OFalign` or `#ifdef OFalign_typename` to query availability.

See also
  OFalign

OFalign_typename is an alternate version of OFalign that internally uses keywords like OFTypename so it can be used inside a dependent scope. See OFalign for more information.

## ◆ OFalignas

#define OFalignas <unspecified>

Align object or class like another type or as specified by an integral expression.

Note
  OFalignas may not be available on your platform / compiler combination. Use `#ifdef OFalignas` to query availability. See OFalign for an alternative with limited functionality that supports more platforms in return.

OFalignas behaves similar to C++11's alignas when it's supported.

## ◆ OFalignof

#define OFalignof <unspecified>

Determine the alignment of a type T.

Note
  OFalignof may not be available on your platform / compiler combination. Use `#ifdef OFalignof` to query availability.

OFalignof behaves similar to C++11's alignof when it's supported.

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2