Model constructor

Model(
  1. ModelInfo model
)

Implementation

Model(ModelInfo model)
    : _cModel = checkObxPtr(C.model(), 'failed to create model') {
  try {
    model.entities.forEach(addEntity);

    C.model_last_entity_id(
        _cModel, model.lastEntityId.id, model.lastEntityId.uid);
    C.model_last_relation_id(
        _cModel, model.lastRelationId.id, model.lastRelationId.uid);
    C.model_last_index_id(
        _cModel, model.lastIndexId.id, model.lastIndexId.uid);
  } catch (e) {
    C.model_free(_cModel);
    rethrow;
  }
}