c_tlm_comp.h File Reference
#include "c_list.h"
Include dependency graph for c_tlm_comp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tlm_component
 

Typedefs

typedef void(* tlm_comp_callback) (tlm_component *comp_ptr, void *arg1, void *arg2)
 

Functions

tlm_componenttlm_component_add (const char *name)
 
tlm_componenttlm_component_get_by_name (const char *name)
 
void tlm_component_for_each (tlm_comp_callback callback, void *arg1, void *arg2)
 

Detailed Description

This file allows telemetry component registration. Memory locations or variables registered for telemetry are grouped by component. Once registered, the telemetry of these variables can be streamed to a file, network, or just stdio

This file allows to register distinct components by name. Components with duplicate name will fail to be added to the components' list. Once a component is registered, then variables underneath the component can be registered:

See also
c_tlm_var.h

Example registration of a component and a couple of variables :

tlm_component* comp = tlm_component_add("component 1");
int a = 0;
char b = 0;
tlm_variable_register(comp, "a", &a, sizeof(a)));
TLM_REG_VAR(comp, b); // Macro to register variable b

Typedef Documentation

typedef void(* tlm_comp_callback) (tlm_component *comp_ptr, void *arg1, void *arg2)

The callback type for each component

See also
tlm_component_for_each()

Function Documentation

tlm_component* tlm_component_add ( const char *  name)

Adds a telemetry component by name.

Parameters
nameThe persistent data pointer to the name of the telemetry component.
Returns
tlm_component pointer if this component added successfully, but NULL if another component already exists with this name.
void tlm_component_for_each ( tlm_comp_callback  callback,
void *  arg1,
void *  arg2 
)

Calls your callback function for each telemetry component added to the telemetry components list by tlm_component_add().

Parameters
arg1arg2 The arguments is passed to your callback like this: callback(tlm_component*, arg1, arg2)
tlm_component* tlm_component_get_by_name ( const char *  name)

Get an existing telemetry component by name

Returns
NULL pointer if the component by name was not found