23 #include "Validator/ObjectRequirement.h"
24 #include "Drivers/DriverException.h"
25 #include "PairwiseKernel.h"
32 auto type = json.get(
"type",
"none").asString();
33 if(type ==
"gaussian")
35 else if(type ==
"rationalswitch")
38 throw std::invalid_argument(
"Invalid pairwise kernel type \"" + type +
"\".");
51 Json::CharReaderBuilder rbuilder;
52 Json::CharReader* reader = rbuilder.newCharReader();
54 reader->parse(JsonSchema::GaussianPK.c_str(),
55 JsonSchema::GaussianPK.c_str() + JsonSchema::GaussianPK.size(),
57 validator.
Parse(schema, path);
65 json[
"mu"].asDouble(),
66 json[
"sigma"].asDouble()
81 Json::CharReaderBuilder rbuilder;
82 Json::CharReader* reader = rbuilder.newCharReader();
84 reader->parse(JsonSchema::RationalSwitchPK.c_str(),
85 JsonSchema::RationalSwitchPK.c_str() + JsonSchema::RationalSwitchPK.size(),
87 validator.
Parse(schema, path);
94 json[
"d0"].asDouble(),
95 json[
"r0"].asDouble(),
Requirements on an object.
virtual void Parse(Value json, const std::string &path) override
Parse JSON value to generate Requirement(s).
virtual void Validate(const Value &json, const std::string &path) override
Validate JSON value.
std::vector< std::string > GetErrors()
Get list of error messages.
bool HasErrors()
Check if errors have occured.
Exception to be thrown when building the Driver fails.
static GaussianPK * Build(const Json::Value &json, const std::string &path)
Build GaussianPK from JSON value.
GaussianPK(double mu, double sigma)
Constructor.
Pairwise kernel base class.
static PairwiseKernel * Build(const Json::Value &json, const std::string &path)
Build PairwiseKernel from JSON value.
Rational Switching Function.
RationalSwitchPK(double d0, double r0, int n, int m)
Constructor.
static RationalSwitchPK * Build(const Json::Value &json, const std::string &path)
Build RationalSwitchPK from JSON value.