void Task::run() { verify( n == 0 ); setUp(); while( 1 ) { n++; try { doWork(); } catch(...) { } sleepmillis(repeat); if( inShutdown() ) break; if( repeat == 0 ) break; } }
PhotoDialog::PhotoDialog(RsPhoto *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)), mPhotoDetails(photo) { ui->setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); connect(ui->pushButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment())); connect(ui->pushButton_AddCommentDlg, SIGNAL(clicked()), this, SLOT(addComment())); connect(ui->fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen())); #if QT_VERSION >= 0x040700 ui->lineEdit->setPlaceholderText(tr("Write a comment...")) ; #endif setUp(); }
// This is a CPPUNIT compliant method that actually does the calling of the // test, giving various values for sample rates. void testBufferToneDetect() { int rateIdx; for (rateIdx = 0; rateIdx < sNumRates; rateIdx++) { printf("Test playBuffer %d Hz\n", sSampleRates[rateIdx]); // For this test, we want to modify the sample rate and samples per frame // so we need to de-inititialize what has already been initialized for us // by cppunit, or by a previous loop. tearDown(); // Set the sample rates setSamplesPerSec(sSampleRates[rateIdx]); setSamplesPerFrame(sSampleRates[rateIdx]/100); setUp(); testPlayToneDetectHelper(MpfftBuffer, sSampleRates[rateIdx], sSampleRates[rateIdx]/100); } }
void IOTests::testOutputLeak1() { agent->ExecuteCommandLine("soar stop-phase input") ; assertTrue_msg("soar stop-phase input", agent->GetLastCommandLineResult()); agent->ExecuteCommandLine("watch 0") ; agent->ExecuteCommandLine("waitsnc --on") ; agent->LoadProductions(SoarHelper::GetResource("testoutputleak.soar").c_str()); assertTrue_msg("loadProductions", agent->GetLastCommandLineResult()); /*sml::Identifier* pOutputLink = */agent->GetOutputLink(); kernel->RunAllAgents(1); #ifdef _WIN32 #ifdef _DEBUG _CrtMemState memState; _CrtMemCheckpoint(&memState); //_CrtSetBreakAlloc( 3020 ); #endif #endif assertTrue(agent->GetNumberCommands() == 1); sml::Identifier* pCommand = agent->GetCommand(0) ; pCommand->AddStatusComplete(); // need to pass input phase kernel->RunAllAgents(2); assertTrue(kernel->DestroyAgent(agent)); kernel->Shutdown() ; delete kernel ; kernel = nullptr; #ifdef _WIN32 #ifdef _DEBUG _CrtMemDumpAllObjectsSince(&memState); #endif #endif setUp(); }
void PerspectiveCamera::load(const QString &filename) { FILE *fp=fopen(filename.toStdString().c_str(),"rb"); float sfov=0; float sfarPlane=0; float snearPlane=0; GGL::Point3f sfrom; GGL::Point3f sto; GGL::Point3f sup; fread(&sfov,sizeof(float),1,fp); qDebug("fov:%f",sfov); fread(&sfarPlane,sizeof(float),1,fp); qDebug("far plane:%f",sfarPlane); fread(&snearPlane,sizeof(float),1,fp); qDebug("near plane:%f",snearPlane); float vsfrom[3]; fread(vsfrom,sizeof(float),3,fp); qDebug("from:%f,%f,%f",vsfrom[0],vsfrom[1],vsfrom[2]); float vsto[3]; fread(vsto,sizeof(float),3,fp); qDebug("to:%f,%f,%f",vsto[0],vsto[1],vsto[2]); float vsup[3]; fread(vsup,sizeof(float),3,fp); qDebug("up:%f,%f,%f",vsup[0],vsup[1],vsup[2]); fclose(fp); setFov(sfov); setFarPlane(sfarPlane); setNearPlane(snearPlane); setFrom(GGL::Point3f(vsfrom[0],vsfrom[1],vsfrom[2])); setTo(GGL::Point3f(vsto[0],vsto[1],vsto[2])); setUp(GGL::Point3f(vsup[0],vsup[1],vsup[2])); }
void CInfiniteMediatorTest::testTransparentMainLoop() { tearDown(); // Set up the mediator std::string proto("file://"); std::string infname("./run-0000-00.evt"); std::string outfname("./copy-run-0000-00.evt"); // std::ifstream ifile (infname.c_str()); // std::ofstream ofile (outfname.c_str()); // m_source = new CIStreamDataSource(ifile); // m_sink = new COStreamDataSink(ofile); try { URL uri(proto+infname); m_source = new CFileDataSource(uri, std::vector<uint16_t>()); m_sink = new CFileDataSink(outfname); m_filter = new CTransparentFilter; m_mediator = new CInfiniteMediator(0,0,0); m_mediator->setDataSource(m_source); m_mediator->setDataSink(m_sink); m_mediator->setFilter(m_filter); m_mediator->mainLoop(); // kill all of the sinks and sources tearDown(); // set up defaults so that we don't segfault at tearDown setUp(); } catch (CException& exc) { std::stringstream errmsg; errmsg << "Caught exception:" << exc.ReasonText(); CPPUNIT_FAIL(errmsg.str().c_str()); } catch (int errcode) { std::stringstream errmsg; errmsg << "Caught integer " << errcode; CPPUNIT_FAIL(errmsg.str().c_str()); } catch (std::string errmsg) { CPPUNIT_FAIL(errmsg.c_str()); } CPPUNIT_ASSERT( filesEqual(infname,outfname) ); remove(outfname.c_str()); }
int main(int argc, char *argv[]) { int sockfd, newsockfd, portno; socklen_t clilen; char buffer[MAXDATASIZE]; char clientMsg[MAXDATASIZE]; char serverMsg[MAXDATASIZE]; char *serverHandle = "ServerMan"; int handleLen = strlen(serverHandle); int pid; struct sockaddr_in serv_addr, cli_addr; int n; sockfd = setUp(argc, argv, serv_addr, cli_addr); clilen = sizeof(cli_addr); //get size (# of bytes) of client struct while(1){ signal(SIGCHLD, SIG_IGN); //ignore the SIGCHLD signal //connect to pending connection and make a new socket fd for this connection newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); if (newsockfd < 0) //error check accept error("ERROR on accept"); pid = fork(); if(pid < 0) error("ERROR on fork"); if(pid == 0){ //in the child process close(sockfd); //close socket //call chat to send and recieve messages chat(clientMsg, buffer, newsockfd, serverHandle, serverMsg, handleLen); printf("Client has left Chat\n"); printf("In server waiting...listening...watching...\n"); exit(0); } else //we are in the parent process close(newsockfd); } close(sockfd); return 0; //should never reach here }
int TwoBitRunner::faToTwoBit(std::map<std::string, std::string> inputCommands) { TwoBitSetUp setUp(inputCommands); std::string inputFilename = ""; std::string outFilename = ""; bool overWrite = false; bool trimNameAtWhitepsace = false; setUp.setOption(inputFilename, "--in,-i", "Input fasta filename, can be several files seperated by commas", true); setUp.setOption(outFilename, "--out,-o", "Name of an output file", true); setUp.setOption(overWrite, "--overWrite", "Whether to overwrite the file if one is given by --out"); setUp.setOption(overWrite, "--overWrite", "Whether to overwrite the file if one is given by --out"); setUp.setOption(trimNameAtWhitepsace, "--trimNameAtWhitepsace", "Whether to trim the names of the fasta records at the first whitespace"); setUp.finishSetUp(std::cout); cppprogutils::appendAsNeeded(outFilename, ".2bit"); std::ofstream out; //check if output file exists if (!overWrite && cppprogutils::fexists(outFilename)) { throw Exception(__PRETTY_FUNCTION__, "File " + outFilename + " already exists, use --overWrite to over write"); } //read in seqs std::vector<std::unique_ptr<FastaRecord>> seqs; auto toks = cppprogutils::tokenizeString(inputFilename, ","); for(const auto & fName : toks){ std::ifstream in(fName); std::unique_ptr<FastaRecord> seq; while (readNextFasta(in, seq, trimNameAtWhitepsace)) { seqs.emplace_back(std::move(seq)); } } out.open(outFilename, std::ios::binary | std::ios::out); //write out header twoBitWriteHeader(seqs, out); //write out sequences for (const auto & seq : seqs) { seq->twoBitWriteOne(out); } return 0; }
void CInfiniteMediatorTest::testSkipNone() { tearDown(); // This should have no effect on any default behavior // We will simply test this as the TransparentMainLoop m_mediator = new CInfiniteMediator(0,0,0); m_mediator->setSkipCount(0); std::string proto("file://"); std::string infname("./run-0000-00.evt"); std::string outfname("./copy-run-0000-00.evt"); try { URL uri(proto+infname); m_source = new CFileDataSource(uri, std::vector<uint16_t>()); m_sink = new CFileDataSink(outfname); m_mediator->setDataSource(m_source); m_mediator->setDataSink(m_sink); m_mediator->setFilter(new CTransparentFilter); m_mediator->mainLoop(); // kill all of the sinks and sources tearDown(); // set up defaults so that we don't segfault at tearDown setUp(); } catch (CException& exc) { std::stringstream errmsg; errmsg << "Caught exception:" << exc.ReasonText(); CPPUNIT_FAIL(errmsg.str().c_str()); } catch (int errcode) { std::stringstream errmsg; errmsg << "Caught integer " << errcode; CPPUNIT_FAIL(errmsg.str().c_str()); } catch (std::string errmsg) { CPPUNIT_FAIL(errmsg.c_str()); } CPPUNIT_ASSERT( filesEqual(infname,outfname) ); remove(outfname.c_str()); }
JNIEXPORT jlong JNICALL Java_com_ssb_droidsound_plugins_GMEPlugin_N_1loadFile(JNIEnv *env, jobject obj, jstring fname) { jboolean iscopy; const char *s = env->GetStringUTFChars(fname, &iscopy); Music_Emu *emu = NULL; jlong rc = 0; gme_err_t err = gme_open_file(s, &emu, 44100); __android_log_print(ANDROID_LOG_VERBOSE, "GMEPlugin", "Loading from file '%s' => %s", s, err ? err : "OK"); if(!err) { rc = setUp(emu); } env->ReleaseStringUTFChars(fname, s); return rc; }
bool StabilizerBase::doOneIteration() { Mat frame = frameSource_->nextFrame(); if (!frame.empty()) { curPos_++; if (curPos_ > 0) { at(curPos_, frames_) = frame; if (doDeblurring_) at(curPos_, blurrinessRates_) = calcBlurriness(frame); at(curPos_ - 1, motions_) = estimateMotion(); if (curPos_ >= radius_) { curStabilizedPos_ = curPos_ - radius_; stabilizeFrame(); } } else setUp(frame); log_->print("."); return true; } if (curStabilizedPos_ < curPos_) { curStabilizedPos_++; at(curStabilizedPos_ + radius_, frames_) = at(curPos_, frames_); at(curStabilizedPos_ + radius_ - 1, motions_) = Mat::eye(3, 3, CV_32F); stabilizeFrame(); log_->print("."); return true; } return false; }
JNIEXPORT jlong JNICALL Java_com_ssb_droidsound_plugins_GMEPlugin_N_1load(JNIEnv *env, jobject obj, jbyteArray bArray, int size) { jbyte *ptr = env->GetByteArrayElements(bArray, NULL); Music_Emu *emu = NULL; jlong rc = 0; __android_log_print(ANDROID_LOG_VERBOSE, "GMEPlugin", "open %p %d", ptr, size); gme_err_t err = gme_open_data(ptr, size, &emu, 44100); __android_log_print(ANDROID_LOG_VERBOSE, "GMEPlugin", "Done ERR '%s'", err); if(!err) { rc = setUp(emu); } env->ReleaseByteArrayElements(bArray, ptr, 0); return rc; }
void Test::run() { setUp(); // An uncaught exception does not prevent the tear down from running. But // such an event still constitutes an error. To test this behavior we use a // special exception here that when thrown does trigger the tear down but is // not considered an error. try { _doTest(); } catch (FixtureExceptionForTesting&) { tearDown(); return; } catch (TestAssertionFailureException&) { tearDown(); throw; } tearDown(); }
void Camera::rotateAroundAtPoint(int axis, double angle, double focusDist) { Matrix4 matRot; if ( axis == 0 ) matRot = Matrix4::xrotation(angle); if ( axis == 1 ) matRot = Matrix4::yrotation(angle); if ( axis == 2 ) matRot = Matrix4::zrotation(angle); const Point3 ptFocus = getEye() + getLook() * focusDist; const Matrix4 matRotCameraInv = getRotationFromXYZ(); const Matrix4 matAll = matRotCameraInv * matRot * matRotCameraInv.transpose(); const double dScl = focusDist * tan( getZoom() / 2.0 ); const double dXOff = 1.0 / arScale * ptCOP[0] * dScl - skew * ptCOP[1]; const double dYOff = ptCOP[1] * dScl; // Undo center of projection pan to find true at point const Vector3 vecUndoCOPPan = dXOff * getRight() + dYOff * getUp(); // Should keep unit and ortho, but reset just to make sure const Vector3 vecFrom = matAll * (getEye() - ptFocus); const Vector3 vecUp = unit( matAll * getUp() ); const Vector3 vecRight = unit( matAll * getRight() ); // Undo center of projection pan to find true at point const Vector3 vecRedoCOPPan = dXOff * vecRight + dYOff * vecUp; // Find from point if we rotated around the correct at point, then fixed the pan const Point3 ptFrom = (ptFocus + vecUndoCOPPan) + vecFrom - vecRedoCOPPan; // Correct the at point for the COP pan, then add in the new COP pan const Point3 ptAt = (ptFocus + vecUndoCOPPan) - vecRedoCOPPan; setFrom( ptFrom ); setAt( ptAt ); setUp( vecUp ); }
bool RocketUIManager::handleSystemChange(EventDispatcher* sender, const Event& event) { const SystemChangeEvent& e = static_cast<const SystemChangeEvent&>(event); if(e.mSystemId != "render") { return true; } if(e.getType() == SystemChangeEvent::SYSTEM_ADDED) { setUp(); } if(e.getType() == SystemChangeEvent::SYSTEM_REMOVED) { mIsSetUp = false; mRenderSystemWrapper->destroy(); delete mRenderSystemWrapper; LOG(INFO) << "Render system was removed, system wrapper was destroyed"; mRenderSystemWrapper = 0; } return true; }
EGS_SourceCollection::EGS_SourceCollection(EGS_Input *input, EGS_ObjectFactory *f) : EGS_BaseSource(input,f), nsource(0), count(0) { vector<EGS_BaseSource *> s; egsInformation("EGS_BaseSource::EGS_BaseSource: input is:\n"); input->print(0,cout); EGS_Input *isource; while( (isource = input->takeInputItem("source",false)) ) { egsInformation("EGS_SourceCollection: got input\n"); EGS_BaseSource *this_source = EGS_BaseSource::createSource(isource); if(!this_source) egsWarning("EGS_SourceCollection: got null source\n"); else s.push_back(this_source); delete isource; } vector<string> snames; int err = input->getInput("source names",snames); if( !err ) { for(unsigned int j=0; j<snames.size(); j++) { EGS_BaseSource *this_source = EGS_BaseSource::getSource(snames[j]); if(!this_source) egsWarning("EGS_SourceCollection: got null source\n"); else s.push_back(this_source); } } if( s.size() < 1 ) { egsWarning("EGS_SourceCollection: no sources\n"); return; } vector<EGS_Float> prob; err = input->getInput("weights",prob); if( err ) { egsWarning("EGS_SourceCollection: missing 'weights' input\n"); return; } if( prob.size() != s.size() ) { egsWarning("EGS_SourceCollection: the number of sources (%d) is not" " the same as the number of input probabilities (%d)\n", s.size(),prob.size()); return; } setUp(s,prob); }
TEST(windowsBitmapDecodeEncode, CodecLibrary) { setUp(); std::ifstream inFile("basic.bmp", std::ios::binary); CHECK_EQUAL(0, !inFile); HBitmapDecoder decoder = theCodecLibrary->createDecoder(inFile); HBitmapIterator iterator = decoder->createIterator(); CHECK(iterator.get()); CHECK_EQUAL(100, iterator->getBitmapHeight()); CHECK_EQUAL(100, iterator->getBitmapWidth()); HBitmapEncoder encoder = theCodecLibrary->createEncoder(msBmp, iterator); std::ofstream outFile("output_basicCopy.bmp", std::ios::binary); encoder->encodeToStream(outFile); // TODO: file compare input/output tearDown(); }
TestResult TestRef::run() { TestResult result; setUp(); try { executeMethod(); } catch (TestResult &r) { result = r; } catch (std::exception &e) { result = TestResult(e); } catch (...) { result = TestResult(false, "", 0, "", "unknown exception"); } result.expectedFailure = getExpectFailure(); tearDown(); return result; }
int main(int argc, char* argv[]) { // Global variables init _frameN = 0; _savingSet = false; _freezed = false; _occupiedHeight = 0; timeout_ID = 0; setOptionsToDefault(); // Parse option file parameters parseOptFile(_options.fileName); // Parse command line parameters parseParameters(argc, argv); // Setting Up Program setUp(); g_print("Starting application..\n"); // This is called in all GTK applications. Arguments are parsed // from the command line and are returned to the application. gtk_init (&argc, &argv); // create a new window mainWindow = createMainWindow(); // Non Modal Dialogs saveSingleDialog = createSaveSingleDialog(); saveSetDialog = createSaveSetDialog(); // Shows all widgets in main Window gtk_widget_show_all (mainWindow); gtk_window_move(GTK_WINDOW(mainWindow), _options.posX, _options.posY); // All GTK applications must have a gtk_main(). Control ends here // and waits for an event to occur (like a key press or // mouse event). gtk_main (); return 0; }
PhyloTree::PhyloTree(string tfile){ try { m = MothurOut::getInstance(); current = CurrentFile::getInstance(); numNodes = 1; numSeqs = 0; tree.push_back(TaxNode("Root")); tree[0].heirarchyID = "0"; tree[0].level = 0; maxLevel = 0; calcTotals = true; string name, tax; map<string, string> temp; util.readTax(tfile, temp, true); for (map<string, string>::iterator itTemp = temp.begin(); itTemp != temp.end();) { addSeqToTree(itTemp->first, itTemp->second); temp.erase(itTemp++); } string unknownTax = "unknown;"; //added last taxon until you get desired level for (int i = 1; i < maxLevel; i++) { unknownTax += "unknown_unclassfied;"; } addSeqToTree("unknown", unknownTax); assignHeirarchyIDs(0); //create file for summary if needed setUp(tfile); } catch(exception& e) { m->errorOut(e, "PhyloTree", "PhyloTree"); exit(1); } }
EGS_TransformedSource::EGS_TransformedSource(EGS_Input *input, EGS_ObjectFactory *f) : EGS_BaseSource(input,f), source(0), T(0) { EGS_Input *isource = input->takeInputItem("source",false); if (isource) { source = EGS_BaseSource::createSource(isource); delete isource; } if (!source) { string sname; int err = input->getInput("source name",sname); if (err) egsWarning("EGS_TransformedSource: missing/wrong inline source " "definition and missing wrong 'source name' input\n"); else { source = EGS_BaseSource::getSource(sname); if (!source) egsWarning("EGS_TransformedSource: a source named %s" " does not exist\n"); } } EGS_AffineTransform *t = EGS_AffineTransform::getTransformation(input); setUp(t); delete t; }
void playGame(CVector *wordVec, int wordLength) { int nGuess = chooseNumberGuesses(); char guessedWord[wordLength+1]; setUp(guessedWord, wordLength); char guessedLetters[nGuess]; strcpy(guessedLetters, ""); int dashLeft = wordLength; while(nGuess > 0 && dashLeft > 0) { char ch = readGuess(); int n = -1; char *secretWord; if (cvec_count(wordVec) > 1) { int index = 0; wordVec = divideFam(wordVec, wordLength, ch, &index); if (index == 0) { n = 0; } else { secretWord = (char*)cvec_first(wordVec); n = getCorrectChar(guessedWord, secretWord, wordLength, ch); } } else { secretWord = (char*)cvec_first(wordVec); n = getCorrectChar(guessedWord, secretWord, wordLength, ch); //free(secretWord); } if (n > 0) { dashLeft -= n; printf("Correct! There are %d %c's in the word.\nThe secret word now looks like this: %s\n", n, ch, guessedWord); } else if (n == 0){ nGuess = wrongGuess(guessedLetters, guessedWord, ch, nGuess); } } endGame(nGuess, dashLeft, wordVec, guessedWord); }
bool QuadParticleSystemDrawer::setNormalAndUpSource(UInt32 NormalSource, UInt32 UpSource, Vec3f Normal, Vec3f Up) { // set the values for the static normal and up vectors, since they won't necessarily be used setNormal(Normal); setUp(Up); bool defaultsUsed = false; // need to determine if the normal source and up direction source are compatible // this checks all possible valid combinations we have decided to allow if( (NormalSource == NORMAL_VELOCITY && (UpSource ==UP_POSITION_CHANGE || UpSource == UP_VELOCITY_CHANGE)) || (UpSource == UP_VELOCITY && (NormalSource == NORMAL_POSITION_CHANGE || NormalSource == NORMAL_VELOCITY_CHANGE || NormalSource == NORMAL_VIEW_DIRECTION )) || (UpSource == UP_VIEW_DIRECTION && (NormalSource == NORMAL_VIEW_DIRECTION || NormalSource == NORMAL_VIEW_POSITION )) || (NormalSource == NORMAL_STATIC) || (UpSource == UP_STATIC)) { // this is a valid combination, so use it! setNormalSource(NormalSource); setUpSource(UpSource); } else { // the combination of up and normal sources is incompatible, use defaults setNormalSource(NORMAL_STATIC); setUpSource(UP_STATIC); defaultsUsed = true; } return !defaultsUsed; }
EGS_AngularSpreadSource::EGS_AngularSpreadSource(EGS_Input *input, EGS_ObjectFactory *f) : EGS_BaseSource(input,f), source(0), sigma(0) { EGS_Input *isource = input->takeInputItem("source",false); if( isource ) { source = EGS_BaseSource::createSource(isource); delete isource; } if( !source ) { string sname; int err = input->getInput("source name",sname); if( err ) egsWarning("EGS_AngularSpreadSource: missing/wrong inline source " "definition and missing wrong 'source name' input\n"); else { source = EGS_BaseSource::getSource(sname); if( !source ) egsWarning("EGS_AngularSpreadSource: a source named %s" " does not exist\n"); } } int err = input->getInput("sigma",sigma); if( !err ) { if( sigma < 0 ) sigma = -0.4246609001440095285*sigma; sigma *= M_PI/180; sigma *= sigma; } setUp(); }
/// Run the test and catch any exceptions that are triggered by it void TestCase::run( TestResult *result ) { result->startTest(this); try { setUp(); try { runTest(); } catch ( Exception &e ) { Exception *copy = e.clone(); result->addFailure( this, copy ); } catch ( std::exception &e ) { result->addError( this, new Exception( e.what() ) ); } catch (...) { Exception *e = new Exception( "caught unknown exception" ); result->addError( this, e ); } try { tearDown(); } catch (...) { result->addError( this, new Exception( "tearDown() failed" ) ); } } catch (...) { result->addError( this, new Exception( "setUp() failed" ) ); } result->endTest( this ); }
bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type) { switch (type) { case ESM::REC_ALCH: case ESM::REC_ARMO: case ESM::REC_BOOK: case ESM::REC_CLAS: case ESM::REC_CLOT: case ESM::REC_ENCH: case ESM::REC_SPEL: case ESM::REC_WEAP: case ESM::REC_NPC_: mStores[type]->read (reader); if (type==ESM::REC_NPC_) { // NPC record will always be last and we know that there can be only one // dynamic NPC record (player) -> We are done here with dynamic record laoding setUp(); const ESM::NPC *player = mNpcs.find ("player"); if (!mRaces.find (player->mRace) || !mClasses.find (player->mClass)) throw std::runtime_error ("Invalid player record (race or class unavilable"); } return true; default: return false; } }
int main() { int a[SIZE]; int temp[SIZE]; double startTime, endTime; int num_threads; #pragma omp parallel { #pragma omp master { num_threads = omp_get_num_threads(); } } setUp(a, SIZE); startTime = omp_get_wtime(); mergesort_parallel_omp(a, SIZE, temp, num_threads); endTime = omp_get_wtime(); tearDown(startTime, endTime, a, SIZE); }
void resetTest(void) { tearDown(); setUp(); }
//***************************************************************************** // CLASS GeneralPage - Contructor //***************************************************************************** GeneralPage :: GeneralPage(IWindow* pParent, const IString empNum) : IMultiCellCanvas(ID_GENERAL_PAGE, pParent, pParent), employeeData(empNum ), pageButtons(ID_GENERAL_PAGE_BUTTONS, this,this, false), employeeIdText (ID_NO_ITEM, this, this ), lastNameText (ID_NO_ITEM, this, this ), firstNameText (ID_NO_ITEM, this, this ), middleNameText (ID_NO_ITEM, this, this ), intPhoneText (ID_NO_ITEM, this, this ), extPhoneText (ID_NO_ITEM, this, this ), roomText (ID_NO_ITEM, this, this ), deptText (ID_NO_ITEM, this, this ), bldgText (ID_NO_ITEM, this, this ), divText (ID_NO_ITEM, this, this ), mgrEmpNumText (ID_NO_ITEM, this, this ), mgrEmpNameText (ID_NO_ITEM, this, this ), employeeId (ID_GEN_EMPLOYEE_ID_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), lastName (ID_GEN_LAST_NAME_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), firstName (ID_GEN_FIRST_NAME_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), middleInitial (ID_GEN_MIDDLE_INITIAL_EF, this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), intPhone (ID_GEN_INT_PHONE_EF, this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), extPhone (ID_GEN_EXT_PHONE_EF, this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), room (ID_GEN_ROOM_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), building (ID_GEN_BUILDING_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), deptName (ID_GEN_DEPT_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), division (ID_GEN_DIVISION_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), employeeType (this), mgrEmpId (ID_GEN_MGR_EMP_ID_EF, this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), mgrName (ID_GEN_MGR_NAME_EF , this, this, IRectangle(), IEntryField::classDefaultStyle | IControl::tabStop), Key(empNum), thePageSettings( IApplication::current().userResourceLibrary().loadString( STR_GEN_GENERAL_TAB), NULL, INotebook::PageSettings::autoPageSize | INotebook::PageSettings::majorTab ), isAquery(false) { // set up the fields setUp(); if ( employeeId.text().length() ) employeeId.disableDataUpdate(); // set up the page setCells(); // populate the page from any database info displayData(); handleIt(); }
void CameraForGL::setUp(vect3f v) { setUp(v.x, v.y, v.z); }