当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectList::empty方法代码示例

本文整理汇总了C++中ObjectList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectList::empty方法的具体用法?C++ ObjectList::empty怎么用?C++ ObjectList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectList的用法示例。


在下文中一共展示了ObjectList::empty方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UngroupObjects

void ESceneGroupTool::UngroupObjects(bool bUndo)
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty())
    {
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
        {
            if ((*it)->Selected())
            {
            	sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); 
                VERIFY(obj);
                if (obj->CanUngroup(true))
                {
                    obj->UngroupObjects	();
                    Scene->RemoveObject	(obj,false,true);
                    xr_delete			(obj);
                    bModif				= true;
                }else
                    ELog.DlgMsg			(mtError,"Can't ungroup object: '%s'.",obj->Name);
            }
        }
        if (bUndo&&bModif) 
            Scene->UndoSave();
    }
    if (0==sel_cnt)
        ELog.Msg		(mtError,"Nothing selected.");
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:30,代码来源:ESceneGroupTools.cpp

示例2: readObject

        virtual ReadResult readObject(std::istream& fin, const Options* options) const
        {
            loadWrappers();

            fin.imbue(std::locale::classic());

            Input fr;
            fr.attach(&fin);
            fr.setOptions(options);

            typedef std::vector<osg::Object*> ObjectList;
            ObjectList objectList;

            // load all nodes in file, placing them in a group.
            while(!fr.eof())
            {
                Object *object = fr.readObject();
                if (object) objectList.push_back(object);
                else fr.advanceOverCurrentFieldOrBlock();
            }

            if  (objectList.empty())
            {
                return ReadResult("No data loaded");
            }
            else if (objectList.size()==1)
            {
                return objectList.front();
            }
            else
            {
                return objectList.front();
            }
        }
开发者ID:AlexBobkov,项目名称:OpenSceneGraph,代码行数:34,代码来源:ReaderWriterOSG.cpp

示例3: UpdateSnapList

void __fastcall TfraLeftBar::UpdateSnapList()
{
	lbSnapList->Items->Clear();
    ObjectList* lst = Scene->GetSnapList(true);
    if (lst&&!lst->empty()){
    	int idx=0;
        ObjectIt _F=lst->begin();
    	for (;_F!=lst->end(); _F++,idx++){
        	AnsiString s; s.sprintf("%d: %s",idx,(*_F)->Name);
        	lbSnapList->Items->Add(s);
        }
    }
    Repaint();
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:14,代码来源:LeftBar.cpp

示例4: last_part

ObjectList<TaskPart> TaskAggregation::get_task_parts(Statement stmt)
{
    ObjectList<TaskPart> result;
    ObjectList<Statement> prologue;

    get_task_parts_aux(result, prologue, stmt);

    if (!prologue.empty())
    {
        TaskPart last_part(prologue);
        result.append(last_part);
    }

    return result;
}
开发者ID:bsc-pm,项目名称:mcxx,代码行数:15,代码来源:hlt-task-aggregation.cpp

示例5: CloseGroups

void ESceneGroupTools::CloseGroups(bool bUndo)
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty()) {
        for (ObjectIt it=lst.begin(); it!=lst.end(); it++) {
            if ((*it)->Selected()) {
                sel_cnt++;
                ((CGroupObject*)(*it))->CloseGroup();
            }
        }
        if (bUndo) Scene->UndoSave();
    }
    if (0==sel_cnt)	ELog.Msg		(mtError,"Nothing selected.");
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:ESceneGroupTools.cpp

示例6: findObjectByRect

ObjectPtr Game::findObjectByRect(ObjectList &matched_objs, int left, int top, int right, int bottom, unsigned int flags)
{
	ObjectList &objs = this->getObjectList();
	
	matched_objs.clear();
	for(ObjectList::const_iterator it = objs.begin(); it != objs.end(); ++it)
	{
		const ObjectPtr &obj = *it;
		if(obj->insideRect(left, top, right, bottom))
		{
			//fprintf(stderr, "adding object %s\n", obj->getObjectName());
			matched_objs.addObject(obj);
		}
	}
	
	if(matched_objs.empty())
		return ObjectPtr();
	else
		return *matched_objs.begin();
}
开发者ID:pjm0616,项目名称:juchecraft,代码行数:20,代码来源:Game.cpp

示例7: ReloadRefsSelectedObject

void ESceneGroupTools::ReloadRefsSelectedObject()
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty()){
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
        	if ((*it)->Selected()){
			    sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); VERIFY(obj);
                if (obj->UpdateReference()){
                    bModif			= true;
                }else{
                    ELog.Msg		(mtError,"Can't reload group: '%s'.",obj->Name);    
                }
            }
        }
	    if (bModif) Scene->UndoSave();
    }
    if (0==sel_cnt)	ELog.Msg		(mtError,"Nothing selected.");
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:21,代码来源:ESceneGroupTools.cpp

示例8: ReloadRefsSelectedObject

void ESceneGroupTool::ReloadRefsSelectedObject()
{
    ObjectList lst 				= m_Objects;
    int sel_cnt					= 0;
    if (!lst.empty())
    {
        string_path				temp_file_name_sector,temp_file_name_portal;
        GetTempFileName			( FS.get_path(_temp_)->m_Path, "tmp_sector", 0, temp_file_name_sector );
        Scene->SaveToolLTX		(OBJCLASS_SECTOR, temp_file_name_sector);

        GetTempFileName			( FS.get_path(_temp_)->m_Path, "tmp_portal", 0, temp_file_name_portal );
        Scene->SaveToolLTX		(OBJCLASS_PORTAL, temp_file_name_portal);

   		bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
		{
        	if ((*it)->Selected())
            {
			    sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); 
                VERIFY				(obj);
                if (obj->UpdateReference(true))
                {
                    bModif		= true;
                }else
                {
                    ELog.Msg	(mtError,"Can't reload group: '%s'.",obj->Name);
                }
            }
        }
	    if(bModif) 
        	Scene->UndoSave		();

		Scene->LoadToolLTX		(OBJCLASS_SECTOR, temp_file_name_sector);
		Scene->LoadToolLTX		(OBJCLASS_PORTAL, temp_file_name_portal);
    }
    if (0==sel_cnt)	
    	ELog.Msg	(mtError,"Nothing selected.");
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:39,代码来源:ESceneGroupTools.cpp

示例9: OpenGroups

void ESceneGroupTools::OpenGroups(bool bUndo)
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty()){
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
        	if ((*it)->Selected()){
            	sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); VERIFY(obj);
                if (obj->CanUngroup(true)){
                    obj->OpenGroup	();
                    bModif			= true;
                }else{
                    ELog.DlgMsg		(mtError,"Can't open group: '%s'.",obj->Name);    
                }
            }
        }
	    if (bUndo&&bModif) Scene->UndoSave();
    }
    if (0==sel_cnt)	ELog.Msg		(mtError,"Nothing selected.");
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:22,代码来源:ESceneGroupTools.cpp

示例10: for_postorder

void OMPTransform::for_postorder(PragmaCustomConstruct ctr)
{
    ForStatement for_statement(ctr.get_statement().get_ast(), ctr.get_scope_link());
    Statement for_body = for_statement.get_loop_body();

    OpenMP::DataSharingEnvironment& data_sharing = openmp_info->get_data_sharing(ctr.get_ast());
    ObjectList<OpenMP::DependencyItem> dependences;
    data_sharing.get_all_dependences(dependences);	
    Source loop_info_field;
    loop_info_field
        << "nanos_loop_info_t loop_info;"
        ;

    DataEnvironInfo data_environ_info;
    compute_data_environment(
            data_sharing,
            ctr,
            data_environ_info,
            _converted_vlas);

    std::string struct_arg_type_name;
    define_arguments_structure(ctr, struct_arg_type_name, data_environ_info, 
            ObjectList<OpenMP::DependencyItem>(), loop_info_field);
            
    FunctionDefinition funct_def = ctr.get_enclosing_function();
    Symbol function_symbol = funct_def.get_function_symbol();

    int outline_num = TL::CounterManager::get_counter(NANOX_OUTLINE_COUNTER);
    TL::CounterManager::get_counter(NANOX_OUTLINE_COUNTER)++;
    std::stringstream ss;
    ss << "_ol_" << function_symbol.get_name() << "_" << outline_num;

    std::string outline_name = ss.str();

    Source loop_distr_setup;
    loop_distr_setup
        << "int _nth_lower = _args->loop_info.lower;"
        << "int _nth_upper = _args->loop_info.upper;"
        << "int _nth_step = _args->loop_info.step;"
        << "int _nth_step_sign = 1;"
        << "if (_nth_step < 0)"
        <<   "_nth_step_sign = -1;"
        ;

    Source final_barrier;

    if ( (!ctr.get_clause("nowait").is_defined() 
            && !ctr.get_clause("input").is_defined() 
            && !ctr.get_clause("output").is_defined() 
            && !ctr.get_clause("inout").is_defined() )
            || !data_environ_info.get_reduction_symbols().empty())
    {
        final_barrier << get_barrier_code(ctr.get_ast());
    }

    Source induction_var_name = for_statement.get_induction_variable().prettyprint();

    Source device_descriptor, 
           device_description, 
           device_description_line, 
           num_devices,
           ancillary_device_description;
    device_descriptor << outline_name << "_devices";
    device_description
        << ancillary_device_description
        << "nanos_device_t " << device_descriptor << "[] ="
        << "{"
        << device_description_line
        << "};"
        ;

    OutlineFlags outline_flags;

    DeviceHandler &device_handler = DeviceHandler::get_device_handler();
    ObjectList<std::string> current_targets;
    data_sharing.get_all_devices(current_targets);
    for (ObjectList<std::string>::iterator it = current_targets.begin();
            it != current_targets.end();
            it++)
    {
        DeviceProvider* device_provider = device_handler.get_device(*it);

        if (device_provider == NULL)
        {
            internal_error("invalid device '%s' at '%s'\n",
                    it->c_str(), ctr.get_ast().get_locus().c_str());
        }

        Source initial_setup, replaced_body;

        device_provider->do_replacements(data_environ_info,
                for_statement.get_loop_body().get_ast(),
                ctr.get_scope_link(),
                initial_setup,
                replaced_body);
                
        Source outline_body;
        outline_body
            << loop_distr_setup
            << "for ("
//.........这里部分代码省略.........
开发者ID:sdruix,项目名称:AutomaticParallelization,代码行数:101,代码来源:tl-for.cpp

示例11: solve

    Symbol Overload::solve(
            ObjectList<Symbol> candidate_functions,
            Type implicit_argument_type,
            ObjectList<Type> argument_types, 
            const std::string filename,
            int line,
            bool &valid, 
            ObjectList<Symbol>& viable_functions,
            ObjectList<Symbol>& argument_conversor)
    {
        valid = false;

        // Try hard to not to do useless work
        if (candidate_functions.empty())
        {
            return Symbol(NULL);
        }

        scope_entry_list_t* first_candidate_list = NULL;
        
        // Build the candidates list
        for (ObjectList<Symbol>::iterator it = candidate_functions.begin();
                it != candidate_functions.end();
                it++)
        {
            Symbol sym(*it);
            first_candidate_list = entry_list_add(first_candidate_list, sym.get_internal_symbol());
        }

        // Build the type array
        unsigned int i = argument_types.size();
        type_t** argument_types_array = new type_t*[argument_types.size() + 1];
        argument_types_array[0] = implicit_argument_type.get_internal_type();
        for (i = 0; i < argument_types.size(); i++)
        {
            argument_types_array[i+1] = argument_types[i].get_internal_type();
        }

        // Now we need a decl_context_t but we were not given any explicitly,
        // use the one of the first candidate
        decl_context_t decl_context = candidate_functions[0].get_scope().get_decl_context();

        // Unfold and mix!
        scope_entry_list_t* candidate_list = NULL;
        candidate_list = unfold_and_mix_candidate_functions(first_candidate_list,
                NULL /* builtins */,
                &argument_types_array[1], argument_types.size(),
                decl_context,
                uniquestr(filename.c_str()), line,
                NULL /* explicit template arguments */);

        {
            ObjectList<Symbol> list;
            Scope::convert_to_vector(candidate_list, list);
            viable_functions.append(list);
        }

        candidate_t* candidate_set = NULL;

        scope_entry_list_iterator_t* it = NULL;
        for (it = entry_list_iterator_begin(candidate_list);
                !entry_list_iterator_end(it);
                entry_list_iterator_next(it))
        {
            scope_entry_t* entry = entry_list_iterator_current(it);
            if (entry->entity_specs.is_member)
            {
                candidate_set = add_to_candidate_set(candidate_set,
                        entry,
                        argument_types.size() + 1,
                        argument_types_array);
            }
            else
            {
                candidate_set = add_to_candidate_set(candidate_set,
                        entry,
                        argument_types.size(),
                        argument_types_array + 1);
            }
        }
        entry_list_iterator_free(it);

        // We also need a scope_entry_t** for holding the conversor argument
        scope_entry_t** conversor_per_argument = new scope_entry_t*[argument_types.size() + 1];

        // Now invoke all the machinery
        scope_entry_t* entry_result =
        solve_overload(candidate_set,
                decl_context,
                uniquestr(filename.c_str()), line,
                conversor_per_argument);

        if (entry_result != NULL)
        {
            valid = true;
            // Store the arguments
            argument_conversor.clear();
            for (i = 0; i < argument_types.size(); i++)
            {
                argument_conversor.append(Symbol(conversor_per_argument[i]));
//.........这里部分代码省略.........
开发者ID:sdruix,项目名称:AutomaticParallelization,代码行数:101,代码来源:tl-overload.cpp

示例12: get_outline_parallel_for

        // Create outline for parallel for
        AST_t OpenMPTransform::get_outline_parallel_for(
                PragmaCustomConstruct &construct,
                FunctionDefinition function_definition,
                Source outlined_function_name,
                ForStatement for_statement,
                Statement /* loop_body */,
                ReplaceIdExpression replace_references,
                ObjectList<ParameterInfo> parameter_info_list,
                ObjectList<Symbol> private_references,
                ObjectList<Symbol> firstprivate_references,
                ObjectList<Symbol> lastprivate_references,
                ObjectList<OpenMP::ReductionSymbol> reduction_references,
                ObjectList<Symbol> copyin_references,
                ObjectList<Symbol> copyprivate_references
                )
        {
            // empty
            ObjectList<IdExpression> pass_by_value;

            Source empty;
            Source outline_parallel_for;
            Source parallel_for_body;

            // Get the source of the common parallel X outline
            outline_parallel_for = get_outline_common(
                    function_definition,
                    parallel_for_body,
                    outlined_function_name,
                    parameter_info_list,
                    construct,
                    /* team_parameter */ true);

            Source private_declarations = get_privatized_declarations(
                    construct,
                    private_references,
                    firstprivate_references,
                    lastprivate_references,
                    reduction_references,
                    copyin_references,
                    parameter_info_list
                    ); 

            Source loop_distribution = get_loop_distribution_code(
                    for_statement, 
                    construct,
                    replace_references, 
                    function_definition);

            Source lastprivate_code;

            if (!lastprivate_references.empty())
            {
                Source lastprivate_assignments = get_lastprivate_assignments(
                        firstprivate_references,
                        lastprivate_references, 
                        copyprivate_references,
                        parameter_info_list);

                lastprivate_code
                    << "if (intone_last != 0)"
                    << "{"
                    <<    lastprivate_assignments
                    << "}"
                    ;
            }

            // Barrier is already done at parallel level
            Source loop_finalization = get_loop_finalization(/* do_barrier = */ false);

            Source reduction_update = get_reduction_update(reduction_references);

            Source code_before_entering_team,
                   code_after_leaving_team;
            Source enter_team,
                   leave_team;
            code_before_entering_team
                << "nth_player_t nth_player;"
                << "nth_init_player(&nth_player);"
                ;
            enter_team
                << "nth_enter_team(nth_current_team, &nth_player, 0);"
                ;
            leave_team
                << "nth_leave_team(1);"
                ;
            code_after_leaving_team
                << "nth_end_player(&nth_player);"
                ;

            Source destructor_calls;
            invoke_destructors(parameter_info_list, destructor_calls);

            parallel_for_body 
                << private_declarations

                << comment("Entering team")
                << code_before_entering_team
                << enter_team

//.........这里部分代码省略.........
开发者ID:sdruix,项目名称:AutomaticParallelization,代码行数:101,代码来源:tl-parallel_for.cpp

示例13: get_outline_parallel_for

        // Create outline for parallel for
        AST_t OpenMPTransform::get_outline_parallel_for(
                OpenMP::Construct &construct,
                FunctionDefinition function_definition,
                Source outlined_function_name,
                ForStatement for_statement,
                Statement /* loop_body */,
                ReplaceIdExpression replace_references,
                ObjectList<ParameterInfo> parameter_info_list,
                ObjectList<Symbol> private_references,
                ObjectList<Symbol> firstprivate_references,
                ObjectList<Symbol> lastprivate_references,
                ObjectList<OpenMP::ReductionSymbol> reduction_references,
                ObjectList<Symbol> copyin_references,
                ObjectList<Symbol> copyprivate_references,
                OpenMP::Directive directive
                )
        {
            // empty
            ObjectList<IdExpression> pass_by_value;

            Source empty;
            Source outline_parallel_for;
            Source parallel_for_body;

            // Get the source of the common parallel X outline
            outline_parallel_for = get_outline_common(
                    function_definition,
                    parallel_for_body,
                    outlined_function_name,
                    parameter_info_list);

            Source private_declarations = get_privatized_declarations(
                    construct,
                    private_references,
                    firstprivate_references,
                    lastprivate_references,
                    reduction_references,
                    copyin_references,
                    parameter_info_list
                    ); 

            Source loop_distribution = get_loop_distribution_code(for_statement, 
                    replace_references, function_definition, directive);

            Source lastprivate_code;

            if (!lastprivate_references.empty())
            {
                Source lastprivate_assignments = get_lastprivate_assignments(
                        lastprivate_references, 
                        copyprivate_references,
                        parameter_info_list);

                lastprivate_code
                    << "if (intone_last != 0)"
                    << "{"
                    <<    lastprivate_assignments
                    << "}"
                    ;
            }

            // Barrier is already done at parallel level
            Source loop_finalization = get_loop_finalization(/* do_barrier = */ false);

            Source reduction_update = get_reduction_update(reduction_references);

            Source task_block_code;

            parallel_for_body 
                << private_declarations
                << loop_distribution
                << lastprivate_code
                << reduction_update
                << loop_finalization
                << task_block_code
                ;

            task_block_code = get_task_block_code();

            return finish_outline(function_definition, outline_parallel_for, parameter_info_list);
        }
开发者ID:drpicox,项目名称:acotescc,代码行数:82,代码来源:tl-parallel_for.cpp


注:本文中的ObjectList::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。