Example #1
0
void CmyWord::CreateTable(int nRow, int nCell )
{
	  COleVariant vTrue((short)TRUE),      
	              vFalse((short)FALSE),  
	              vOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);  

	Range range = m_wdSel.GetRange();
	Tables tables = m_wdDoc.GetTables();
	m_table = tables.Add(range,nRow,nCell,vOptional,vOptional);
	Borders borders = m_table.GetBorders();
	borders.SetEnable(TRUE);
	Rows rows  =  m_table.GetRows();   
}
Example #2
0
void TalkManager::removeTable(Common::ChangeID &changeID) {
	Change *change = dynamic_cast<Change *>(changeID.getContent());
	if (!change)
		return;

	Tables *tables = &_tablesMain;
	if (change->_isAlt)
		tables = &_tablesAlt;

	for (Tables::iterator t = tables->begin(); t != tables->end(); ++t) {
		if (t->id == change->_id) {
			deleteTable(*t);

			tables->erase(t);
			break;
		}
	}

	changeID.clear();
}
Example #3
0
Tables Context::getExternalTables() const
{
	auto lock = getLock();

	Tables res = external_tables;
	if (session_context && session_context != this)
	{
		Tables buf = session_context->getExternalTables();
		res.insert(buf.begin(), buf.end());
	}
	else if (global_context && global_context != this)
	{
		Tables buf = global_context->getExternalTables();
		res.insert(buf.begin(), buf.end());
	}
	return res;
}
Example #4
0
void TalkManager::addTable(const Common::UString &nameMale, const Common::UString &nameFemale,
                           bool isAlt, uint32 priority, Common::ChangeID *changeID) {

	TalkTable *tableMale = 0, *tableFemale = 0;
	loadTables(nameMale, nameFemale, tableMale, tableFemale, LangMan.getCurrentEncoding());

	if (!tableMale && !tableFemale)
		throw Common::Exception("No such talk table \"%s\"/\"%s\"", nameMale.c_str(), nameFemale.c_str());

	Tables *tables = &_tablesMain;
	if (isAlt)
		tables = &_tablesAlt;

	const uint32 id = Common::generateIDNumber();

	tables->push_back(Table(tableMale, tableFemale, priority, id));
	tables->sort();

	if (changeID)
		changeID->setContent(new Change(id, isAlt));
}
Example #5
0
	bool isValid() const override
	{
		return it != tables.end();
	}
Example #6
0
	DatabaseOrdinaryIterator(Tables & tables_)
		: tables(tables_), it(tables.begin()) {}
Example #7
0
void runTest(RunParameters& pRunData)
{
	Timer tTimer;
    cout << "Reading in tables...";
    cout.flush();
	
    tTimer.start();
	Tables* tTables;
    try
    {
        tTables = new Tables(pRunData.iTablesFile.getCString());
    }
    catch (MyException& eException)
    {
        char tString[100];
        sprintf(tString, "When opening table file:(%s)", pRunData.iTablesFile.getCString());
        eException.addError(tString);
        throw eException;
    }
    tTimer.stop();
    cout << "\n" << tTimer << "\n";
    cout << "\nReading in hkl data...";
    cout.flush();
	tTimer.start();
    HKLData* tHKL;
	
    Matrix<float> tMetricTensor;
    pRunData.unitCell().metricTensor(tMetricTensor);
    try
    {
			tHKL = new HKLData(pRunData.iFileName.getCString(), tMetricTensor);
    }
    catch (MyException& eException)
    {
        char tError[255];
        sprintf(tError, "When opening hkl file:%s", pRunData.iFileName.getCString());
        eException.addError(tError);
        throw eException;
    }
	tTimer.stop();
    cout << "\n" << tTimer << "\n";
	LaueGroup *tResult;
	cout << "\nMerging...\n"; 
	cout.flush(); 
	tTimer.start();
	LaueGroupGraph* tGraph = new LaueGroupGraph();
	MergedReflections& tMergedRefl = tGraph->merge(*tHKL);
	tTimer.stop();    
	cout << tTimer << "\n\n";
	tResult = tMergedRefl.laueGroup();
	HKLData *tHKLData; //The resulting merged reflections.
	cout << "From merging the most likly laue symetry is " << (*tResult) << "\n";
	
	LaueGroup* tNewResult;
	if (pRunData.crystalSystem() == kUnknownID) //If the Laue symmetry hasn't already been specified 
	{
		tNewResult = getLaueGroup(tResult, cout);
	}
	else
	{
		tNewResult = pRunData.laueGroup();
	}
	if (tNewResult != tResult) //If what the merge found and the users choise was don't machine
	{
		pRunData.setLaueGroup(tNewResult); //Save the choice
		if (pRunData.iMerge) //If your using the merged data then
		{
			cout << "Remerging reflections in " << (*tNewResult) << "...\n"; 
			MergedData tNewMergedData(*tHKL, *tNewResult); 
			tHKLData = new HKLData();
			tNewMergedData.mergeReflections(*tHKLData);
		}
	}
	else
	{
		pRunData.setLaueGroup(tResult);
		tHKLData = new HKLData((HKLData&)tMergedRefl);
	}
	
	delete tGraph;
	if (pRunData.iMerge)
	{
		delete tHKL;
		tHKL = tHKLData;
	}

    cout << "Calculating probabilities...\n";
    cout.flush();
    tTimer.start();
    Table* tTable = tTables->findTable(crystalSystemConst(pRunData.crystalSystem()));
    Stats* tStats = new Stats(tTables->getRegions(), tTables->getConditions());
	tStats->addReflections(*tHKL, *pRunData.laueGroup());
    tStats->calProbs();
    tTimer.stop();
    if (pRunData.iVerbose)
		tStats->output(cout, *tTable) << "\n";
    cout << tTimer << "\n";
    cout.flush();
    cout << "\nRanking space groups...";
    cout.flush();
    tTimer.start();
    RankedSpaceGroups* tRankings = new RankedSpaceGroups(*tTable, *tStats, pRunData.iChiral, *pRunData.laueGroup());
    tTimer.stop();
    cout <<"\n" << tTimer << "\n\n";
	cout << "Table for " << crystalSystemConst(pRunData.laueGroup()->crystalSystem()) << "\n";
    cout << "\n" << *tRankings << "\n";
    if (smallValue(maximum(tHKL->unitCellTensor(), -1000000.0f, tHKL->unitCellTensor().sizeX()*tHKL->unitCellTensor().sizeY())) > 0) //if we where given a unit cell output the new values.
    {
       	UnitCell tUnitCell(tHKL->unitCellTensor());
       	cout << "Unit cell:\n" << tUnitCell << "\n\n";
    }
    cout << "Transformation matrix is: \n" << tHKL->transformation() << "\n"; //Output the transformation matrix which was used.
	
	/* Used for output stats to be read into octave for analysis*/
    /*outputToFile(pRunData, tStats, tRankings, *tTable);
	outputScores(*tRankings, *tStats, *tTable);*/
    delete tRankings;
    delete tStats;
    delete tHKL;
    delete tTables;
}