예제 #1
0
 Capacitor(const Registrar &registrar)
     : mStored(registrar.getInfo("energy"), Testing::Generator::ENERGY_PER_GENERATION * 20)
 {
     addInput("energy-in", new SinkConnector(this, registrar.getInfo("energy"), Testing::Generator::ENERGY_PER_GENERATION * 5));
     addOutput("energy-out", new SourceConnector(registrar.getInfo("energy"), Testing::Generator::ENERGY_PER_GENERATION));
     addOutputPin("readout", new OutputPin());
 }
예제 #2
0
/*!	\brief Creates and runs the registrar application.

	The main thread is renamed.

	\return 0.
*/
int
main()
{
	FUNCTION_START();
	// rename the main thread
	rename_thread(find_thread(NULL), kRosterThreadName);
	// create and run the registrar application
	Registrar *app = new Registrar();
PRINT(("app->Run()...\n"));
	app->Run();
PRINT(("delete app...\n"));
	delete app;
	FUNCTION_END();
	return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: suesin/RomeGit
int main(int argc, char *argv[])
{
    Citizenry myDB;    
    Citizen& emp2 = myDB.createCitizen("Nicholas", "Solter");
    
    FarmDirectory myFarmDB;
    Farms& thisFarm = myFarmDB.createFarm("Food", 2, 3);
    Farms& nextFarm = myFarmDB.createFarm("Olive", 4, 5);
    
    Registrar myRegDB;
    myRegDB.createRegistry(1000, 2000);
    
    Command cmd;
    cmd.MenuSelection(myDB, myFarmDB, myRegDB);
    cmd.Turn(myDB, myFarmDB, myRegDB);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}
예제 #4
0
/*!	\brief Creates and runs the registrar application.

	The main thread is renamed.

	\return 0.
*/
int
main()
{
	FUNCTION_START();

	// Create the global be_clipboard manually -- it will not work, since it
	// wants to talk to the registrar in its constructor, but it doesn't have
	// to and we would otherwise deadlock when initializing our GUI in the
	// app thread.
	be_clipboard = new BClipboard(NULL);


	// create and run the registrar application
	status_t error;
	Registrar *app = new Registrar(&error);
	if (error != B_OK) {
		fprintf(stderr, "REG: Failed to create the BApplication: %s\n",
			strerror(error));
		return 1;
	}

	// rename the main thread
	rename_thread(find_thread(NULL), kRosterThreadName);

	PRINT(("app->Run()...\n"));

	try {
		app->Run();
	} catch (std::exception& exception) {
		char buffer[1024];
		snprintf(buffer, sizeof(buffer),
			"registrar main() caught exception: %s", exception.what());
		debugger(buffer);
	} catch (...) {
		debugger("registrar main() caught unknown exception");
	}

	PRINT(("delete app...\n"));
	delete app;

	FUNCTION_END();
	return 0;
}
예제 #5
0
void processCommand(const vector<string>& command, Registrar& registrar) {
    if (command.size() == 0) {
        cerr << "Did not enter vaild command" << endl;
    }

    if (command[0] == "PrintReport"& command.size() == 1) {
        cout << registrar << endl;
    } else if (command[0] == "AddCourse" && command.size() == 2) {
        registrar.addCourse(command[1]);
    } else if (command[0] == "AddStudent" && command.size() == 2) {
        registrar.addStudent(command[1]);
    } else if (command[0] == "CancelCourse" && command.size() == 2) {
        registrar.cancelCourse(command[1]);
    } else if (command[0] == "EnrollStudentInCourse" && command.size() == 3) {
        registrar.enrollStudentInCourse(command[1], command[2]);
    } else if (command[0] == "Purge" && command.size() == 2) {
        registrar.purge();
    }
}
예제 #6
0
int main(int argc, char **argv)
{

    Ethereum::Connector::Provider provider;
    provider.connect(Ethereum::Connector::Test_Net);

    MasterRegistrar master(provider, BitProfile::Test_Net);
    MasterRegistrar::URIList list = master.getURIList();

    std::cout<<"registrars : "<<std::endl;
    for(MasterRegistrar::URIList::Iterator it = list.begin(), end = list.end(); it!=end; ++it)
    {
        std::cout<<"* "<<it->toString();
        Registrar registrar = master.get(it->getIndex());
        std::cout<<" : "<<registrar.getAddress()<<std::endl;
    }

    std::cout<<std::endl;

    return 0;
}
예제 #7
0
파일: main.cpp 프로젝트: mayhem/freeamp
int APIENTRY WinMain(HINSTANCE hInstance, 
					 HINSTANCE hPrevInstance,
		 			 LPSTR lpszCmdLine, 
					 int cmdShow)
{
    HANDLE runOnceMutex = NULL;
    bool   allowMultipleInst = false;

    g_hinst = hInstance;

    // should we allow FreeAmp to run?
    struct stat st;
    char path[MAX_PATH];
    char arg0[MAX_PATH];

    getcwd(path, sizeof(path));

    strcpy(arg0, __argv[0]);
    char* slash = strrchr(arg0, '\\');

    if(slash)
    {
        *slash = 0x00;

        if(strcasecmp(path, arg0))
        {
            chdir(arg0);
            strcpy(path, arg0);
        }
    }

    strcat(path, "\\NeedToRebootForUpdate");
    if(!stat(path, &st))
    {
        MessageBox(NULL, kReboot, "You Need To Reboot...", 
                            MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND);
        return 0;
    }

    FAContext *context = new FAContext;
    context->prefs = new Win32Prefs();
    context->prefs->GetPrefBoolean(kAllowMultipleInstancesPref, &allowMultipleInst);
    context->hInstance = hInstance;

	if (!allowMultipleInst)
    {
	   if(SendCommandLineToRealJukebox())
	   {
           return 0;
	   }

       runOnceMutex = CreateMutex(	NULL,
	    						    TRUE,
		    					    The_BRANDING" Should Only Run One Time!");

       if(GetLastError() == ERROR_ALREADY_EXISTS)
	   { 
           SendCommandLineToHiddenWindow();
        
           CloseHandle(runOnceMutex);
           return 0;
	   }
	}
    // This causes a dynamic link error on some non NT systems, and
    // it didn't seem to help on multiprocessor NT systems, so I'm
    // commenting it.
    //if(IsWinNT() && IsMultiProcessor())
    //    SetProcessAffinityMask(GetCurrentProcess(), 0);

    WSADATA sGawdIHateMicrosoft;
    WSAStartup(0x0002,  &sGawdIHateMicrosoft);


    context->log = new LogFile("freeamp.log");

    // find all the plug-ins we use
    Registrar* registrar;
    Registry* lmc;
    Registry* pmi;
    Registry* pmo;
    Registry*  ui;

    registrar = new Registrar;

    registrar->SetSubDir("plugins");
    registrar->SetSearchString("*.lmc");
    lmc = new Registry;
    registrar->InitializeRegistry(lmc, context->prefs);

    registrar->SetSearchString("*.pmi");
    pmi = new Registry;
    registrar->InitializeRegistry(pmi, context->prefs);

    registrar->SetSearchString("*.pmo");
    pmo = new Registry;
    registrar->InitializeRegistry(pmo, context->prefs);

    registrar->SetSearchString("*.ui");
    ui = new Registry;
    registrar->InitializeRegistry(ui, context->prefs);

    delete registrar;

    bool reclaimFileTypes, askBeforeReclaiming;
    uint32 length = sizeof(path);
    context->prefs->GetPrefBoolean(kReclaimFiletypesPref, &reclaimFileTypes);
    context->prefs->GetPrefBoolean(kAskToReclaimFiletypesPref, &askBeforeReclaiming);
    context->prefs->GetPrefString(kInstallDirPref, path, &length);
    strcat(path, "\\freeamp.exe");

    if(reclaimFileTypes)
        ReclaimFileTypes(path, askBeforeReclaiming);

    // create the player
	Player *player = Player::GetPlayer(context);

    // we are the first instance so create our hidden window
    Thread* thread = Thread::CreateThread();

    thread->Create(CreateHiddenWindow, context);

    // need a way to signal main thread to quit...
    Semaphore *termination = new Semaphore();
    
    // register items... we give up ownership here
    player->SetTerminationSemaphore(termination);
    player->RegisterLMCs(lmc);
    player->RegisterPMIs(pmi);
    player->RegisterPMOs(pmo);
    player->RegisterUIs(ui);

    // Let the player know if there are special requests from the user
    // __argc and __argv are magical variables provided for us
    // in MS's STDLIB.H file. 
    player->SetArgs(__argc, __argv);

    // kick things off... player is now in charge!
    player->Run();

    // sit around and twiddle our thumbs
    termination->Wait();

    // clean up our act
    delete player;
	delete context;
    delete thread;

	if (!allowMultipleInst)
       CloseHandle(runOnceMutex);

	WSACleanup();

	return 0;
}
예제 #8
0
파일: main.cpp 프로젝트: mayhem/freeamp
bool SendCommandLineToRealJukebox()
{
	bool result = false;

	Registrar registrar;
	Registry formatRegistry;
	Win32Prefs prefs;
	vector<DownloadFormatInfo*> formats;

	// init
    registrar.SetSubDir("plugins");
    registrar.SetSearchString("*.dlf");
    registrar.InitializeRegistry(&formatRegistry, &prefs);

    const RegistryItem* module = NULL;
    DownloadFormat* dlf = NULL;
    int32 i = 0;

    while((module = formatRegistry.GetItem(i++)))
    {
        dlf = (DownloadFormat*) module->InitFunction()(NULL);

        if(dlf)
        {
            DownloadFormatInfo dlfi;

            uint32 index = 0;

            // error != kError_NoMoreFormats
            while(IsntError(dlf->GetSupportedFormats(&dlfi, index++)))
            {
                dlfi.SetRef(dlf);
                formats.push_back(new DownloadFormatInfo(dlfi));
            }
        }
    }

	vector<DownloadFormatInfo*>::iterator dlfIter;

	if(__argc > 1)
    {
        char* extension;

		extension = strrchr(__argv[1], '.');

		if(extension)
        {
			extension++;

			for(dlfIter = formats.begin(); 
				dlfIter != formats.end(); 
				dlfIter++)
			{
				if(!strcasecmp(extension, (*dlfIter)->GetExtension()))
                {
					vector<DownloadItem*> items;
					char url[MAX_PATH + 7];
					uint32 size = sizeof(url);
					Error err;

					err = FilePathToURL(__argv[1], url, &size);

					if(IsntError(err))
					{
						(*dlfIter)->GetRef()->ReadDownloadFile(url, 
															   &items);

						vector<DownloadItem*>::iterator dliIter;

						for(dliIter = items.begin(); 
							dliIter != items.end(); 
							dliIter++)
						{
							MetaData metadata = (*dliIter)->GetMetaData();

							if(	strcasecmp("mp3", metadata.FormatExtension().c_str()) &&
								strcasecmp("mp2", metadata.FormatExtension().c_str()) &&
								strcasecmp("mp1", metadata.FormatExtension().c_str()) &&
								strcasecmp("m3u", metadata.FormatExtension().c_str()) &&
								strcasecmp("pls", metadata.FormatExtension().c_str()) )
							{
                                bool rjFound = false;

								result = true;

								LONG regErr;
								HKEY key;

                                regErr = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
													  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\realjbox.exe",
													  0, 
													  KEY_WRITE|KEY_READ,
													  &key);

                                if(regErr == ERROR_SUCCESS)
                                {
                                    char buf[MAX_PATH*2];
                                    DWORD len = sizeof(buf);
                                    DWORD type;

                                    regErr = RegQueryValueEx(key,
                                                             NULL, 
                                                             NULL, 
                                                             &type, 
                                                             (LPBYTE)buf, 
                                                             &len);

                                    if(regErr == ERROR_SUCCESS)
                                    {
                                        rjFound = true;

                                        strcat(buf, " /m application/vnd.rn-rn_music_package ");
                                        strcat(buf, __argv[1]);

                                        WinExec(buf, SW_NORMAL);
                                    }
                                }

                                if(!rjFound)
                                {
                                    MessageBox(NULL, The_BRANDING" does not support the formats "
                                                     "contained in this Music Package.  The download "
                                                     "will be aborted.", "Unsupported Formats", MB_OK);

                                    DeleteFile(__argv[1]);
                                }
							}
						}
					}

                    break;
                }
			}

		}
    }

	// clean up
	for(dlfIter = formats.begin(); 
		dlfIter != formats.end(); 
		dlfIter++)
	{
		delete (*dlfIter)->GetRef();
		delete (*dlfIter);
	}

	return result;
}
예제 #9
0
void ChemoPopComposer::setupSimulation() {
	this->initializeAgentFactories();

	Registrar *r = Registrar::getSystemRegistrar();

	maestro = this->createAgent(*factories[0]);
	orchestra.push_back(maestro);
	r->registerNewAgent(maestro);

	// propagate the num_steps and dt of the maestro to the composer
	this->dt = ((DoubleData*) maestro->getDatabase()->getDataItem("dt"))->getDouble();
	this->num_steps = ((IntegerData*) maestro->getDatabase()->getDataItem("num_steps"))->getInteger();

	/// error checking before initialising the number of cells
	if (((WorldAgentFactoryII *) factories[0])->getNumCells() != cpi->getNumberCells()) {

		std::stringstream outx, outy;
		outx << ((WorldAgentFactoryII *) factories[0])->getNumCells(); string x; x = outx.str();
		outy << cpi->getNumberCells(); string y; y = outy.str();

		throw HiveException("this one will be fatal! world factory and cell factories operate with different cell numbers ("+x+" in worldFactory vs. "+y+" in cellFactory)",
				"ChemoPopComposer::setupSimulation()");
	}

	// get the number of cells
	this->number_of_cells = cpi->getNumberCells();

	cerr <<  "# creating cells " << endl;
	// create the cells of the orchestra
	for (int i =0; i<this->number_of_cells; i++) {
		Agent *cell = factories[1]->createAgent();
		orchestra.push_back(cell);
		r->registerNewAgent(cell);
	}
//	cerr << "hier" << endl;
	//maestro->getDatabase()->printDataBase(cerr);
	//orchestra.at(1)->getDatabase()->printDataBase(cerr);


	// set the number of cells that the output agent will have to deal with
	if (!this->cells_are_blind_agents)
		((OutputAgentFactory*) factories.at(2))->setNumberCells(number_of_cells);
	else
		((OutputAgentFactory*) factories.at(2))->setNumberBlindAgents(number_of_cells);
	// tell the output agent whether it will need to output the world grid
	if (((BoolData*) maestro->getDatabase()->getDataItem("is_grid_environment"))->getBool())
		((OutputAgentFactory*) factories.at(2))->setWorldHasGrid(true);
	// create the output agent
	SpecialAgent *ibn_abi_sarh = (SpecialAgent* ) factories.at(2)->createAgent();
	ibn_abi_sarh->setOutputInterval(this->output_interval);
	special_agents.push_back(ibn_abi_sarh);
	r->registerNewAgent(ibn_abi_sarh);
	r->registerNewSpecialAgent(ibn_abi_sarh);

	//ibn_abi_sarh->getDatabase()->printDataBase(cerr);
	//exit(1);

	this->setupAgentHierarchy();

	this->addSerialCommunicator();

	this->num_steps = ((WorldAgentFactoryI*)this->factories.at(0))->getNumSteps();
	this->dt        = ((WorldAgentFactoryI*)this->factories.at(0))->getTimeIncrement();

	// we do not need to send an initialisation messages.
	cerr << "# done setting up the simulation" << endl;

	/// just for testing the new model by will, dumb the cell agent's databases to see that everything
	/// has been initialised correctly.
//	Database *db101 = orchestra[1]->getDatabase();
//	db101->printDataBase(cerr);
//	Database *db202 = orchestra[2]->getDatabase();
//	db202->printDataBase(cerr);

//	exit(1);
}
예제 #10
0
int main() {
    
    Registrar registrar;
    
    cout << "No courses or students added yet\n";
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "AddCourse CS101.001\n";
    registrar.addCourse("CS101.001");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "AddStudent FritzTheCat\n";
    registrar.addStudent("FritzTheCat");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "AddCourse CS102.001\n";
    registrar.addCourse("CS102.001");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "EnrollStudentInCourse FritzTheCat CS102.001\n";
    registrar.enrollStudentInCourse("FritzTheCat", "CS102.001");
    cout << "EnrollStudentInCourse FritzTheCat CS101.001\n";
    registrar.enrollStudentInCourse("FritzTheCat", "CS101.001");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "EnrollStudentInCourse Bullwinkle CS101.001\n";
    cout <<  "Should fail, i.e. do nothing, since Bullwinkle is not a student.\n";
    registrar.enrollStudentInCourse("Bullwinkle", "CS101.001");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "CancelCourse CS102.001\n";
    registrar.cancelCourse("CS102.001");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "ChangeStudentName FritzTheCat MightyMouse\n";
    registrar.changeStudentName("FritzTheCat", "MightyMouse");
    cout << registrar << endl;  // or registrar.printReport()
     
    cout << "DropStudentFromCourse MightyMouse CS101.001\n";
    registrar.dropStudentFromCourse("MightyMouse", "CS101.001");
    cout << registrar << endl;  // or registrar.printReport()
     
    cout << "RemoveStudent FritzTheCat\n";
    registrar.removeStudent("FritzTheCat");
    cout << registrar << endl;  // or registrar.printReport()
    
    cout << "Purge for start of next semester\n";
    registrar.purge();
    cout << registrar << endl;  // or registrar.printReport()
}
예제 #11
0
int main(int argc, char *argv[])
{
    const Resource::Type LIQUID_STATE = 1;
    const Resource::Type SOLID_STATE = 2;
    const Resource::Type GAS_STATE = 3;
    const Resource::Type PLASMA_STATE = 4;

    Resource::Info fuelInfo(Resource::INVALID_RESOURCE, LIQUID_STATE);
    Resource::Info energyInfo(Resource::INVALID_RESOURCE, PLASMA_STATE);
    Resource::Info waterInfo(Resource::INVALID_RESOURCE, LIQUID_STATE);
    Resource::Info oxygenInfo(Resource::INVALID_RESOURCE, GAS_STATE);

    SimSys::System system;
    Registrar registrar;

    registrar.registerResource("fuel", fuelInfo);
    registrar.registerResource("energy", energyInfo);
    registrar.registerResource("water", waterInfo);
    registrar.registerResource("oxygen", oxygenInfo);

    /*
    ResourceTank *fuelTank = new ResourceTank(1000, registrar.getInfo("fuel"), registrar);
    ResourceTank *waterTank = new ResourceTank(1000, registrar.getInfo("water"), registrar);
    ResourceTank *capacitor = new ResourceTank(500, registrar.getInfo("energy"), registrar);
    ResourceTank *oxygenTank = new ResourceTank(500, registrar.getInfo("oxygen"), registrar);
    Generator *generator = new Generator(registrar);
    LifeSupport *lifeSupport = new LifeSupport(registrar);
    Ventilation *ventilation = new Ventilation(registrar);

    Pipe *fuelToGenerator = new Pipe(generator->getInput("fuel-in"), Generator::FUEL_PER_GENERATION * 2, Generator::FUEL_PER_GENERATION / 2);
    fuelTank->getOutput("out-port")->connect(fuelToGenerator);
    Pipe *energyToCapacitor = new Pipe(capacitor->getInput("in-port"), Generator::ENERGY_PER_GENERATION * 2, Generator::FUEL_PER_GENERATION / 2);
    generator->getOutput("energy-out")->connect(energyToCapacitor);
    Pipe *capacitorToLifeSupport = new Pipe(lifeSupport->getInput("energy-in"), LifeSupport::ENERGY_NEEDED * 2, LifeSupport::ENERGY_NEEDED / 2);
    capacitor->getOutput("out-port")->connect(capacitorToLifeSupport);
    Pipe *waterToLifeSupport = new Pipe(lifeSupport->getInput("water-in"), LifeSupport::WATER_NEEDED * 2, LifeSupport::WATER_NEEDED / 2);
    waterTank->getOutput("out-port")->connect(waterToLifeSupport);
    Pipe *lifeSupportToOxygen = new Pipe(oxygenTank->getInput("in-port"), LifeSupport::OXYGEN_GENERATED * 2, LifeSupport::OXYGEN_GENERATED / 2);
    lifeSupport->getOutput("oxygen-out")->connect(lifeSupportToOxygen);
    Pipe *oxygenToVentilation = new Pipe(ventilation->getInput("oxygen-in"), Ventilation::OXYGEN_NEEDED * 2, Ventilation::OXYGEN_NEEDED / 2);
    oxygenTank->getOutput("out-port")->connect(oxygenToVentilation);

    fuelTank->getInput("in-port")->sink(registrar.getResource("fuel", 1000));
    waterTank->getInput("in-port")->sink(registrar.getResource("water", 1000));

    system.add(fuelTank);
    system.add(waterTank);
    system.add(capacitor);
    system.add(oxygenTank);
    system.add(generator);
    system.add(lifeSupport);
    system.add(ventilation);

    system.add(fuelToGenerator);
    system.add(energyToCapacitor);
    system.add(capacitorToLifeSupport);
    system.add(waterToLifeSupport);
    system.add(lifeSupportToOxygen);
    system.add(oxygenToVentilation);
    */

    /*
    Builtin::DigitalInput *inputOne = new Builtin::DigitalInput(true);
    Builtin::DigitalInput *inputTwo = new Builtin::DigitalInput(false);

    Builtin::XorGate2 *xorGate = new Builtin::XorGate2();
    Builtin::OrGate2 *orGate = new Builtin::OrGate2();

    Builtin::DigitalProbe *outputProbe = new PrintProbe("xor gate");

    inputOne->getOutput("digital-out")->connectTo(xorGate->getInput("A"));
    inputTwo->getOutput("digital-out")->connectTo(orGate->getInput("A"));
    xorGate->getOutput("Q")->connectTo(outputProbe->getInput("digital-in"));
    xorGate->getOutput("Q")->connectTo(orGate->getInput("B"));
    orGate->getOutput("Q")->connectTo(xorGate->getInput("B"));

    system.add(inputOne);
    system.add(inputTwo);
    system.add(xorGate);
    system.add(orGate);
    system.add(outputProbe);
    */


    // resource layer
    Generator *generator = new Generator(registrar);
    Capacitor *capacitor = new Capacitor(registrar);
    // control layer
    HysterisisController *controller = new HysterisisController(0.75f, 0.99f);
    Builtin::DigitalProbe *probe = new PrintProbe("controller");
    // create pipes
    Pipe *generatorToCapacitor = new Pipe(capacitor->getInput("energy-in"), Testing::Generator::ENERGY_PER_GENERATION * 2, Testing::Generator::ENERGY_PER_GENERATION);
    // connect pipes
    generator->getOutput("energy-out")->connect(generatorToCapacitor);
    // connect controls
    capacitor->getOutputPin("readout")->connectTo(controller->getInputPin("value"));
    controller->getOutputPin("control")->connectTo(generator->getInputPin("enable"));
    controller->getOutputPin("control")->connectTo(probe->getInputPin("digital-in"));
    // add to system
    system.add(generator);
    system.add(capacitor);
    system.add(controller);
    system.add(probe);
    system.add(generatorToCapacitor);

    const long thinkRate = 2;
    const long thinkDelay = 1000 / thinkRate;
    long nextThink = clock();

    const long statisticDelay = 5; // seconds
    const long statDelayMs = statisticDelay * 1000;
    long nextStatistics = clock() + statDelayMs;
    long stepsSoFar = 0;
    long stepsPerSecond = 0;

    while(system.isAwake())
    {
        if(clock() >= nextThink)
        {
            cout << "think" << endl;
            system.think();
            stepsSoFar ++;
            nextThink += thinkDelay;
        }

        if(clock() >= nextStatistics)
        {
            stepsPerSecond = stepsSoFar / statisticDelay;
            stepsSoFar = 0;
            cout << "steps/s: " << stepsPerSecond << endl;
            nextStatistics += statDelayMs;
        }
    }

    cout << "press enter to exit..." << endl;
    cin.get();

    return 0;
}
예제 #12
0
 Generator(const Registrar &registrar)
     : mRegistrar(registrar), mEnabled(false)
 {
     addInputPin("enable", new InputPin(this));
     addOutput("energy-out", new SourceConnector(registrar.getInfo("energy"), Testing::Generator::ENERGY_PER_GENERATION));
 }