Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
memory.h File Reference
#include <memory>

Go to the source code of this file.

Macros

#define MOMENTUM_DEFINE_POINTERS(x)
 Define the standard set of smart-pointer type aliases for type x.
#define MOMENTUM_FWD_DECLARE_STRUCT(x)
 Forward-declare struct x and define its smart-pointer aliases.
#define MOMENTUM_FWD_DECLARE_CLASS(x)
 Forward-declare class x and define its smart-pointer aliases.
#define MOMENTUM_FWD_DECLARE_TEMPLATE_CLASS(x)
 Forward-declare a single-template-parameter class x##T and define float/double instantiation aliases plus their smart-pointer aliases.
#define MOMENTUM_FWD_DECLARE_TEMPLATE_STRUCT(x)
 Forward-declare a single-template-parameter struct x##T and define float/double instantiation aliases plus their smart-pointer aliases.

Macro Definition Documentation

◆ MOMENTUM_DEFINE_POINTERS

#define MOMENTUM_DEFINE_POINTERS ( x)
Value:
using x##_p = ::std::shared_ptr<x>; \
using x##_u = ::std::unique_ptr<x>; \
using x##_w = ::std::weak_ptr<x>; \
using x##_const_p = ::std::shared_ptr<const x>; \
using x##_const_u = ::std::unique_ptr<const x>; \
using x##_const_w = ::std::weak_ptr<const x>;

Define the standard set of smart-pointer type aliases for type x.

Generates six aliases following the project naming convention:

  • x##_p — std::shared_ptr<x>
  • x##_u — std::unique_ptr<x>
  • x##_w — std::weak_ptr<x>
  • x##_const_p — std::shared_ptr<const x>
  • x##_const_u — std::unique_ptr<const x>
  • x##_const_w — std::weak_ptr<const x>
Precondition
x must be a previously declared (or forward-declared) type name.

Definition at line 24 of file memory.h.

◆ MOMENTUM_FWD_DECLARE_CLASS

#define MOMENTUM_FWD_DECLARE_CLASS ( x)
Value:
class x; \
MOMENTUM_DEFINE_POINTERS(x)

Forward-declare class x and define its smart-pointer aliases.

See also
MOMENTUM_DEFINE_POINTERS for the generated alias names.

Definition at line 47 of file memory.h.

◆ MOMENTUM_FWD_DECLARE_STRUCT

#define MOMENTUM_FWD_DECLARE_STRUCT ( x)
Value:
struct x; \
MOMENTUM_DEFINE_POINTERS(x);

Forward-declare struct x and define its smart-pointer aliases.

See also
MOMENTUM_DEFINE_POINTERS for the generated alias names.

Definition at line 37 of file memory.h.

◆ MOMENTUM_FWD_DECLARE_TEMPLATE_CLASS

#define MOMENTUM_FWD_DECLARE_TEMPLATE_CLASS ( x)
Value:
template <typename T> \
class x##T; \
using x = x##T<float>; \
using x##d = x##T<double>; \
MOMENTUM_DEFINE_POINTERS(x) \
MOMENTUM_DEFINE_POINTERS(x##d)

Forward-declare a single-template-parameter class x##T and define float/double instantiation aliases plus their smart-pointer aliases.

Uses the project's backward-compatible naming scheme:

template <typename T> class BarT;
using Bar = BarT<float>;
using Bard = BarT<double>;

Smart-pointer aliases are generated for both Bar and Bard (e.g. Bar_p, Bard_p, ...).

Precondition
x##T must be a class template with exactly one type parameter.

Definition at line 68 of file memory.h.

◆ MOMENTUM_FWD_DECLARE_TEMPLATE_STRUCT

#define MOMENTUM_FWD_DECLARE_TEMPLATE_STRUCT ( x)
Value:
template <typename T> \
struct x##T; \
using x = x##T<float>; \
using x##d = x##T<double>; \
MOMENTUM_DEFINE_POINTERS(x) \
MOMENTUM_DEFINE_POINTERS(x##d)

Forward-declare a single-template-parameter struct x##T and define float/double instantiation aliases plus their smart-pointer aliases.

Uses the project's backward-compatible naming scheme:

template <typename T> struct BarT;
using Bar = BarT<float>;
using Bard = BarT<double>;

Smart-pointer aliases are generated for both Bar and Bard (e.g. Bar_p, Bard_p, ...).

Precondition
x##T must be a struct template with exactly one type parameter.

Definition at line 93 of file memory.h.