Exemplo n.º 1
0
int
main()
{
    Item *items = new_items(ITEM_LEN);

    struct timespec start, end;
    long long t_b, t_i;
    clock_gettime(CLOCK_ID, &start);
    time_search_b(items, ITEM_LEN, ITEM_LEN / 5);
    time_search_b(items, ITEM_LEN, ITEM_LEN * 2 / 5);
    time_search_b(items, ITEM_LEN, ITEM_LEN * 3 / 5);
    time_search_b(items, ITEM_LEN, ITEM_LEN * 4 / 5);
    time_search_b(items, ITEM_LEN, ITEM_LEN);
    clock_gettime(CLOCK_ID, &end);
    t_b = ((end.tv_sec - start.tv_sec) * 1000000000
           + end.tv_nsec - start.tv_nsec);

    clock_gettime(CLOCK_ID, &start);
    time_search_i(items, ITEM_LEN, ITEM_LEN / 5);
    time_search_i(items, ITEM_LEN, ITEM_LEN * 2 / 5);
    time_search_i(items, ITEM_LEN, ITEM_LEN * 3 / 5);
    time_search_i(items, ITEM_LEN, ITEM_LEN * 4 / 5);
    time_search_i(items, ITEM_LEN, ITEM_LEN);
    clock_gettime(CLOCK_ID, &end);
    t_i = ((end.tv_sec - start.tv_sec) * 1000000000
           + end.tv_nsec - start.tv_nsec);
    printf("%s, search_b:\n\t %lld\n", __func__, t_b);
    printf("%s, search_i:\n\t %lld\n", __func__, t_i);

    free(items);
    return 0;
}
Exemplo n.º 2
0
 w_saves(std::vector<QuickSave>& saves, int width, int numRows) : w_list_base(width, numRows, 0), m_saves(saves)
 {
     saved_min_height = item_height() * static_cast<uint16>(shown_items) + get_theme_space(LIST_WIDGET, T_SPACE) + get_theme_space(LIST_WIDGET, B_SPACE);
     trough_rect.h = saved_min_height - get_theme_space(LIST_WIDGET, TROUGH_T_SPACE) - get_theme_space(LIST_WIDGET, TROUGH_B_SPACE);
     num_items = m_saves.size();
     new_items();
 }
Exemplo n.º 3
0
	void refresh_entries()
	{
		if(current_directory.ReadDirectory(entries))
		{
			if (sort_order == sort_by_name)
			{
				sort(entries.begin(), entries.end());
			}
			else
			{
				sort(entries.begin(), entries.end(), most_recent());
			}
		}
		num_items = entries.size();
		new_items();
	}
void IfcHierarchyHelper::clipRepresentation(IfcSchema::IfcRepresentation* rep, 
	IfcSchema::IfcAxis2Placement3D* place, bool agree) 
{
	if (rep->RepresentationIdentifier() != "Body") return;
	IfcSchema::IfcPlane* plane = new IfcSchema::IfcPlane(place);
	IfcSchema::IfcHalfSpaceSolid* half_space = new IfcSchema::IfcHalfSpaceSolid(plane, agree);
	addEntity(plane);
	addEntity(half_space);
	rep->setRepresentationType("Clipping");		
	IfcSchema::IfcRepresentationItem::list::ptr items = rep->Items();
	IfcSchema::IfcRepresentationItem::list::ptr new_items (new IfcSchema::IfcRepresentationItem::list);
	for (IfcSchema::IfcRepresentationItem::list::it i = items->begin(); i != items->end(); ++i) {
		IfcSchema::IfcRepresentationItem* item = *i;
		IfcSchema::IfcBooleanClippingResult* clip = new IfcSchema::IfcBooleanClippingResult(
			IfcSchema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE, item, half_space);
		addEntity(clip);
		new_items->push(clip);
	}
	rep->setItems(new_items);
}
void
w_found_players::unlist_player(const prospective_joiner_info &player) {
    size_t theIndex = find_item_index_in_vector(player, listed_players);
    if(theIndex == -1)
        return;

    listed_players.erase(listed_players.begin() + theIndex);
    
    size_t old_top_item = top_item;
    
    num_items = listed_players.size();
    new_items();
    
    // If the element deleted was the top item or before the top item, shift view up an item to compensate (if there is anything "up").
    if(theIndex <= old_top_item && old_top_item > 0)
        old_top_item--;
    
    // Reconcile overhang, if needed.
    if(old_top_item + shown_items > num_items && num_items >= shown_items)
        set_top_item(num_items - shown_items);
    else
        set_top_item(old_top_item);
}
void
w_found_players::list_player(prospective_joiner_info &player) {
    listed_players.push_back(player);
    num_items = listed_players.size();
    new_items();
}
Exemplo n.º 7
0
void w_saves::remove_selected()
{
    m_saves.erase(m_saves.begin()+get_selection());
    num_items = m_saves.size();
    new_items();
}