本文整理汇总了C++中ObjectList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectList::insert方法的具体用法?C++ ObjectList::insert怎么用?C++ ObjectList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectList
的用法示例。
在下文中一共展示了ObjectList::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ObjectList<Symbol> OpenMP_PreTransform::get_all_functions(const function_sym_list_t& sym_list)
{
ObjectList<Symbol> result;
for (function_sym_list_t::const_iterator it = sym_list.begin();
it != sym_list.end();
it++)
{
result.insert(it->first);
}
return result;
}
示例2: getAllInstanceEquivalent
SFUtils::ObjectSet SFUtils::getAllInstanceEquivalent( Udm::Object object ) {
Udm::Object archetype = getTopArchetype( object );
if ( archetype == Udm::null ) return ObjectSet();
ObjectList objectList;
objectList.push_back( archetype );
for( ObjectList::iterator oblItr = objectList.begin() ; oblItr != objectList.end() ; (void)++oblItr ) {
ObjectSet objectSet = oblItr->instances();
objectList.insert( objectList.end(), objectSet.begin(), objectSet.end() );
}
return ObjectSet( objectList.begin(), objectList.end() );
}
示例3: loadChild
void ObjectBrowserWidget::loadChild(ObjectBrowserItem* parent,
const CCopasiContainer* copaParent,
bool nField)
{
unsigned int i;
ObjectBrowserItem* last = NULL;
CCopasiObject* current = NULL;
ObjectList* childStack = new ObjectList();
const CCopasiContainer::objectMap * pObjectList = & copaParent->getObjects();
CCopasiContainer::objectMap::const_iterator it = pObjectList->begin();
CCopasiContainer::objectMap::const_iterator end = pObjectList->end();
if ((copaParent->isVector()) && (nField))
{
if ((static_cast< const CCopasiVector < CCopasiObject > * >(copaParent)->size() >= 1) &&
((*static_cast< const CCopasiVector < CCopasiObject > * >(copaParent))[0]->isContainer()))
{//add attribute list
ObjectBrowserItem* fieldChild = new ObjectBrowserItem(parent, NULL, NULL, objectItemList);
fieldChild->setObjectType(FIELDATTR);
fieldChild->setText(0, "Select by attribute");
fieldChild->setSelectable(false);
loadField(fieldChild, const_cast<CCopasiVector < CCopasiObject > *>(static_cast< const CCopasiVector < CCopasiObject > * >(copaParent)));
fieldChild->attachKey();
last = fieldChild;
}
}
if (copaParent->isVector())
{
for (i = 0; i < static_cast< const CCopasiVector < CCopasiObject > * >(copaParent)->size(); i++)
{
current = (*static_cast< const CCopasiVector < CCopasiObject > * >(copaParent))[i];
ObjectBrowserItem* currentItem = new ObjectBrowserItem(parent, last, current, objectItemList);
last = currentItem;
currentItem->setText(0, FROM_UTF8(current->getObjectName()));
if (current->isContainer())
{
currentItem->setObjectType(CONTAINERATTR);
currentItem->attachKey();
if (current->isVector())
currentItem->setText(0, currentItem->text(0) + "[]");
loadChild(currentItem, static_cast< CCopasiContainer * >(current), nField);
}
else
{
currentItem->setObjectType(OBJECTATTR);
childStack->insert(currentItem); //attach the key later
}
}
}
else
{
while (it != end)
{
current = it->second;
// Skip all strings
if (dynamic_cast<CCopasiStaticString *>(current))
{
it++;
continue;
}
ObjectBrowserItem* currentItem = new ObjectBrowserItem(parent, last, current, objectItemList);
last = currentItem;
currentItem->setText(0, FROM_UTF8(current->getObjectName()));
if (current->isContainer())
{
currentItem->setObjectType(CONTAINERATTR);
currentItem->attachKey();
if (current->isVector())
currentItem->setText(0, currentItem->text(0) + "[]");
loadChild(currentItem, static_cast< CCopasiContainer * >(current), nField);
}
else
{
currentItem->setObjectType(OBJECTATTR);
childStack->insert(currentItem); //attach the key later
}
it++;
}
}
ObjectBrowserItem* pCurrent;
while (childStack->len() > 0)
{
pCurrent = childStack->pop();
pCurrent->attachKey();
}
//.........这里部分代码省略.........
示例4: convert_vla
static void convert_vla(Symbol sym, ObjectList<Symbol>& converted_vlas, ScopeLink sl)
{
if (converted_vlas.contains(sym))
return;
ObjectList<Source> dim_decls;
ObjectList<Source> dim_names;
dimensional_replacements_of_variable_type_aux(sym.get_type(),
sym, dim_names, dim_decls);
Source new_decls;
for (ObjectList<Source>::iterator it = dim_decls.begin();
it != dim_decls.end();
it++)
{
new_decls << *it << ";"
;
}
AST_t point_of_decl = sym.get_point_of_declaration();
AST_t enclosing_stmt_tree;
if (sym.is_parameter())
{
FunctionDefinition
funct_def(point_of_decl.get_enclosing_function_definition(), sl);
enclosing_stmt_tree = funct_def.get_function_body().get_inner_statements()[0].get_ast();
}
else
{
enclosing_stmt_tree = point_of_decl.get_enclosing_statement();
}
AST_t statement_seq
= new_decls.parse_statement(enclosing_stmt_tree, sl);
enclosing_stmt_tree.prepend(statement_seq);
if (!sym.is_parameter())
{
// If this is not a parameter, we'll want to rewrite the declaration itself
Type new_type_spawn = compute_replacement_type_for_vla(sym.get_type(), dim_names.begin(), dim_names.end());
// Now redeclare
Source redeclaration, initializer;
redeclaration
<< new_type_spawn.get_declaration(sym.get_scope(), sym.get_name())
<< initializer
<< ";"
;
if (sym.has_initialization())
{
initializer << sym.get_initialization().prettyprint()
;
}
AST_t redeclaration_tree = redeclaration.parse_statement(enclosing_stmt_tree,
sl, Source::ALLOW_REDECLARATION);
enclosing_stmt_tree.prepend(redeclaration_tree);
// Now remove the declarator of the declaration
Declaration decl(point_of_decl, sl);
if (decl.get_declared_entities().size() == 1)
{
// We have to remove all the whole declaration
enclosing_stmt_tree.remove_in_list();
}
else
{
// Remove only this entity
ObjectList<DeclaredEntity> entities = decl.get_declared_entities();
for (ObjectList<DeclaredEntity>::iterator it = entities.begin();
it != entities.end();
it++)
{
if (it->get_declared_symbol() == sym)
{
it->get_ast().remove_in_list();
}
}
}
}
ObjectList<Source>* new_dim_ptr = new ObjectList<Source>(dim_names);
RefPtr<ObjectList<Source> > dim_names_ref(new_dim_ptr);
sym.set_attribute(OMP_NANOX_VLA_DIMS, dim_names_ref);
converted_vlas.insert(sym);
}