Skip to content

Commit

Permalink
Generated documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: Rule Timothy (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Sep 11, 2024
1 parent b23bb26 commit d63b784
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 41 deletions.
4 changes: 2 additions & 2 deletions doc/content/apis/modelc/examples/gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ int main(int argc, char** argv)
char buffer[100];
snprintf(buffer, sizeof(buffer), "st=%f,index=%d",
model_time, i);
sv->reset(sv, i);
sv->append(sv, i, buffer, strlen(buffer) + 1);
signal_reset(sv, i);
signal_append(sv, i, buffer, strlen(buffer) + 1);
}
} else {
/* Scalar vector. */
Expand Down
2 changes: 1 addition & 1 deletion doc/content/apis/modelc/examples/signalvector_annotation.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ModelDesc* model_create(ModelDesc* m)

if (idx.scalar) {
/* Set initial value. */
const char* v = idx.sv->annotation(idx.sv, idx.signal, "initial_value");
const char* v = signal_annotation(idx.sv, idx.signal, "initial_value");
if (v) *(idx.scalar) = atoi(v);
}

Expand Down
8 changes: 4 additions & 4 deletions doc/content/apis/modelc/examples/signalvector_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ int model_step(ModelDesc* m, double* model_time, double stop_time)

// Example use of object functions.
void* data = strdup("foo");
sv->reset(sv, i);
sv->append(sv, i, data, strlen("foo"));
signal_reset(sv, i);
signal_append(sv, i, data, strlen("foo"));
free(data);
sv->release(sv, i);
const char* mime_type = sv->annotation(sv, i, "mime_type");
signal_release(sv, i);
const char* mime_type = signal_annotation(sv, i, "mime_type");
if (mime_type) log_debug(" annotation : %s", mime_type);
} else {
log_debug(" scalar : %s", sv->scalar[i]);
Expand Down
1 change: 1 addition & 0 deletions doc/content/apis/modelc/gateway/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef struct ModelGatewayDesc {
const char** argv;
char* name_arg;
double clock_epsilon;
uint64_t [4] __reserved__;
}
```

Expand Down
71 changes: 56 additions & 15 deletions doc/content/apis/modelc/model/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ center footer Dynamic Simulation Environment

```c
typedef struct ModelDesc {
ModelVTable vtable;
ModelIndex index;
SimulationSpec* sim;
ModelInstanceSpec* mi;
SignalVector* sv;
ModelVTable vtable;
uint64_t [2] __reserved__;
}
```

Expand All @@ -127,6 +128,7 @@ typedef struct ModelVTable {
ModelStep step;
ModelDestroy destroy;
ModelIndex index;
void *[2] __reserved__;
}
```

Expand All @@ -137,17 +139,13 @@ typedef struct SignalVector {
const char* name;
const char* alias;
const char* function_name;
_Bool is_binary;
uint32_t count;
const char** signal;
BinarySignalAppendFunc append;
BinarySignalResetFunc reset;
BinarySignalReleaseFunc release;
SignalAnnotationGetFunc annotation;
BinarySignalCodecFunc codec;
ModelInstanceSpec* mi;
void* index;
SignalGroupAnnotationGetFunc group_annotation;
uint32_t count;
const char** signal;
_Bool is_binary;
SignalVectorVTable vtable;
uint64_t [9] __reserved__;
}
```

Expand All @@ -161,6 +159,7 @@ typedef struct SignalVectorVTable {
SignalAnnotationGetFunc annotation;
BinarySignalCodecFunc codec;
SignalGroupAnnotationGetFunc group_annotation;
void *[2] __reserved__;
}
```

Expand Down Expand Up @@ -356,6 +355,10 @@ name (const char*)
const char*
: The annotation value.

NULL
: The requested annotation was not found, inspect `errno` for additional
information..

#### Example (Annotation Specification)


Expand All @@ -377,10 +380,6 @@ spec:
>}}
NULL
: The requested annotation was not found.
### signal_append
Expand All @@ -406,6 +405,12 @@ len (uint32_t)
0
: The operation completed without error.
-EINVAL (-22)
: Bad arguments.
-ENOSYS (-88)
: The called function is not available.
<>0
: Indicates an error condition. Inspect `errno` for additional information.

Expand All @@ -432,7 +437,8 @@ void*
: The Codec object associated with the binary signal.

NULL
: The binary signal does not have an associated Codec object.
: The binary signal does not have an associated Codec object, inspect `errno`
for additional information..

#### Example (Codec Specification)

Expand Down Expand Up @@ -462,6 +468,29 @@ API](https://github.com/boschglobal/dse.standards/tree/main/dse/ncodec)



### signal_group_annotation

Get an annotation from a signal group.

#### Parameters

sv (SignalVector*)
: The Signal Vector object representing the signal group.

name (const char*)
: The name of the annotation.

#### Returns

const char*
: The annotation value.

NULL
: The requested annotation was not found, inspect `errno` for additional
information..



### signal_release

Release the resources allocated to a binary signal (e.g. free the buffer).
Expand All @@ -479,6 +508,12 @@ index (uint32_t)
0
: The operation completed without error.

-EINVAL (-22)
: Bad arguments.

-ENOSYS (-88)
: The called function is not available.

<>0
: Indicates an error condition. Inspect `errno` for additional information.

Expand All @@ -502,6 +537,12 @@ index (uint32_t)
0
: The operation completed without error.

-EINVAL (-22)
: Bad arguments.

-ENOSYS (-88)
: The called function is not available.

<>0
: Indicates an error condition. Inspect `errno` for additional information.

Expand Down
18 changes: 1 addition & 17 deletions doc/content/apis/modelc/runtime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ typedef struct ModelCArguments {
}
```

### ModelChannelDesc

```c
typedef struct ModelChannelDesc {
const char* name;
const char* function_name;
const char** signal_names;
int signal_count;
int propagator_source_channel;
int propagator_target_channel;
double* vector_double;
void** vector_binary;
int* vector_binary_size;
int* vector_binary_buffer_size;
}
```

### ModelDefinitionSpec

```c
Expand All @@ -87,6 +70,7 @@ typedef struct ModelInstanceSpec {
void* spec;
void* yaml_doc_list;
void* private;
int [4] __reserved__;
}
```

Expand Down
2 changes: 1 addition & 1 deletion doc/content/docs/examples/modelc/ncodec/ncodec_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

void configure_codec(ModelDesc* m, SignalVector* sv, uint32_t idx)
{
NCODEC* nc = sv->codec(sv, idx);
NCODEC* nc = sv->vtable.codec(sv, idx);
const char* node_id = NULL;
for (int i = 0; i >= 0; i++) {
NCodecConfigItem nci = ncodec_stat(nc, &i);
Expand Down
2 changes: 1 addition & 1 deletion doc/content/docs/examples/modelc/ncodec/ncodec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void test_message_sequence(void** state)
{
ModelCMock* mock = *state;
SignalVector* sv = mock->mi->model_desc->sv;
NCODEC* nc = sv->codec(sv, 2);
NCODEC* nc = sv->vtable.codec(sv, 2);
const char* buffer = "hello world";

// ...
Expand Down

0 comments on commit d63b784

Please sign in to comment.