本文整理汇总了C++中SymbolString::get_cstring方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolString::get_cstring方法的具体用法?C++ SymbolString::get_cstring怎么用?C++ SymbolString::get_cstring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolString
的用法示例。
在下文中一共展示了SymbolString::get_cstring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_handler
Result* get_handler(SEXP call, const ILazySubsets& subsets, const Environment& env) {
LOG_INFO << "Looking up hybrid handler for call of type " << type2name(call);
if (TYPEOF(call) == LANGSXP) {
int depth = Rf_length(call);
HybridHandlerMap& handlers = get_handlers();
SEXP fun_symbol = CAR(call);
if (TYPEOF(fun_symbol) != SYMSXP) {
LOG_VERBOSE << "Not a function: " << type2name(fun_symbol);
return 0;
}
LOG_VERBOSE << "Searching hybrid handler for function " << CHAR(PRINTNAME(fun_symbol));
HybridHandlerMap::const_iterator it = handlers.find(fun_symbol);
if (it == handlers.end()) {
LOG_VERBOSE << "Not found";
return 0;
}
LOG_INFO << "Using hybrid handler for " << CHAR(PRINTNAME(fun_symbol));
return it->second(call, subsets, depth - 1);
} else if (TYPEOF(call) == SYMSXP) {
SymbolString name = SymbolString(Symbol(call));
LOG_VERBOSE << "Searching hybrid handler for symbol " << name.get_cstring();
if (subsets.count(name)) {
LOG_VERBOSE << "Using hybrid variable handler";
return variable_handler(subsets, name);
}
else {
SEXP data = env.find(name.get_string());
// Constants of length != 1 are handled via regular evaluation
if (Rf_length(data) == 1) {
LOG_VERBOSE << "Using hybrid constant handler";
return constant_handler(data);
}
}
} else {
// TODO: perhaps deal with SYMSXP separately
if (Rf_length(call) == 1) return constant_handler(call);
}
return 0;
}