Develop Biology
The language of life
ConstructorMacros.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS(ns, class, ...)
 
#define BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS_WITH_CTOR_COMMON(ns, class, ...)
 

Macro Definition Documentation

◆ BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS

#define BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS (   ns,
  class,
  ... 
)
Value:
class() : \
ns::Class< class >(this, __VA_ARGS__) \
{} \
explicit class(Name name) : \
ns::Class< class >(this, name, __VA_ARGS__) \
{} \
explicit class(StandardDimension id) : \
ns::Class< class >(this, id, __VA_ARGS__) \
{}
const char * Name
Definition: Types.h:46

Defines constructors for classes deriving from chemical::Class and beyond. These will allow you to construct your object with either a name or an id. We also define the empty constructor for when neither name nor id are supplied.

IMPORTANT: despite using VA_ARGS, this will fail if nothing more than the namespace and class are provided. At a minimum, you MUST ALSO INCLUDE THE Perspective AFTER class! e.g. BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS(my_namespace, MyClass, &MyClassPerspective::Instance())

NOTE: if your class has multiple template args or otherwise uses commas in its name, you must enclose it in BIO_SINGLE_ARG() so as to not have it be considered part of the VA_ARGS.

Parameters
nsthe namespace of the class
classthe name of the class
...all arguments to the ns::Class<class>(...) constructor.

Definition at line 38 of file ConstructorMacros.h.

◆ BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS_WITH_CTOR_COMMON

#define BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS_WITH_CTOR_COMMON (   ns,
  class,
  ... 
)
Value:
class() : \
ns::Class< class >(this, __VA_ARGS__) \
{ \
this->CtorCommon(); \
} \
explicit class(Name name) : \
ns::Class< class >(this, name, __VA_ARGS__) \
{ \
this->CtorCommon(); \
} \
explicit class(StandardDimension id) : \
ns::Class< class >(this, id, __VA_ARGS__) \
{ \
this->CtorCommon(); \
}

Defines constructors for classes deriving from chemical::Class and beyond. All constructors call a CtorCommon() method with no args. These will allow you to construct your object with either a name or an id. We also define the empty constructor for when neither name nor id are supplied.

IMPORTANT: despite using VA_ARGS, this will fail if nothing more than the namespace and class are provided. At a minimum, you MUST ALSO INCLUDE THE Perspective AFTER class! e.g. BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS(my_namespace, MyClass, &MyClassPerspective::Instance())

NOTE: if your class has multiple template args or otherwise uses commas in its name, you must enclose it in BIO_SINGLE_ARG() so as to not have it be considered part of the VA_ARGS.

Parameters
nsthe namespace of the class
classthe name of the class
...all arguments to the ns::Class<class>(...) constructor.

Definition at line 65 of file ConstructorMacros.h.