FMI Library: part of JModelica.org
Data Structures | Typedefs | Functions
Named objects

Data Structures

struct  jm_named_ptr
 Name and object pointer pair. More...
 

Typedefs

typedef struct jm_named_ptr jm_named_ptr
 Name and object pointer pair. More...
 

Functions

jm_named_ptr jm_named_alloc (jm_string name, size_t size, size_t nameoffset, jm_callbacks *c)
 Allocate memory for the object and the name string and sets pointer to it packed together with the name pointer. More...
 
jm_named_ptr jm_named_alloc_v (jm_vector(char)*name, size_t size, size_t nameoffset, jm_callbacks *c)
 Same as jm_named_alloc() but name is given as a jm_vector(char) pointer. More...
 
static void jm_named_free (jm_named_ptr np, jm_callbacks *c)
 Free the memory allocated for the object pointed by jm_named_ptr. More...
 
 jm_vector_declare_template (jm_named_ptr) jm_define_comp_f(jm_compare_named
 Helper to construct comparison operation. More...
 
static jm_diff_named void jm_named_vector_free_data (jm_vector(jm_named_ptr)*v)
 Release the data allocated by the items in a vector and then clears the memory used by the vector as well. More...
 
static void jm_named_vector_free (jm_vector(jm_named_ptr)*v)
 Release the data allocated by the items in a vector and then clears the memory used by the vector as well. More...
 

Detailed Description

Typedef Documentation

Name and object pointer pair.

Definition at line 36 of file jm_named_ptr.h.

Function Documentation

jm_named_ptr jm_named_alloc ( jm_string  name,
size_t  size,
size_t  nameoffset,
jm_callbacks c 
)

Allocate memory for the object and the name string and sets pointer to it packed together with the name pointer.

Parameters
nameName for the object.
sizeSize of the data structure.
nameoffsetOffset of the name field within the data structure.
cCallbacks to be used for memory allocation.

The function jm_named_alloc() is intended for types defined as:

1 struct T {
2  < some data fields>
3  char name[1];
4 }

The "name" is copied into the allocated memory.

jm_named_ptr jm_named_alloc_v ( jm_vector(char)*  name,
size_t  size,
size_t  nameoffset,
jm_callbacks c 
)

Same as jm_named_alloc() but name is given as a jm_vector(char) pointer.

static void jm_named_free ( jm_named_ptr  np,
jm_callbacks c 
)
static

Free the memory allocated for the object pointed by jm_named_ptr.

Definition at line 66 of file jm_named_ptr.h.

jm_vector_declare_template ( jm_named_ptr  )

Helper to construct comparison operation.

static jm_diff_named void jm_named_vector_free_data ( jm_vector(jm_named_ptr)*  v)
static

Release the data allocated by the items in a vector and then clears the memory used by the vector as well.

This should be used for vectors initialized with jm_vector_init.

Definition at line 80 of file jm_named_ptr.h.

static void jm_named_vector_free ( jm_vector(jm_named_ptr)*  v)
static

Release the data allocated by the items in a vector and then clears the memory used by the vector as well.

This should be used for vectors created with jm_vector_alloc.

Definition at line 90 of file jm_named_ptr.h.