The Quantum Exact Simulation Toolkit v4.3.0
Loading...
Searching...
No Matches
types.cpp
1/** @file
2 * API convenience functions related to types.
3 *
4 * @author Tyson Jones
5 */
6
7#include "quest/include/types.h"
8
9#include "quest/src/core/printer.hpp"
10#include "quest/src/core/validation.hpp"
11
12#include <string>
13
14using std::string;
15
16
17
18/*
19 * STRINGS
20 */
21
22void reportStr(std::string str) {
23 validate_envIsInit(__func__);
24
25 printer_sync();
26
27 print(str);
28 print_newlines();
29
30 printer_sync();
31}
32
33extern "C" void reportStr(const char* str) {
34 reportStr(string(str));
35}
36
37
38
39/*
40 * SCALARS
41 */
42
43void reportScalar(string label, string numstr) {
44 validate_envIsInit(__func__);
45
46 // harmlessly re-validates
47 reportStr(label + (label.empty()? "" : ": ") + numstr);
48}
49
50void reportScalar(string label, qcomp num) { reportScalar(label, printer_toStr(num)); }
51void reportScalar(string label, qreal num) { reportScalar(label, printer_toStr(num)); }
52void reportScalar(const char* label, qreal num) { reportScalar(string(label), printer_toStr(num)); }
53
54extern "C" {
55 void reportScalar (const char* label, qcomp num) { reportScalar(string(label), printer_toStr(num)); }
56 void _reportScalar_real (const char* label, qreal num) { reportScalar(string(label), printer_toStr(num)); }
57}
void reportStr(std::string str)
Definition types.cpp:22
void reportScalar(const char *label, qcomp num)
Definition types.cpp:55