WYRDTEK Home Features Reference Downloads About


Reference/es_mbc_newsub

Syntax

int es_mbc_newsub( struct es_mbd *def,
                   const char *clsnm,
                   struct es_mbc *extends,
                   struct es_mbc **res );

Arguments

struct es_mbd *def A database definition.
const char *clsnm Class name.
struct es_mbc *extends Pointer to super class that will be extended. Must not be NULL.
struct es_mbc **res Assigned result, passed by reference.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_CLASSEXISTS Class name already exists in database.

Description

Constructs a new class with respect to a database definition (struct es_mbd *def) and class name (const char *clsnm) that extends the class identified by struct es_mbc *extends. The new class inherits the same index type, batchsize, fields, index fields and parent of the extends class. The extends class may have been constructed previously either via es_mbc_new or es_mbc_newsub.

Extra fields and index fields may be added to the class via es_mbc_addfld and es_mbc_addfldidx respectively, but extra fields cannot be added to the index if the index is of type ES_INDEX_SHARED. This is because shared indices must be shared among all nodes of both the extends class and subclass.

Node instances of either extends or res may be stored as child nodes of the parent of extends - if it has a parent. This is consistent with the way base class pointers in C++ may point to any object instances that subclass the base class.

[Back To Reference] [Back To Reference/es_mbc]