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