Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3995529
latex.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 7, 1:25 PM
Size
2 KB
Mime Type
text/x-c++
Expires
Thu, Jul 9, 1:25 PM (23 h, 40 s)
Engine
blob
Format
Raw Data
Handle
271317
Attached To
rXR Xreate
latex.cpp
View Options
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 25, 2018, 12:14 PM
*
* \file latex.cpp
* \brief latex
*/
#include "query/latex.h"
using namespace std;
namespace xreate{
namespace latex{
void
LatexQuery::init(TranscendLayer* transcend) {
__transcend = transcend;
//schema: latex_fn_demand(Fn, Subject)
StaticModel data = __transcend->query("latex_fn_demand");
for(const auto& entry : data) {
string fnName, subject;
tie(fnName, subject) = __transcend->parse<string, string>(entry.second);
__demand[fnName].push_back(subject);
}
//schema: Scope, Subject, Decision
data = __transcend->query("latex_decision");
for(const auto& entry : data) {
ScopePacked scope;
string subject;
Gringo::Symbol decision;
tie(scope, subject, decision) = __transcend->parse<ScopePacked, string, Gringo::Symbol>(entry.second);
__decisions[make_pair(scope, subject)] = decision;
}
//schema: Subject, Decision
data = __transcend->query("latex_registered_subjects");
for(const auto& entry : data) {
string subject;
Gringo::Symbol decision;
tie(subject, decision) = __transcend->parse<string, Gringo::Symbol>(entry.second);
__domains[subject].push_back(decision);
}
}
Demand
LatexQuery::getFnDemand(const std::string& fnName) {
if (!__demand.count(fnName)) return Demand();
return __demand.at(fnName);
}
Gringo::Symbol
LatexQuery::getDecision(const std::string& subject, const CodeScope* scopeCaller) {
ScopePacked scopeP = __transcend->pack(scopeCaller);
if(__decisions.count(make_pair(scopeP, subject))){
//found static decision
return __decisions.at(make_pair(scopeP, subject));
}
//... <- вытащить late decision
}
std::list<Gringo::Symbol>
LatexQuery::getSubjectDomain(const std::string& subject) {
assert(__domains.count(subject));
return __domains.at(subject);
}
}
}
Event Timeline
Log In to Comment