本文整理汇总了C++中TypeSpec::is_closure_based方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeSpec::is_closure_based方法的具体用法?C++ TypeSpec::is_closure_based怎么用?C++ TypeSpec::is_closure_based使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSpec
的用法示例。
在下文中一共展示了TypeSpec::is_closure_based方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: name
void
OSOReaderToMaster::symbol (SymType symtype, TypeSpec typespec, const char *name_)
{
ustring name(name_);
Symbol sym (name, typespec, symtype);
TypeDesc t = typespec.simpletype();
int nvals = t.aggregate * (t.is_unsized_array() ? 1 : t.numelements());
if (sym.symtype() == SymTypeParam || sym.symtype() == SymTypeOutputParam) {
// Skip structs for now, they're just placeholders
if (typespec.is_structure()) {
}
else if (typespec.simpletype().basetype == TypeDesc::FLOAT) {
sym.dataoffset ((int) m_master->m_fdefaults.size());
expand (m_master->m_fdefaults, nvals);
} else if (typespec.simpletype().basetype == TypeDesc::INT) {
sym.dataoffset ((int) m_master->m_idefaults.size());
expand (m_master->m_idefaults, nvals);
} else if (typespec.simpletype().basetype == TypeDesc::STRING) {
sym.dataoffset ((int) m_master->m_sdefaults.size());
expand (m_master->m_sdefaults, nvals);
} else if (typespec.is_closure_based()) {
// Closures are pointers, so we allocate a string default taking
// adventage of their default being NULL as well.
sym.dataoffset ((int) m_master->m_sdefaults.size());
expand (m_master->m_sdefaults, nvals);
} else {
ASSERT (0 && "unexpected type");
}
}
if (sym.symtype() == SymTypeConst) {
if (typespec.simpletype().basetype == TypeDesc::FLOAT) {
sym.dataoffset ((int) m_master->m_fconsts.size());
expand (m_master->m_fconsts, nvals);
} else if (typespec.simpletype().basetype == TypeDesc::INT) {
sym.dataoffset ((int) m_master->m_iconsts.size());
expand (m_master->m_iconsts, nvals);
} else if (typespec.simpletype().basetype == TypeDesc::STRING) {
sym.dataoffset ((int) m_master->m_sconsts.size());
expand (m_master->m_sconsts, nvals);
} else {
ASSERT (0 && "unexpected type");
}
}
#if 0
// FIXME -- global_heap_offset is quite broken. But also not necessary.
// We made need to fix this later.
if (sym.symtype() == SymTypeGlobal) {
sym.dataoffset (m_shadingsys.global_heap_offset (sym.name()));
}
#endif
sym.lockgeom (m_shadingsys.lockgeom_default());
m_master->m_symbols.push_back (sym);
m_symmap[name] = int(m_master->m_symbols.size()) - 1;
// Start the index at which we add specified defaults
m_sym_default_index = 0;
}