Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
Data Structures | Macros | Typedefs | Functions
Vector.h File Reference

Mutable contiguous storage for C types. More...

#include <stdarg.h>
#include <Objectively/Object.h>

Go to the source code of this file.

Data Structures

struct  Vector
 Vectors. More...
 

Macros

#define VectorElement(vector, type, index)    (((type *) vector->elements) + (index))
 Access the typed element of vector at the specified index. More...
 

Typedefs

typedef void(* VectorEnumerator) (const Vector *vector, ident obj, ident data)
 The VectorEnumerator function type. More...
 

Functions

OBJECTIVELY_EXPORT Class_Vector (void)
 

Detailed Description

Mutable contiguous storage for C types.

Definition in file Vector.h.

Macro Definition Documentation

◆ VectorElement

#define VectorElement (   vector,
  type,
  index 
)     (((type *) vector->elements) + (index))

Access the typed element of vector at the specified index.

Definition at line 88 of file Vector.h.

Typedef Documentation

◆ VectorEnumerator

typedef void(* VectorEnumerator) (const Vector *vector, ident obj, ident data)

The VectorEnumerator function type.

Parameters
vectorThe Vector.
objThe Object or element to enumerate.
dataUser data.

Definition at line 44 of file Vector.h.

Function Documentation

◆ _Vector()

OBJECTIVELY_EXPORT Class * _Vector ( void  )

Definition at line 387 of file Vector.c.

387 {
388 static Class *clazz;
389 static Once once;
390
391 do_once(&once, {
392 clazz = _initialize(&(const ClassDef) {
393 .name = "Vector",
394 .superclass = _Object(),
395 .instanceSize = sizeof(Vector),
396 .interfaceOffset = offsetof(Vector, interface),
397 .interfaceSize = sizeof(VectorInterface),
399 });
400 });
401
402 return clazz;
403}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition: Class.c:91
static void initialize(Class *clazz)
Definition: Vector.c:359
long Once
The Once type.
Definition: Once.h:37
#define do_once(once, block)
Executes the given block at most one time.
Definition: Once.h:43
ClassDefs are passed to _initialize via an archetype to initialize a Class.
Definition: Class.h:41
The runtime representation of a Class.
Definition: Class.h:95
Class * _Object(void)
The Object archetype.
Definition: Object.c:136
Vectors.
Definition: Vector.h:51