soma-io  5.0.5
soma::Creator< T > Class Template Reference

Object creation / resize or other setup factory. More...

#include <soma-io/utilities/creator.h>

Static Public Member Functions

static T * create (carto::Object header, const AllocatorContext &context, carto::Object options)
 Create a new object according to the given header. More...
 
static void setup (T &obj, carto::Object header, const AllocatorContext &context, carto::Object options)
 Setup (modify) an existing object according to the given header (maybe resize it etc.). More...
 

Detailed Description

template<typename T>
class soma::Creator< T >

Object creation / resize or other setup factory.

Such factories are used by the IO system which has to create or setup new objects according to information provided in the file header.

Specific implementations for new object types may be specialized. It is suggested that their ObjectCreator implementation is defined along with the object definition itself, to avoid accidentally using the default (non-specialized) creator somewhere (just like DataTypeCode).

Definition at line 57 of file creator.h.

Member Function Documentation

◆ create()

template<typename T >
T * soma::Creator< T >::create ( carto::Object  header,
const AllocatorContext context,
carto::Object  options 
)
inlinestatic

Create a new object according to the given header.

The default implementation just returns a new T.

Definition at line 76 of file creator.h.

References cartoCondMsg.

Referenced by soma::FormatReader< carto::GenericObject >::create().

◆ setup()

template<typename T >
void soma::Creator< T >::setup ( T &  obj,
carto::Object  header,
const AllocatorContext context,
carto::Object  options 
)
inlinestatic

Setup (modify) an existing object according to the given header (maybe resize it etc.).

The default implementation does nothing.

Definition at line 86 of file creator.h.

References cartoCondMsg.

Referenced by soma::FormatReader< carto::GenericObject >::setup().


The documentation for this class was generated from the following file: