#include <iostream>
#include <map>
#include <string>
#include <functional>
#include <exception>
#include <vector>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
Go to the source code of this file.
◆ CommandHandler
◆ debugPrinter()
void debugPrinter |
( |
std::string |
id, |
|
|
std::string |
msg |
|
) |
| |
DEBUG PRINTER function.
- Parameters
-
id | an integer that defines thread number (0 for main) |
msg | a string containing message to be printed |
Prints to standard error
- Warning
- NOT thread-safe; must be called within a thread-safe scope
Definition at line 54 of file main.cpp.
◆ exceptionPrinter()
void exceptionPrinter |
( |
const char * |
excpt | ) |
|
EXCEPTION HANDLER function.
- Parameters
-
excpt | a const char* containing a message |
Prints to standard out
- Warning
- NOT thread-safe; must be called within a thread-safe scope
Definition at line 70 of file main.cpp.
◆ main()
- Note
- exit_command commented out to allow fallthrough to user prompt. If uncommented, exit_command will successfully exit program prior to user prompt. Ok to uncomment if desired.
-
The "//
Definition at line 753 of file main.cpp.
◆ DEBUG
turn on debug messages
Definition at line 41 of file main.cpp.
◆ exit_command
Initial value:= R"(
{
"command":"exit",
"payload": {
"reason":"Exiting program on user request."
}
}
)"
Definition at line 109 of file main.cpp.
◆ exit_command_fail
Initial value:= R"(
{
"command":"exit",
"payload": {
"booga":"gooba"
}
}
)"
Definition at line 118 of file main.cpp.
◆ fail_command
Initial value:= R"(
{
"command":"fail",
"payload": {
"Does not":"really matter what is in here."
}
}
)"
Definition at line 81 of file main.cpp.
◆ g_done
◆ help_command
Initial value:= R"(
{
"command":"help",
"payload": {
"usage":"Enter json command in 'command':'<command>','payload': { // json payload of arguments }"
}
}
)"
Definition at line 91 of file main.cpp.
◆ help_command_fail
Initial value:= R"(
{
"command":"help",
"payload": {
"reason":"Not usage."
}
}
)"
Definition at line 100 of file main.cpp.
◆ mean_command
Initial value:= R"(
{
"command": "mean_ints",
"payload": {
"addends": [1, 2, 3, 4, 5]
}
}
)"
Definition at line 173 of file main.cpp.
◆ mean_command_fraction
auto mean_command_fraction |
Initial value:= R"(
{
"command": "mean_ints",
"payload": {
"addends": [1, 2, 2]
}
}
)"
Definition at line 182 of file main.cpp.
◆ mean_command_long
Initial value:= R"(
{
"command": "mean_ints",
"payload": {
"addends": [1, 2, 3, 4, 5, 100, 999999999, -1, 0, -999]
}
}
)"
Definition at line 191 of file main.cpp.
◆ query_payload_command
auto query_payload_command |
Initial value:= R"(
{
"command": "query_payload",
"payload": {
"hello": "world",
"t": true ,
"f": false,
"n": null,
"i": 123,
"pi": 3.1416,
"a": [1, 2, 3, 4]
}
}
)"
Definition at line 200 of file main.cpp.
◆ sum_command
Initial value:= R"(
{
"command": "sum_ints",
"payload": {
"addends": [1, 2, 3]
}
}
)"
Definition at line 127 of file main.cpp.
◆ sum_command_fail_1
Initial value:= R"(
{
"command": "sum_ints",
"payload": {
"addends": ["apples", "oranges", "turtles"]
}
}
)"
Definition at line 154 of file main.cpp.
◆ sum_command_fail_2
Initial value:= R"(
{
"command": "sum_ints",
"payload": {
"well":"formed",
"json":"test"
}
}
)"
Definition at line 163 of file main.cpp.
◆ sum_command_floats
Initial value:= R"(
{
"command": "sum_ints",
"payload": {
"addends": [1, 2, 3, 4.5, 5.0, 100.1, 999999999.1, -1.1, 0, -999.1]
}
}
)"
Definition at line 145 of file main.cpp.
◆ sum_command_long
Initial value:= R"(
{
"command": "sum_ints",
"payload": {
"addends": [1, 2, 3, 4, 5, 100, 999999999, -1, 0, -999]
}
}
)"
Definition at line 136 of file main.cpp.
◆ TEST_ALL
test all functionality before prompting user
Definition at line 39 of file main.cpp.
◆ VERBOSE
turn on verbose messages
Definition at line 40 of file main.cpp.