void addValues(CuckooMap* map, uint64_t* slowMap, uint32_t* freqs, int bitsCollection)
{
	puts("Building CuckooMap");
	fflush(stdout);
	int numAdded = 0;
	clearTables(map);
	for(int a = 0; a < getSignatureMapSize(slowMap); a ++)
	{
		if(freqs[a * (bitsCollection + 1)] >= SAMPLE_CAP)
		{
			continue;
		}
		numAdded ++;
		if(slowMap[a] == NONE)
		{
			printf("Key value conflicts with NONE");
			fflush(stdout);
			exit(1);
		}
		if(!add(map, slowMap[a], a))
		{
			printf("Failed to add all values to CuckooMap. Stopped at %d of %d. Retrying...\n", a, (int) getSignatureMapSize(slowMap));
			clearTables(map);
			hash1Mult += rand();
			hash2Mult += rand();
			fflush(stdout);
			a = 0;
			numAdded = 0;
		}
		//catch immediate insertion errors
		else if(findCuckooOptimized(map, slowMap[a]) != a)
		{
			puts("Error in CuckooMap");
			exit(1);
		}
	}
	//Reloop through the whole thing to make sure it's good
	for(int a = 0; a < getSignatureMapSize(slowMap); a ++)
	{
		if(freqs[a * (bitsCollection + 1)] >= SAMPLE_CAP)
		{
			continue;
		}
		if(findCuckooOptimized(map, slowMap[a]) != a)
		{
			puts("Error in CuckooMap");
			exit(1);
		}
	}
	printf("Inserted %d of %d elements into CuckooMap.\n", numAdded, (int) getSignatureMapSize(slowMap));
	fflush(stdout);
}
void ObjectDepsRefsWidget::hideEvent(QHideEvent *event)
{
	tabWidget->setCurrentIndex(0);
  model_wgt=nullptr;
  references_tbw->setEnabled(true);
  dependences_tbw->setEnabled(true);
  exc_ind_deps_chk->setEnabled(true);
  alert_frm->setVisible(false);

  clearTables();
	BaseObjectWidget::hideEvent(event);
}
Esempio n. 3
0
bool SociContainer::disconnect(StdString const &oConnectString)
{
	UNUSED(oConnectString);

	if(mSession == NULL)
		return true;

	clearTables();
	delete mSession;
	mSession = NULL;
	mSociConnectString = "";
	return true;
}
Esempio n. 4
0
// ***************************************************************
//  CppDB constructor
//  
//  description:
//  constructs a CppDB object and sets the max number of tables 
//  that this database object can hold to incoming_max_tables.
//  
//  parameters:
//  int incoming_max_tables
// ***************************************************************
CppDB::CppDB(int incoming_max_tables) : max_tables(incoming_max_tables)
{
  CppDBLogger::log("CppDB::CppDB constructor entered");

  try
  {
    // create a new array of CppDBTableInterface pointers
    tables = new CppDBTableInterface *[max_tables];
    
    // clear the table and set all pointers to NULL
    clearTables();
  }
  catch(std::bad_alloc)
  {
    CppDBLogger::log("CppDB::CppDB ERROR: bad alloc");
  }

  CppDBLogger::log("CppDB::CppDB constructor exited");
}
void ObjectDepsRefsWidget::handleItemSelection(QTableWidgetItem *item)
{
  BaseObject *sel_obj=nullptr, *parent=nullptr;
  Table *parent_tab=nullptr;
  View *parent_view=nullptr;

  sel_obj=reinterpret_cast<BaseObject*>(item->data(Qt::UserRole).value<void *>());

  if(sel_obj)
  {
    if(TableObject::isTableObject(sel_obj->getObjectType()))
      parent=dynamic_cast<TableObject *>(sel_obj)->getParentTable();

    model_wgt->showObjectForm(sel_obj->getObjectType(), sel_obj, parent);
    clearTables();

    if(TableObject::isTableObject(this->object->getObjectType()))
    {
      parent=dynamic_cast<TableObject *>(this->object)->getParentTable();

      if(parent->getObjectType()==OBJ_TABLE)
        parent_tab=dynamic_cast<Table *>(parent);
      else
        parent_view=dynamic_cast<View *>(parent);
    }

    if((parent_tab && parent_tab->getObjectIndex(this->object) >= 0) ||
       (parent_view && parent_view->getObjectIndex(this->object) >= 0) ||
       (model->getObjectIndex(this->object) >= 0))
    {
      updateObjectTables();
    }
    else
    {
      references_tbw->setEnabled(false);
      dependences_tbw->setEnabled(false);
      exc_ind_deps_chk->setEnabled(false);
      alert_frm->setVisible(true);
    }
  }
}
void Database::resetDefaults()
{
    clearTables();
    populateDefaultData();
}
Esempio n. 7
0
SymbolTable::SymbolTable(void)
{
    clearTables();
}