本文整理汇总了C++中Algebra::GetNumOps方法的典型用法代码示例。如果您正苦于以下问题:C++ Algebra::GetNumOps方法的具体用法?C++ Algebra::GetNumOps怎么用?C++ Algebra::GetNumOps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Algebra
的用法示例。
在下文中一共展示了Algebra::GetNumOps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findTMExceptions
void AlgebraManager::findTMExceptions(const string& algName,
const ListExpr argList,
queue<pair<string,string> >& q,
const bool print) {
if(algName.size()==0){
for(unsigned int a=1 ; a<algebra.size() ; a++){ // algId=0 is prohibited
Algebra* alg = algebra[a];
if(alg!=0){
if(print){
cout << "process algebra" << GetAlgebraName(a) << endl;
}
for(int o=0;o<alg->GetNumOps(); o++){
Operator* op = alg->GetOperator(o);
if(print){
cout << "process operator " << op->GetName() << endl;
}
try{
op->CallTypeMapping(argList);
} catch(...){
pair<string,string> p(GetAlgebraName(a), op->GetName());
q.push(p);
}
}
}
}
} else {
int a = GetAlgebraId(algName);
if(a<1){
if(print){
cout << "Algebra " << algName << " not found" << endl;
}
return;
}
if(print){
cout << "process algebra" << GetAlgebraName(a) << endl;
}
Algebra* alg = algebra[a];
for(int o=0;o<alg->GetNumOps(); o++){
Operator* op = alg->GetOperator(o);
if(print){
cout << "process operator " << op->GetName() << endl;
}
try{
op->CallTypeMapping(argList);
} catch(...){
pair<string,string> p(GetAlgebraName(a), op->GetName());
q.push(p);
}
}
}
}
示例2: matchingOperators
void AlgebraManager::matchingOperators(const int algId,
const ListExpr arguments,
vector< pair< pair<int,int>, ListExpr> >& result){
assert( (algId>0) && (algId<(int)algebra.size()) ); // 0 is an invalid algId!
ListExpr typeError = nl->SymbolAtom(Symbol::TYPEERROR());
Algebra* alg = algebra[algId];
if(alg!=0){
for(int o=0 ; o<alg->GetNumOps() ; o++){
Operator* op = alg->GetOperator(o);
try{
ListExpr res = op->CallTypeMapping(arguments);
// cout << "Check finished" << endl << endl;
if(!nl->Equal(res,typeError)){
pair<int, int> p1(algId,o);
pair<pair<int, int>, ListExpr> p(p1, res);
result.push_back(p);
}
} catch (...){
cerr << "Problem in Typemapping of operator " << op->GetName()
<< " in Algebra" << GetAlgebraName(algId) << endl;
cerr << "Throws an exception when called with "
<< nl->ToString(arguments) << endl;
}
}
}
}
示例3: findOperator
bool AlgebraManager::findOperator(const string& name,
const ListExpr argList,
ListExpr& resultList,
int& algId,
int& opId,
int& funId){
ListExpr typeError = nl->SymbolAtom(Symbol::TYPEERROR());
NestedList* nl_orig = NList::getNLRef();
NList::setNLRef(nl);
int mode = 0; // normal mode, search for matching arglist
string algName ="";
if(nl->HasLength(argList,2)){
if(nl->IsEqual(nl->First(argList),"algebra")
&& nl->AtomType(nl->Second(argList)==SymbolType)){
mode = 1; // search within a specific algebra
algName = nl->SymbolValue(nl->Second(argList));
stringutils::toLower(algName);
if(algName=="all"){
mode = 2; // search all algebras, return first hit
}
}
}
for(unsigned int a=0;a<algebra.size();a++){
Algebra* alg = algebra[a];
if(alg!=0){
string an = algebraNames[a];
stringutils::toLower(an);
if(mode==0 || mode==2 || an==algName){
for(int o=0; o< alg->GetNumOps(); o++){
Operator* op = alg->GetOperator(o);
if(op->GetName() == name){
if(mode==0){
try{
ListExpr res = op->CallTypeMapping(argList);
if(!nl->Equal(res,typeError)){ // appropriate operator found
algId = a;
opId = o;
funId = op->Select(argList);
resultList = res;
NList::setNLRef(nl_orig);
return true;
}
} catch (...){
cerr << "Problem in Typemapping of operator " << op->GetName()
<< " in Algebra" << GetAlgebraName(a) << endl;
cerr << "Throws an exception when called with "
<< nl->ToString(argList) << endl;
}
} else { // mode <>0
algId = a;
opId = o;
funId = 0;
resultList = nl->TheEmptyList();
NList::setNLRef(nl_orig);
return true;
}
}
}
} // fitting algebra name
}
}
algId = 0;
opId = 0;
resultList = nl->TheEmptyList();
NList::setNLRef(nl_orig);
return false;
}