libadc-cxx 1.0.0
Structured logging for scientific computing
Loading...
Searching...
No Matches
builder.hpp
Go to the documentation of this file.
1#ifndef adc_builder_hpp
2#define adc_builder_hpp
3#include <string>
4#include <iostream>
5#include <sstream>
6#include <map>
7#include <memory>
8#if ADC_BOOST_JSON_PUBLIC
9#include "boost/json.hpp"
10#endif
11#include "adc/types.hpp"
12#include <sys/time.h>
13
14namespace adc {
15
16/** \addtogroup API
17 * @{
18 */
19
20/// \return iso 8601 formatted string based on ts
21std::string format_timespec_8601(struct timespec& ts);
22
23/// \return utc seconds.nanoseconds formatted string based on ts
24std::string format_timespec_utc_ns(struct timespec& ts);
25
26inline version builder_api_version("1.0.0", {"none"});
27
28/** \addtogroup builder_add_host_options
29 * @{
30 */
31/** \def ADC_HS_
32 * \brief bit values to control content of the host section.
33 *
34 * The host data section has a variety of optional subsections.
35 * The ADC_HS_* bit values desired are ORd (|) together.
36 * The data for subsections with identifier >= 0x10 is expensive, constant,
37 * and should not be collected multiple times per program run.
38 *
39 * Dynamic meminfo usage is collected with add_memory_usage_section
40 * not the host section.
41 */
42#define ADC_HS_
43/** OR-d ADC_HS_* bits */
45
46/// \brief ADC_HS_BASE collects just the hostname via gethostname()
47#define ADC_HS_BASE 0x0
48
49/// \brief ADC_HS_OS collects other items from uname().
50#define ADC_HS_OS 0x1
51
52/// \brief ADC_HS_RAMSIZE collects MemTotal
53#define ADC_HS_RAMSIZE 0x2
54
55/// \brief ADC_HS_ENV collects env vars listed in env("ADC_HOST_SECTION_ENV") which is :-separated.
56/// Example: ADC_HOST_SECTION_ENV="SNLCLUSTER:SNLNETWORK:SNLSITE:SNLSYSTEM:SNLOS"
57#define ADC_HS_ENV 0x4
58
59/// \brief ADC_HS_CPU collects details from lscpu -J (requires lscpu installed)
60#define ADC_HS_CPU 0x10
61
62/// \brief ADC_HS_GPU collects gpu data available from lspci (requires lspci installed)
63#define ADC_HS_GPU 0x20
64
65/// \brief ADC_HS_NUMA collects numa node, cpu, and per node memory from numactl -H (requires numactl installed)
66#define ADC_HS_NUMA 0x40
67
68/// \brief all ADC_HS_* optional data included
69#define ADC_HS_ALL (ADC_HS_OS|ADC_HS_RAMSIZE|ADC_HS_ENV|ADC_HS_CPU|ADC_HS_GPU|ADC_HS_NUMA)
70/** @}*/
71
72/** \addtogroup builder_add_mpi_options
73 * @{
74 */
75/** \def ADC_MPI_
76 * \brief bit values to control output of the add_mpi function
77 *
78 * The mpi data has a variety of optional fields.
79 * The ADC_MPI_* bit values desired are ORd (|) together.
80 */
81#define ADC_MPI_
82/** OR-d ADC_MPI_* bits */
83typedef int32_t adc_mpi_field_flags;
84
85/// \brief include no mpi fields
86#define ADC_MPI_NONE 0x0
87
88/// \brief include "mpi_rank" field from mpi_comm_rank
89#define ADC_MPI_RANK 0x1
90
91/// \brief include "mpi_size" field from mpi_comm_size
92#define ADC_MPI_SIZE 0x2
93
94/// \brief include "mpi_name" field from mpi_comm_name
95#define ADC_MPI_NAME 0x4
96
97/// \brief include "mpi_hostlist" subsection from the communicator
98///
99/// If this value is included, then the call to add_mpi must be collective.
100#define ADC_MPI_HOSTLIST 0x10
101
102/// \brief include "mpi_rank_host" subsection from the communicator
103///
104/// If this value is included, then the call to add_mpi must be collective.
105#define ADC_MPI_RANK_HOST 0x20
106
107/// \brief include "mpi_version" field from MPI_VERSION.MPI_SUBVERSIUON
108#define ADC_MPI_VER 0x100
109
110/// \brief include mpi_get_library_version result.
111///
112/// If openmpi is not in use, no value is defined.
113#define ADC_MPI_LIB_VER 0x200
114
115/// \brief include all mpi options.
116/// If this value is used, then the call to add_mpi must be collective.
117#define ADC_MPI_ALL (ADC_MPI_RANK|ADC_MPI_SIZE|ADC_MPI_NAME|ADC_MPI_HOSTLIST|ADC_MPI_RANK_HOST|ADC_MPI_VER|ADC_MPI_LIB_VER)
118
119/// \brief include all mpi options that do not require collective work.
120#define ADC_MPI_LOCAL (ADC_MPI_RANK|ADC_MPI_SIZE|ADC_MPI_NAME|ADC_MPI_VER|ADC_MPI_LIB_VER)
121
122/** @}*/
123
124/*!
125\brief The builder api is used to construct structured log (json) messages that follow naming conventions.
126
127To be stored in the ADC storage system, every message must be created from the factory and then
128initialized with at least the add_header_section function.
129
130Primitives, arrays, or strings from existing application control formats including
131xml, yaml, or json and common containers of strings are supported.
132There are no functions here to parse external formats (e.g. xml, yaml, json) and store them
133as adc-formatted trees; this would add undesirable dependencies (parsing libraries)
134and (in some cases) introduce data typing ambiguities.
135*/
136class ADC_VISIBLE builder_api {
137public:
138 virtual ~builder_api() {};
139 /// \brief auto-populate the "header" section with application name
140 /// and required local data
141 virtual void add_header_section(std::string_view application_name) = 0;
142
143 /** \brief auto-populate the "host" section based on bitflags.
144 * There are many optional subsections covering cpus, gpus, numa, OS. RAM, etc.
145 * @param bitflags the OR (|) of the desired ADC_HS_*.
146 */
147 virtual void add_host_section(adc_hs_subsection_flags bitflags) = 0;
148
149 /// \brief create the "app_data" section with data defined by the application writer.
150 ///
151 /// Any relationship to previous jobs/higher level workflows goes in app_data,
152 /// Example:
153 /// std::shared_ptr< builder_api > app_data = factory.get_builder();
154 /// app_data.add("saw_id", getenv("SAW_WORKFLOW_ID");
155 /// builder->add_app_data_section(app_data);
156 virtual void add_app_data_section(std::shared_ptr< builder_api > app_data) = 0;
157
158 /// \brief populate application run-time physics (re)configuration/result to "model_data" section.
159 /// For example initial or changes in mesh/particle decomp go here.
160 virtual void add_model_data_section(std::shared_ptr< builder_api > model_data) = 0;
161
162 /// Auto-populate "code" section with os-derived info at time of call,
163 /// and user-provided tag string, version subsection, and code_details subsction.
164 ///
165 /// Example: pending.
166 virtual void add_code_section(std::string tag, std::shared_ptr< builder_api > version, std::shared_ptr< builder_api > code_details) = 0;
167
168 /// \brief Populate build/install "configuration" information such as options enabled
169 ///
170 /// Example: pending.
171 virtual void add_code_configuration_section(std::shared_ptr< builder_api > build_details) = 0;
172
173 /// \brief populate "exit_data" section with code and status stream and user provided details.
174 ///
175 /// Example: pending.
176 virtual void add_exit_data_section(int return_code, std::string status, std::shared_ptr< builder_api > status_details) = 0;
177
178 /// \brief populate "memory_usage" section with current host /proc/meminfo data
179 /// in the style of free(1).
180 ///
181 /// values included are:
182 /// mem_total mem_used mem_free mem_shared
183 /// mem_buffers mem_cache mem_available
184 /// swap_total swap_used swap_free
185 virtual void add_memory_usage_section() = 0;
186
187 /// \brief get the existing named section
188 /// \return the section, or an empty pointer if it doesn't exist.
189 virtual std::shared_ptr< builder_api > get_section(std::string_view name) = 0;
190
191 /// \brief get the names of sections
192 /// \return vector of names, or an empty vector.
193 virtual std::vector< std::string > get_section_names() = 0;
194
195 /// \brief get the existing named field in the section.
196 /// \return the field description, with kt==k_none if not found.
197 /// If the value has kt==k_section, call get_section instead.
198 /// If the value was not set via this interface, k_none is returned
199 virtual const field get_value(std::string_view field_name) = 0;
200
201 /// \brief get the names of non-section fields in the section
202 /// \return vector of names, or an empty vector.
203 virtual std::vector< std::string > get_field_names() = 0;
204
205 /// \brief populate mpi_comm_$name section with members mpi_* as indicated by bitflags
206 /// \param name scoping label of the communicator, something like world, ocean, atmosphere.
207 /// \param mpi_comm_p address of an MPI_Comm variable.
208 /// If mpi_comm_p is NULL,
209 /// then rank/size is 0/1 and all other fields are trivial.
210 /// \param bitflags the or (|) of ADC_MPI_* flags desired.
211 /// If hostlist is included, this call must be made collectively.
212 ///
213 /// It is recommended to call add_mpi_section once per run on all ranks
214 /// as add_mpi_section("world", &MPI_COMM_WORLD, ADC_MPI_ALL)
215 /// (or again if communicators are created/resized).
216 /// It the app_data object for rank or size
217 /// and with the code_details object for mpi versions.
218 //
219 virtual void add_mpi_section(std::string_view name, void *mpi_comm_p, adc_mpi_field_flags bitflags) = 0;
220
221 /// \brief add gitlab_ci environment variable dictionary.
222 /// The section added is named "gitlab_ci".
223 ///
224 /// The variables collected from env() are:
225 /// - ci_runner_id
226 /// - ci_runner_version
227 /// - ci_project_id
228 /// - ci_project_name
229 /// - ci_server_fqdn
230 /// - ci_server_version
231 /// - ci_job_id
232 /// - ci_job_started_at
233 /// - ci_pipeline_id
234 /// - ci_pipeline_source
235 /// - ci_commit_sha
236 /// - gitlab_user_login
237 ///
238 /// Where the values are strings from the corresponding env() values.
239 virtual void add_gitlab_ci_section() = 0;
240
241 /// \brief add data from adc_wfid_ environment variables.
242 /// The section name is "adc_workflow".
243 ///
244 /// The env variables collected are:
245 /// wfid: ADC_WFID
246 /// wfid_parent: $ADC_WFID_PARENT
247 /// wfid_path: $ADC_WFID_PATH
248 ///
249 /// The suggested format of an adc workflow identifier (wfid) is as:
250 /// uuid -v1 -F STR
251 /// run at the appropriate scope.
252 /// For example, when starting numerous processes with mpi under slurm,
253 /// in the sbatch script before launching anything else do:
254 /// export ADC_WFID=$(uuid -v1 -F STR)
255 /// and then make sure it gets propagated to all the processes via the launch
256 /// mechamism. This ties all the messages from mpi ranks together in adc.
257 ///
258 /// Where a workflow parent (such as an agent launching multiple slurm jobs)
259 /// can,
260 /// export ADC_WFID_PARENT=$(uuid -v1 -F STR)
261 /// and then make sure this value is propagated to the slurm environments.
262 ///
263 /// Where possible (requires coordination at all workflow levels)
264 /// export ADC_WFID_PATH=(higher_level_wfid_path)/$ADC_WFID
265 /// the entire task hierarchy identifier can be collected.
266 virtual void add_workflow_section() = 0;
267
268 /// \brief add list of child uuids to "adc_workflow" section
269 /// after add_workflow_section has been called. This call is optional.
270 ///
271 /// This call may be repeated if necessary, incrementally building the child list.
272 /// wfid_children: [ user defined list of ids ]
273 ///
274 /// Where a workflow can track its immediate children, it may substantially
275 /// improve downstream workflow analyses if the child items can be captured.
276 /// The result appears in the resulting json as
277 /// wfid_children: $ADC_WFID_CHILDREN
278 virtual void add_workflow_children(std::vector< std::string >& child_uuids) = 0;
279
280 /// \brief add slurm output environment variable dictionary elements.
281 /// The section added is named "slurm".
282 ///
283 /// The variables collected from env() are:
284 /// - cluster: SLURM_CLUSTER_NAME
285 /// - job_id: SLURM_JOB_ID
286 /// - num_nodes: SLURM_JOB_NUM_NODES
287 /// - dependency: SLURM_JOB_DEPENDENCY
288 ///
289 /// Where the values are strings from the corresponding env() values.
290 virtual void add_slurm_section() = 0;
291 /// \brief add slurm output environment variable dictionary elements,
292 /// with the names of additionally desired SLURM output variables.
293 virtual void add_slurm_section(const std::vector<std::string>& slurmvars) = 0;
294
295 /// \brief copy populated generic section into the builder under specified name.
296 /// \param name key for a new object in the output.
297 /// \param section the value for the object. Note conventional names for certain sections
298 /// found in other add_*section functions.
299 virtual void add_section(std::string_view name, std::shared_ptr< builder_api > section) = 0;
300
301 /*!
302Conversion of the void pointer to data follows the enum type given, as listed
303in this table:
304 cp_bool: bool *
305 cp_char: char *
306 cp_char16: char16_t *
307 cp_char32: char32_t *
308 cp_cstr: char * a c string.
309 cp_json_str: char * a json string with nul termination
310 cp_xml_str: char * a xml string with nul termination
311 cp_yaml_str: char * a yaml string with nul termination
312 cp_json: // pointers to json objects are ignored.
313 cp_path: char * a c string which contains a path name.
314 cp_number_str: char * a c string which contains a arbitrary precision number
315 cp_uint8: uint8_t *
316 cp_uint16: uint16_t *
317 cp_uint32: uint32_t *v = (uint32_t *)p;
318 cp_uint64: uint64_t *v = (uint64_t *)p;
319 cp_int8: int8_t *v = (int8_t *)p;
320 cp_int16: int16_t *v = (int16_t *)p;
321 cp_int32: int32_t *v = (int32_t *)p;
322 cp_int64: int64_t *v = (int64_t *)p;
323 cp_f32: float *v = (float *)p;
324 cp_f64: double *v = (double *)p;
325 if ADC_SUPPORT_EXTENDED_FLOATS
326 cp_f80: long double *v = (long double *)p;
327 endif
328 if ADC_SUPPORT_QUAD_FLOATS
329 cp_f128: __float128 * // not yet implemented
330 if
331 if ADC_SUPPORT_GPU_FLOATS
332 cp_f8_e4m3: // not yet implemented
333 cp_f8_e5m2: // not yet implemented
334 cp_f16_e5m10: // not yet implemented
335 cp_f16_e8m7: // not yet implemented
336 endif
337 cp_c_f32: float * pointer to two adjacent floats (re, im)
338 cp_c_f64: double *v pointer to two adjacent double (re, im)
339 if ADC_SUPPORT_EXTENDED_FLOATS
340 cp_c_f80: long double * pointer to two adjacent extended precision (re, im)
341 endif
342 if ADC_SUPPORT_QUAD_FLOATS
343 cp_c_f128: __float128 * pointer to two adjacent quad (re, im) // not yet implemented
344 endif
345 cp_timespec: struct timespec *
346 cp_timeval: struct timeval *
347 cp_epoch: int64_t *
348
349 Calls with any unlisted enum value are ignored silently.
350 Calls with any type not supported in the current compilation are ignored.
351
352 */
353 virtual void add_from_pointer_type(std::string_view name, void *ref, enum scalar_type t) = 0;
354
355 /// \brief add a named boolean
356 virtual void add(std::string_view name, bool value) = 0;
357
358 /// \brief add a named character
359 virtual void add(std::string_view name, char value) = 0;
360
361 /// \brief add a named char16_t
362 virtual void add(std::string_view name, char16_t value) = 0;
363
364 /// \brief add a named char32_t
365 virtual void add(std::string_view name, char32_t value) = 0;
366
367 /// add null-terminated string
368 virtual void add(std::string_view name, char* value) = 0;
369 /// add null-terminated string
370 virtual void add(std::string_view name, const char* value) = 0;
371 /// add null-terminated string
372 virtual void add(std::string_view name, std::string& value) = 0;
373 /// add null-terminated string
374 virtual void add(std::string_view name, std::string_view value) = 0;
375
376 /// add null-terminated string filepath
377 virtual void add_path(std::string_view name, char* value) = 0;
378 /// add null-terminated string filepath
379 virtual void add_path(std::string_view name, const char* value) = 0;
380 /// add null-terminated string filepath
381 virtual void add_path(std::string_view name, std::string& value) = 0;
382 /// add null-terminated string filepath
383 virtual void add_path(std::string_view name, std::string_view value) = 0;
384
385 /// \brief add string which is serialized json.
386 virtual void add_json_string(std::string_view name, std::string_view value) = 0;
387
388 /// \brief add string which is yaml.
389 virtual void add_yaml_string(std::string_view name, std::string_view value) = 0;
390
391 /// \brief add string which is xml.
392 virtual void add_xml_string(std::string_view name, std::string_view value) = 0;
393
394 /// \brief add string which is an arbitrary precision decimal number
395 virtual void add_number_string(std::string_view name, std::string_view value) = 0;
396
397#if ADC_BOOST_JSON_PUBLIC
398 // add a named raw json value (array, obj, or value)
399 virtual void add(std::string_view name, boost::json::value value) = 0;
400#endif
401
402 /// add named uint8_t
403 virtual void add(std::string_view name, uint8_t value) = 0;
404 /// add named uint16_t
405 virtual void add(std::string_view name, uint16_t value) = 0;
406 /// add named uint32_t
407 virtual void add(std::string_view name, uint32_t value) = 0;
408 /// add named uint64_t
409 virtual void add(std::string_view name, uint64_t value) = 0;
410
411 /// add named int8_t
412 virtual void add(std::string_view name, int8_t value) = 0;
413 /// add named int16_t
414 virtual void add(std::string_view name, int16_t value) = 0;
415 /// add named int32_t
416 virtual void add(std::string_view name, int32_t value) = 0;
417 /// add named int64_t
418 virtual void add(std::string_view name, int64_t value) = 0;
419
420 /// add named 32-bit float
421 virtual void add(std::string_view name, float value) = 0;
422 /// add named 32-bit complex
423 virtual void add(std::string_view name, const std::complex<float>& value) = 0;
424 /// add named 64-bit float
425 virtual void add(std::string_view name, double value) = 0;
426 /// add named 64-bit complex
427 virtual void add(std::string_view name, const std::complex<double>& value) = 0;
428
429 /// add timeval
430 virtual void add(std::string_view name, const struct timeval& tv) = 0;
431 /// add timespec (e.g. clock_gettime)
432 virtual void add(std::string_view name, const struct timespec& ts) = 0;
433 /// add unix epoch seconds (gettimeofday)
434 virtual void add_epoch(std::string_view name, int64_t epoch) = 0;
435
436 /// Fixed length arrays of scalar members.
437 /// \param name the label for the array
438 /// \param value the array pointer
439 /// \param len the number of elements in the array
440 /// \param container is a hint about an original container such as
441 /// "pointer", "set", "vector", "list", "range", "array".
442 ///
443 /// Helper functions are provided to map std containers to the add_array
444 virtual void add_array(std::string_view name, bool value[], size_t len, std::string_view container = "pointer") = 0;
445
446 /// store fixed length array. this is how a character buffer containing nuls is stored.
447 virtual void add_array(std::string_view name, const char *value, size_t len, std::string_view container = "pointer") = 0;
448 virtual void add_array(std::string_view name, char16_t value[], size_t len, std::string_view container = "pointer") = 0;
449 virtual void add_array(std::string_view name, char32_t value[], size_t len, std::string_view container = "pointer") = 0;
450
451 virtual void add_array(std::string_view name, uint8_t value[], size_t len, std::string_view container = "pointer") = 0;
452 virtual void add_array(std::string_view name, uint16_t value[], size_t len, std::string_view container = "pointer") = 0;
453 virtual void add_array(std::string_view name, uint32_t value[], size_t len, std::string_view container = "pointer") = 0;
454 virtual void add_array(std::string_view name, uint64_t value[], size_t len, std::string_view container = "pointer") = 0;
455
456 virtual void add_array(std::string_view name, int8_t value[], size_t len, std::string_view container = "pointer") = 0;
457 virtual void add_array(std::string_view name, int16_t value[], size_t len, std::string_view container = "pointer") = 0;
458 virtual void add_array(std::string_view name, int32_t value[], size_t len, std::string_view container = "pointer") = 0;
459 virtual void add_array(std::string_view name, int64_t value[], size_t len, std::string_view container = "pointer") = 0;
460
461 virtual void add_array(std::string_view name, float value[], size_t len, std::string_view container = "pointer") = 0;
462#if 0
463 virtual void add_array(std::string_view name, const std::complex<float> value[], size_t len, std::string_view container = "pointer") = 0;
464#endif
465 virtual void add_array(std::string_view name, double value[], size_t len, std::string_view container = "pointer") = 0;
466#if 0
467 virtual void add_array(std::string_view name, const std::complex<double> value[], size_t len, std::string_view container = "pointer") = 0;
468#endif
469 // Arrays of null-terminated strings
470 virtual void add_array(std::string_view name, char* value[], size_t len, std::string_view container = "pointer") = 0;
471 virtual void add_array(std::string_view name, const char* value[], size_t len, std::string_view container = "pointer") = 0;
472 virtual void add_array(std::string_view name, std::string value[], size_t len, std::string_view container = "pointer") = 0;
473 virtual void add_array(std::string_view name, const std::string value[], size_t len, std::string_view container = "pointer") = 0;
474 virtual void add_array(std::string_view name, const std::vector<std::string> sv, std::string_view container = "vector") = 0;
475 virtual void add_array(std::string_view name, const std::set<std::string> ss, std::string_view container = "set") = 0;
476 virtual void add_array(std::string_view name, const std::list<std::string> sl, std::string_view container = "list") = 0;
477
478 /// Add Array of strings which are serialized json.
479 virtual void add_array_json_string(std::string_view name, const std::string value[], size_t len, std::string_view container = "pointer") = 0;
480
481 /// convert object to a json string reflecting the section hierarchy.
482 virtual std::string serialize() = 0;
483
484}; // class builder_api
485
486/** @}*/
487
488} // namespace adc
489#endif // adc_builder_hpp
The builder api is used to construct structured log (json) messages that follow naming conventions.
Definition builder.hpp:136
virtual void add_array(std::string_view name, const std::list< std::string > sl, std::string_view container="list")=0
virtual void add_array(std::string_view name, const std::vector< std::string > sv, std::string_view container="vector")=0
virtual void add_workflow_children(std::vector< std::string > &child_uuids)=0
add list of child uuids to "adc_workflow" section after add_workflow_section has been called....
virtual std::vector< std::string > get_field_names()=0
get the names of non-section fields in the section
virtual void add_exit_data_section(int return_code, std::string status, std::shared_ptr< builder_api > status_details)=0
populate "exit_data" section with code and status stream and user provided details.
virtual void add_array(std::string_view name, const std::set< std::string > ss, std::string_view container="set")=0
virtual void add_array(std::string_view name, char16_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, const char *value[], size_t len, std::string_view container="pointer")=0
virtual void add_header_section(std::string_view application_name)=0
auto-populate the "header" section with application name and required local data
virtual void add(std::string_view name, uint64_t value)=0
add named uint64_t
virtual void add_array(std::string_view name, double value[], size_t len, std::string_view container="pointer")=0
virtual void add_code_section(std::string tag, std::shared_ptr< builder_api > version, std::shared_ptr< builder_api > code_details)=0
virtual void add(std::string_view name, char value)=0
add a named character
virtual const field get_value(std::string_view field_name)=0
get the existing named field in the section.
virtual void add(std::string_view name, char *value)=0
add null-terminated string
virtual void add(std::string_view name, int8_t value)=0
add named int8_t
virtual void add_array(std::string_view name, uint8_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, int16_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, char *value[], size_t len, std::string_view container="pointer")=0
virtual void add_gitlab_ci_section()=0
add gitlab_ci environment variable dictionary. The section added is named "gitlab_ci".
virtual void add_path(std::string_view name, const char *value)=0
add null-terminated string filepath
virtual void add_host_section(adc_hs_subsection_flags bitflags)=0
auto-populate the "host" section based on bitflags. There are many optional subsections covering cpus...
virtual void add_path(std::string_view name, char *value)=0
add null-terminated string filepath
virtual void add_xml_string(std::string_view name, std::string_view value)=0
add string which is xml.
virtual void add_path(std::string_view name, std::string_view value)=0
add null-terminated string filepath
virtual void add(std::string_view name, std::string_view value)=0
add null-terminated string
virtual void add_slurm_section()=0
add slurm output environment variable dictionary elements. The section added is named "slurm".
virtual void add_from_pointer_type(std::string_view name, void *ref, enum scalar_type t)=0
virtual void add_array(std::string_view name, int32_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_slurm_section(const std::vector< std::string > &slurmvars)=0
add slurm output environment variable dictionary elements, with the names of additionally desired SLU...
virtual void add_array(std::string_view name, char32_t value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, float value)=0
add named 32-bit float
virtual void add_epoch(std::string_view name, int64_t epoch)=0
add unix epoch seconds (gettimeofday)
virtual void add_array(std::string_view name, bool value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, std::string &value)=0
add null-terminated string
virtual void add_array(std::string_view name, const std::string value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, uint32_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, uint64_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_array(std::string_view name, const char *value, size_t len, std::string_view container="pointer")=0
store fixed length array. this is how a character buffer containing nuls is stored.
virtual void add_array(std::string_view name, std::string value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, uint32_t value)=0
add named uint32_t
virtual std::vector< std::string > get_section_names()=0
get the names of sections
virtual void add(std::string_view name, bool value)=0
add a named boolean
virtual void add_array(std::string_view name, uint16_t value[], size_t len, std::string_view container="pointer")=0
virtual void add_mpi_section(std::string_view name, void *mpi_comm_p, adc_mpi_field_flags bitflags)=0
populate mpi_comm_$name section with members mpi_* as indicated by bitflags
virtual void add_array_json_string(std::string_view name, const std::string value[], size_t len, std::string_view container="pointer")=0
Add Array of strings which are serialized json.
virtual void add_yaml_string(std::string_view name, std::string_view value)=0
add string which is yaml.
virtual void add_array(std::string_view name, float value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, const struct timeval &tv)=0
add timeval
virtual void add_array(std::string_view name, int8_t value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, const char *value)=0
add null-terminated string
virtual void add_memory_usage_section()=0
populate "memory_usage" section with current host /proc/meminfo data in the style of free(1).
virtual void add(std::string_view name, char32_t value)=0
add a named char32_t
virtual void add_workflow_section()=0
add data from adc_wfid_ environment variables. The section name is "adc_workflow".
virtual std::shared_ptr< builder_api > get_section(std::string_view name)=0
get the existing named section
virtual ~builder_api()
Definition builder.hpp:138
virtual void add(std::string_view name, const std::complex< float > &value)=0
add named 32-bit complex
virtual void add(std::string_view name, int32_t value)=0
add named int32_t
virtual void add_app_data_section(std::shared_ptr< builder_api > app_data)=0
create the "app_data" section with data defined by the application writer.
virtual void add(std::string_view name, const std::complex< double > &value)=0
add named 64-bit complex
virtual void add(std::string_view name, double value)=0
add named 64-bit float
virtual std::string serialize()=0
convert object to a json string reflecting the section hierarchy.
virtual void add_path(std::string_view name, std::string &value)=0
add null-terminated string filepath
virtual void add(std::string_view name, uint8_t value)=0
add named uint8_t
virtual void add_number_string(std::string_view name, std::string_view value)=0
add string which is an arbitrary precision decimal number
virtual void add_section(std::string_view name, std::shared_ptr< builder_api > section)=0
copy populated generic section into the builder under specified name.
virtual void add_code_configuration_section(std::shared_ptr< builder_api > build_details)=0
Populate build/install "configuration" information such as options enabled.
virtual void add(std::string_view name, uint16_t value)=0
add named uint16_t
virtual void add_json_string(std::string_view name, std::string_view value)=0
add string which is serialized json.
virtual void add(std::string_view name, const struct timespec &ts)=0
add timespec (e.g. clock_gettime)
virtual void add_model_data_section(std::shared_ptr< builder_api > model_data)=0
populate application run-time physics (re)configuration/result to "model_data" section....
virtual void add(std::string_view name, int16_t value)=0
add named int16_t
virtual void add(std::string_view name, int64_t value)=0
add named int64_t
virtual void add_array(std::string_view name, int64_t value[], size_t len, std::string_view container="pointer")=0
virtual void add(std::string_view name, char16_t value)=0
add a named char16_t
std::string format_timespec_utc_ns(struct timespec &ts)
Definition builder.ipp:65
std::string format_timespec_8601(struct timespec &ts)
Definition builder.ipp:50
version builder_api_version("1.0.0", {"none"})
scalar_type
field types for scientific data encode/decode with json.
Definition types.hpp:58
int32_t adc_hs_subsection_flags
Definition builder.hpp:44
int32_t adc_mpi_field_flags
Definition builder.hpp:83
Definition adc.hpp:75
A version with tags list.
Definition types.hpp:24