libwolfram20
WAResult.h
Go to the documentation of this file.
1
10#ifndef WARESULT_H
11#define WARESULT_H
12
13#include <sstream>
14#include <string>
15#include <vector>
16
17#include <rapidxml/rapidxml_utils.hpp>
18
19#include "WAQuery.h"
20#include "WAPod.h"
21#include "WAError.h"
22
23
27typedef struct {
28 float parse;
29 float generate;
30} Timings;
31
36class WAResult {
37public:
38 WAResult(const WAResult &old);
39 WAResult(rapidxml::xml_node<>* query);
40 ~WAResult();
41
42 std::vector<WAPod> getPods();
43 bool getPod(const char *title, WAPod *pod);
44
45 unsigned int getTimedoutNumber();
46 std::vector<std::string> getTimedout();
47
48 bool isError();
50
51private:
52 bool _is_error;
54
55 std::string _dataTypes;
56 std::string _version;
58
59 std::vector<std::string> _timedout;
60 std::string _try_again;
61
62 std::vector<WAPod> _pods;
63
64 void parse(rapidxml::xml_node<>* query);
65 static std::vector<std::string> splitTimedout(const std::string& s);
66};
67
68#endif // WARESULT_H
Wolfram API error element.
Wolfram API element.
API query petition manager.
Wolfram API error element.
Definition: WAError.h:20
Wolfram API element.
Definition: WAPod.h:26
static std::vector< std::string > splitTimedout(const std::string &s)
It stores the pods that are timedout into a vector.
Definition: WAResult.cpp:89
void parse(rapidxml::xml_node<> *query)
Parsing the input query.
Definition: WAResult.cpp:51
std::vector< std::string > getTimedout()
It returns the elements that were timedout.
Definition: WAResult.cpp:129
WAError * getError()
It provides information about what happened.
Definition: WAResult.cpp:113
bool getPod(const char *title, WAPod *pod)
Returns a Pod matching the title.
Definition: WAResult.cpp:152
std::vector< WAPod > getPods()
Returns the getted array of Pods of the previous query.
Definition: WAResult.cpp:139
bool isError()
It checks if the results contains valid data.
Definition: WAResult.cpp:103
unsigned int getTimedoutNumber()
It returns the number of elements that were timedout.
Definition: WAResult.cpp:121
~WAResult()
Destructor.
Definition: WAResult.cpp:41
WAResult(const WAResult &old)
Copy constructor.
Definition: WAResult.cpp:17
Wolfram API result.
Definition: WAResult.h:36
std::vector< WAPod > _pods
All the results of the query.
Definition: WAResult.h:62
std::string _dataTypes
Categories and types of data represented in the results.
Definition: WAResult.h:55
std::string _version
The version specification of the API on the server that produced this result.
Definition: WAResult.h:56
bool _is_error
The input could be successfully understood or a serious processing error occurred.
Definition: WAResult.h:52
std::vector< std::string > _timedout
Number of pods that are missing because they timed out.
Definition: WAResult.h:59
std::string _try_again
If _timedout > 0 this will contain an URL to perform the next search.
Definition: WAResult.h:60
Timings _timings
Time in seconds required to parse the input and generate the output.
Definition: WAResult.h:57
WAError * _error
Information about the given error.
Definition: WAResult.h:53
Query timings.
Definition: WAResult.h:27
float generate
Time in seconds required to generate the output.
Definition: WAResult.h:29
float parse
Time in seconds required to parse the input.
Definition: WAResult.h:28