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


C++ setUp函数代码示例

本文整理汇总了C++中setUp函数的典型用法代码示例。如果您正苦于以下问题:C++ setUp函数的具体用法?C++ setUp怎么用?C++ setUp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: verify

        void Task::run() {
            verify( n == 0 );

            setUp();

            while( 1 ) {
                n++;
                try {
                    doWork();
                }
                catch(...) { }
                sleepmillis(repeat);
                if( inShutdown() )
                    break;
                if( repeat == 0 )
                    break;
            }
        }
开发者ID:3rf,项目名称:mongo,代码行数:18,代码来源:task.cpp

示例2: QDialog

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();
}
开发者ID:RedCraig,项目名称:retroshare,代码行数:18,代码来源:PhotoDialog.cpp

示例3: testBufferToneDetect

    // 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);
        }
    }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:20,代码来源:MprFromFileTest.cpp

示例4: assertTrue_msg

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();
}
开发者ID:SoarGroup,项目名称:Soar,代码行数:44,代码来源:IOTests.cpp

示例5: fread

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]));
}
开发者ID:shi-yan,项目名称:graphicsrelatedcodes,代码行数:44,代码来源:PerspectiveCamera.cpp

示例6: tearDown

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());
}
开发者ID:jrtomps,项目名称:nscldaq,代码行数:44,代码来源:filterhandlertests.cpp

示例7: main

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
}
开发者ID:MarshALEX,项目名称:Client_Server_Chat,代码行数:43,代码来源:chatserve.cpp

示例8: setUp

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;
}
开发者ID:weng-lab,项目名称:TwoBit,代码行数:43,代码来源:TwoBitRunner.cpp

示例9: Java_com_ssb_droidsound_plugins_GMEPlugin_N_1loadFile

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;

}
开发者ID:9a3eedi,项目名称:Droidsound,代码行数:19,代码来源:GMEPlugin.cpp

示例10: at

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;
}
开发者ID:406089450,项目名称:opencv,代码行数:42,代码来源:stabilizer.cpp

示例11: Java_com_ssb_droidsound_plugins_GMEPlugin_N_1load

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;
}
开发者ID:QaDeS,项目名称:droidsound,代码行数:20,代码来源:GMEPlugin.cpp

示例12: setUp

        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();
        }
开发者ID:89snake89,项目名称:mongo,代码行数:21,代码来源:unittest.cpp

示例13: getEye

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 );
}
开发者ID:kenwayc,项目名称:ComputerGraphics,代码行数:39,代码来源:Camera.cpp

示例14: setUp

  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;
  }
开发者ID:Unix4ever,项目名称:engine,代码行数:22,代码来源:RocketUIManager.cpp

示例15: EGS_BaseSource

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);
}
开发者ID:tener32,项目名称:EGSnrc,代码行数:39,代码来源:egs_source_collection.cpp


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