Exemplo n.º 1
0
void LLCondition::wait_main()
{
	llassert(isSelfLocked());
	LLFastTimer ft1(FT_WAIT_FOR_CONDITION);
	LLConditionVariableImpl::wait(*this);
	llassert(isSelfLocked());
}
Exemplo n.º 2
0
std::string LLDate::toHTTPDateString (std::string fmt) const
{
	LLFastTimer ft1(FT_DATE_FORMAT);
	
	time_t locSeconds = (time_t) mSecondsSinceEpoch;
	struct tm * gmt = gmtime (&locSeconds);
	return toHTTPDateString(gmt, fmt);
}
Exemplo n.º 3
0
TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInVarArgAreNotEqual) {
	ShPtr<FunctionType> ft1(FunctionType::create());

	ShPtr<FunctionType> ft2(FunctionType::create());
	ft2->setVarArg();

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
Exemplo n.º 4
0
TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInNumberOfParametersAreNotEqual) {
	ShPtr<FunctionType> ft1(FunctionType::create());

	ShPtr<FunctionType> ft2(FunctionType::create());
	ShPtr<IntType> paramType(IntType::create(32));
	ft2->addParam(paramType);

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
Exemplo n.º 5
0
TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInReturnTypeAreNotEqual) {
	ShPtr<VoidType> f1RetType(VoidType::create());
	ShPtr<FunctionType> ft1(FunctionType::create(f1RetType));

	ShPtr<IntType> f2RetType(IntType::create(32));
	ShPtr<FunctionType> ft2(FunctionType::create(f2RetType));

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
Exemplo n.º 6
0
void LLCondition::wait()
{
	if (AIThreadID::in_main_thread_inline())
	{
		LLFastTimer ft1(FT_WAIT_FOR_CONDITION);
		apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
	}
	else
	{
		apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
	}
}
Exemplo n.º 7
0
TEST_F(FunctionTypeTests,
CloningCreatesEqualFunctionType) {
	ShPtr<IntType> retType(IntType::create(16));
	ShPtr<IntType> param1Type(IntType::create(32));
	ShPtr<IntType> param2Type(IntType::create(64));
	ShPtr<FunctionType> ft1(FunctionType::create(retType));
	ft1->addParam(param1Type);
	ft1->addParam(param2Type);
	ft1->setVarArg();

	ShPtr<FunctionType> ft2(ucast<FunctionType>(ft1->clone()));

	EXPECT_TRUE(ft1->isEqualTo(ft2));
}
Exemplo n.º 8
0
std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt)
{
	LLFastTimer ft1(FT_DATE_FORMAT);

	// avoid calling setlocale() unnecessarily - it's expensive.
	static std::string prev_locale = "";
	std::string this_locale = LLStringUtil::getLocale();
	if (this_locale != prev_locale)
	{
		setlocale(LC_TIME, this_locale.c_str());
		prev_locale = this_locale;
	}

	// use strftime() as it appears to be faster than std::time_put
	char buffer[128];
	strftime(buffer, 128, fmt.c_str(), gmt);
	return std::string(buffer);
}
Exemplo n.º 9
0
TEST_F(FunctionTypeTests,
TwoFunctionTypesWithSameDataAreEqual) {
	ShPtr<IntType> retType(IntType::create(16));
	ShPtr<IntType> param1Type(IntType::create(32));
	ShPtr<IntType> param2Type(IntType::create(64));

	ShPtr<FunctionType> ft1(FunctionType::create(retType));
	ft1->addParam(param1Type);
	ft1->addParam(param2Type);
	ft1->setVarArg();

	ShPtr<FunctionType> ft2(FunctionType::create(retType));
	ft2->addParam(param1Type);
	ft2->addParam(param2Type);
	ft2->setVarArg();

	EXPECT_TRUE(ft1->isEqualTo(ft2));
}
int main(void){
    pa0();
    vezerlo_valtozo=1;
    korabbi_dontesek_szama=0;
    while(vezerlo_valtozo)
        switch(vezerlo_valtozo){
            case 1: if (ft1()){
                        pa8();
                        vezerlo_valtozo=0;
                      }
                      else if (ft2()) if ((valasztasi_lehetosegek_szama=fa1())){
                                          pa2();
                                          aktualis_lehetoseg_sorszama=0;
                                          vezerlo_valtozo=3;
                                         }
                                         else vezerlo_valtozo=2;
                              else vezerlo_valtozo=2;
                    break;
            case 2: if (korabbi_dontesek_szama){
                        korabbi_dontesek_szama--;
                        pa4();
                        if (aktualis_lehetoseg_sorszama<valasztasi_lehetosegek_szama-1){
                            aktualis_lehetoseg_sorszama++;
                            vezerlo_valtozo=3;
                           }
                           else vezerlo_valtozo=2;
                       }
                       else {
                           printf("A graf nem szinezheto %d szinnel!\n",MAX_color);
                           vezerlo_valtozo=0;
                       }
                    break;
            case 3: pa6();
                    pa7();
                    korabbi_dontesek_szama++;
                    vezerlo_valtozo=1;
        }
		getchar();
    return 0;

}
Exemplo n.º 11
0
void LLMutexBase::lock() 
{ 
	if (mLockingThread.equals_current_thread_inline())
	{ //redundant lock
		mCount++;
		return;
	}

	if (APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mAPRMutexp)))
	{
	  if (AIThreadID::in_main_thread_inline())
	  {
		LLFastTimer ft1(FT_WAIT_FOR_MUTEX);
		apr_thread_mutex_lock(mAPRMutexp);
	  }
	  else
	  {
		apr_thread_mutex_lock(mAPRMutexp);
	  }
	}
	
	mLockingThread.reset_inline();
}
Exemplo n.º 12
0
/***********************************************************************//**
 * @brief Test unbinned observation handling for a specific dataset
 *
 * @param[in] datadir Directory of test data.
 *
 * Verifies the ability to handle unbinned Fermi/LAT data.
 ***************************************************************************/
void TestGLATObservation::test_one_unbinned_obs(const std::string& datadir)
{
    // Set filenames
    std::string lat_ft1       = datadir+"/ft1.fits";
    std::string lat_ft2       = datadir+"/ft2.fits";
    std::string lat_unbin_xml = datadir+"/obs_unbinned.xml";
    std::string file1         = "test_lat_obs_unbinned.xml";

    // Declare observations
    GObservations   obs;
    GLATObservation run;

    // Determine number of events in FT1 file
    GFits ft1(lat_ft1);
    int nevents = ft1.table("EVENTS")->nrows();
    ft1.close();

    // Try loading event list
    GLATEventList list(lat_ft1);
    test_value(list.number(), nevents, "Test number of events in list.");

    // Load unbinned LAT observation
    test_try("Load unbinned LAT observation");
    try {
        run.load_unbinned(lat_ft1, lat_ft2, "");
        test_try_success();
    }
    catch (std::exception &e) {
        test_try_failure(e);
    }

    // Add observation (twice) to data
    test_try("Append observation twice");
    try {
        run.id("0001");
        obs.append(run);
        run.id("0002");
        obs.append(run);
        test_try_success();
    }
    catch (std::exception &e) {
        test_try_failure(e);
    }

    // Loop over all events
    const GEvents *ptr = run.events();
    int num = 0;
    for (int i = 0; i < ptr->size(); ++i) {
        num++;
    }
    test_value(num, nevents, 1.0e-20, "Test event iterator");

    // Test XML loading
    test_try("Test XML loading");
    try {
        setenv("CALDB", lat_caldb.c_str(), 1);
        obs = GObservations(lat_unbin_xml);
        obs.save(file1);
        test_try_success();
    }
    catch (std::exception &e) {
        test_try_failure(e);
    }

    // Exit test
    return;

}
Exemplo n.º 13
0
int		main(void)
{
	FragTrap ft1("Alf");
	FragTrap ft2("Bob");
	FragTrap ft3(ft1);
	std::cout << std::endl;


	ft3 = ft2;
	std::cout << std::endl;

	ft1.rangedAttack("Bob");
	std::cout << std::endl;

	ft1.meleeAttack("Bob");
	std::cout << std::endl;

	ft1.takeDamage(3);
	std::cout << std::endl;

	ft1.beRepaired(3);
	std::cout << std::endl;

	ft1.takeDamage(1000);
	std::cout << std::endl;

	ft1.beRepaired(1000);
	std::cout << std::endl;

	ft1.beRepaired(3);
	std::cout << std::endl;

	ft1.Ep = 100;
	std::cout << std::endl;

	ft1.vaulthunter_dot_exe("1");
	ft1.vaulthunter_dot_exe("2");
	ft1.vaulthunter_dot_exe("3");
	ft1.vaulthunter_dot_exe("4");
	ft1.vaulthunter_dot_exe("5");
	std::cout << std::endl;

	ScavTrap st1("John");
    ScavTrap st2("Ben");
    ScavTrap st3;
	std::cout << std::endl;

    st1.meleeAttack("bob");
    st1.rangedAttack("Alf");
	std::cout << std::endl;

    st2.takeDamage(45);
    st2.beRepaired(21);
	std::cout << std::endl;

    st3.challengeNewcomer();
    st3.challengeNewcomer();
	std::cout << std::endl;

	return (0);
}
Exemplo n.º 14
0
void LLMutex::lock_main(LLFastTimer::DeclareTimer* timer)
{
	llassert(!isSelfLocked());
	LLFastTimer ft1(timer ? *timer : FT_WAIT_FOR_MUTEX);
	LLMutexImpl::lock();
}
Exemplo n.º 15
0
int		main(void)
{
	FragTrap ft1("Alf");
	FragTrap ft2("Bob");
	FragTrap ft3(ft1);
	std::cout << std::endl;


	ft1.debug();
	ft2.debug();
	ft3.debug();
	std::cout << std::endl;

	ft3 = ft2;
	ft1.debug();
	ft2.debug();
	ft3.debug();
	std::cout << std::endl;

	ft1.rangedAttack("Bob");
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.meleeAttack("Bob");
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.takeDamage(3);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.beRepaired(3);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.takeDamage(1000);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.beRepaired(1000);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.vaulthunter_dot_exe("1");
	ft1.debug();
	ft1.vaulthunter_dot_exe("2");
	ft1.debug();
	ft1.vaulthunter_dot_exe("3");
	ft1.debug();
	ft1.vaulthunter_dot_exe("4");
	ft1.debug();
	ft1.vaulthunter_dot_exe("5");
	ft1.debug();
	std::cout << std::endl;

	return (0);
}
Exemplo n.º 16
0
// Main
int main(int argc, char *argv[])
{
    // Init GTK
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    window.set_size_request(450, 350);

        Gtk::Fixed fixed;
        window.add(fixed);

            // Lines ////////

            Lines lines;
            lines.set_size_request(500, 425);

            // FLTK
            lines.add_line(230, 45, 110, 115);
            lines.add_line(270, 45, 270, 90);
            lines.add_line(290, 45, 400, 165);
            lines.add_line(310, 40, 350, 60);

            // Point
            lines.add_line(110, 55, 110, 115);
            lines.add_line(150, 55, 210, 90);

            // Graph
            lines.add_line(110, 160, 90, 240);
            lines.add_line(110, 160, 170, 340);

            // Window
            lines.add_line(250, 135, 230, 190);
            lines.add_line(270, 135, 270, 265);
            lines.add_line(320, 135, 400, 165);

            // GUI
            lines.add_line(340, 210, 270, 265);
            lines.add_line(390, 210, 400, 240);

            // Simple
            lines.add_line(200, 310, 170, 340);

            // So difficult... >.<

            fixed.add(lines);

            // Nodes ////////

            TitledText tt1("Point.h", "struct Point { ... };");
            fixed.put(tt1, 50, 25);

            TitledText tt2("Graph.h", "// graphing interface\nstruct Shape { ... };\n...");
            fixed.put(tt2, 50, 100);

            TitledText tt3("Graph.cpp", "Graph code");
            fixed.put(tt3, 25, 225);

            TitledText tt4("Window.h", "// window interface\nclass Window { ... };\n...");
            fixed.put(tt4, 200, 75);

            TitledText tt5("Window.cpp", "Window code");
            fixed.put(tt5, 150, 175);

            TitledText tt6("GUI.h", "// GUI interface\nstruct In_box { ... };\n...");
            fixed.put(tt6, 325, 150);

            TitledText tt7("GUI.cpp", "GUI code");
            fixed.put(tt7, 350, 225);

            TitledText tt8("Simple_window.h", "// window interface\nclass Simple_window { ... };\n...");
            fixed.put(tt8, 175, 250);

            TitledText tt9("chapter12.cpp", "#include \"Graph.h\"\n#include \"Simple_window.h\"\nint main { ... }");
            fixed.put(tt9, 75, 325);

            FramedText ft1("FLTK headers");
            ShadowFrame<FramedText> sfa1(ft1);
            ShadowFrame<ShadowFrame<FramedText> > sfb1(sfa1, 2);
            fixed.put(sfb1, 225, 25);

            FramedText ft2("FLTK code");
            ShadowFrame<FramedText> sfa2(ft2);
            ShadowFrame<ShadowFrame<FramedText> > sfb2(sfa2, 2);
            fixed.put(sfb2, 350, 50);

    // Done, run the application
    window.show_all_children();
    Gtk::Main::run(window);

    return EXIT_SUCCESS;
}