Clingo
Loading...
Searching...
No Matches
stats.h
1#ifndef CLINGO_STATS_H
2#define CLINGO_STATS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <clingo/core.h>
9
10typedef struct clingo_control clingo_control_t;
11
42
48
57
59typedef struct clingo_statistic clingo_stats_t;
60
66CLINGO_VISIBILITY_DEFAULT bool clingo_stats_root(clingo_stats_t const *stats, uint64_t *key);
67
74CLINGO_VISIBILITY_DEFAULT bool clingo_stats_type(clingo_stats_t const *stats, uint64_t key, clingo_stats_type_t *type);
75
84CLINGO_VISIBILITY_DEFAULT bool clingo_stats_to_string(clingo_stats_t const *stats, uint64_t key,
86
89
97CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_size(clingo_stats_t const *stats, uint64_t key, size_t *size);
106CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_at(clingo_stats_t const *stats, uint64_t key, size_t offset,
107 uint64_t *subkey);
116CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_push(clingo_stats_t *stats, uint64_t key, clingo_stats_type_t type,
117 uint64_t *subkey);
119
122
130CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_size(clingo_stats_t const *stats, uint64_t key, size_t *size);
140CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_has_subkey(clingo_stats_t const *stats, uint64_t key, char const *name,
141 size_t size, bool *result);
150CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_subkey_name(clingo_stats_t const *stats, uint64_t key, size_t offset,
151 clingo_string_t *name);
162CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_at(clingo_stats_t const *stats, uint64_t key, char const *name,
163 size_t size, uint64_t *subkey);
174CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_add_subkey(clingo_stats_t *stats, uint64_t key, char const *name,
175 size_t size, clingo_stats_type_t type, uint64_t *subkey);
177
180
188CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_get(clingo_stats_t const *stats, uint64_t key, double *value);
196CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_set(clingo_stats_t *stats, uint64_t key, double value);
198
204CLINGO_VISIBILITY_DEFAULT bool clingo_control_stats(clingo_control_t *control, clingo_stats_t const **stats);
205
207
208#ifdef __cplusplus
209}
210#endif
211
212#endif
struct clingo_string_builder clingo_string_builder_t
A builder for strings.
Definition core.h:257
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_add_subkey(clingo_stats_t *stats, uint64_t key, char const *name, size_t size, clingo_stats_type_t type, uint64_t *subkey)
Add a subkey with the given name.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_type(clingo_stats_t const *stats, uint64_t key, clingo_stats_type_t *type)
Get the type of a key.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_size(clingo_stats_t const *stats, uint64_t key, size_t *size)
Get the number of subkeys of a map entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_set(clingo_stats_t *stats, uint64_t key, double value)
Set the value of the given entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_has_subkey(clingo_stats_t const *stats, uint64_t key, char const *name, size_t size, bool *result)
Test if the given map contains a specific subkey.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_root(clingo_stats_t const *stats, uint64_t *key)
Get the root key of the stats.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_push(clingo_stats_t *stats, uint64_t key, clingo_stats_type_t type, uint64_t *subkey)
Create the subkey at the end of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_to_string(clingo_stats_t const *stats, uint64_t key, clingo_string_builder_t *builder)
Get a string representation of the statistics.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_subkey_name(clingo_stats_t const *stats, uint64_t key, size_t offset, clingo_string_t *name)
Get the name associated with the offset-th subkey.
int clingo_stats_type_t
Corresponding type to clingo_stats_type.
Definition stats.h:56
clingo_stats_type_e
Enumeration for entries of the stats.
Definition stats.h:50
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_size(clingo_stats_t const *stats, uint64_t key, size_t *size)
Get the size of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_stats(clingo_control_t *control, clingo_stats_t const **stats)
Get the solver stats.
struct clingo_statistic clingo_stats_t
Handle for the solver stats.
Definition stats.h:59
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_get(clingo_stats_t const *stats, uint64_t key, double *value)
Get the value of the given entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_at(clingo_stats_t const *stats, uint64_t key, size_t offset, uint64_t *subkey)
Get the subkey at the given offset of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_at(clingo_stats_t const *stats, uint64_t key, char const *name, size_t size, uint64_t *subkey)
Lookup a subkey under the given name.
@ clingo_stats_type_map
the entry is a map
Definition stats.h:53
@ clingo_stats_type_value
the entry is a (double) value
Definition stats.h:51
@ clingo_stats_type_array
the entry is an array
Definition stats.h:52
Struct to capture strings that are not null-terminated.
Definition core.h:91