/* * @brief Reset the data to be displayed. Remove model evaluation curves */ void DisplayControl::updateSliceForFitting() { try { // check the workspace is registered in the Analysis Data Service auto workspace = Mantid::API::AnalysisDataService::Instance() .retrieveWS<Mantid::API::MatrixWorkspace>(m_dataShownName); // delete the workspace being shown auto deleteWsAlg = Mantid::API::AlgorithmManager::Instance().create("DeleteWorkspace"); deleteWsAlg->initialize(); deleteWsAlg->setChild(true); deleteWsAlg->setLogging(false); deleteWsAlg->setProperty("Workspace", m_dataShownName); deleteWsAlg->execute(); } catch (Mantid::Kernel::Exception::NotFoundError &) { } if (m_displayModelFit->hasCurve(curveType::fit)) { m_displayModelFit->removeSpectrum(curveType::fit); m_displayModelFit->removeSpectrum(curveType::residuals); } // create the data workspace to be shown auto dataX = m_inputDataControl->selectedDataX(); auto dataY = m_inputDataControl->selectedDataY(); auto dataE = m_inputDataControl->selectedDataE(); auto energy = m_inputDataControl->getSelectedEnergy(); std::ostringstream energyLabelStream; energyLabelStream << energy; // create internal workspace containing the non-zero signal auto createWsAlg = Mantid::API::AlgorithmManager::Instance().create("CreateWorkspace"); createWsAlg->initialize(); createWsAlg->setChild(true); createWsAlg->setLogging(false); createWsAlg->setProperty("OutputWorkspace", m_dataShownName); createWsAlg->setProperty("NSpec", 1); createWsAlg->setProperty("DataX", dataX); createWsAlg->setProperty("DataY", dataY); createWsAlg->setProperty("DataE", dataE); createWsAlg->setProperty("UnitX", "MomentumTransfer"); createWsAlg->setProperty("VerticalAxisUnit", "DeltaE"); createWsAlg->setProperty("VerticalAxisValues", energyLabelStream.str()); createWsAlg->execute(); Mantid::API::MatrixWorkspace_sptr m_dataShown = createWsAlg->getProperty("OutputWorkspace"); Mantid::API::AnalysisDataService::Instance().add(m_dataShownName, m_dataShown); // show the workspace with appropriate range selector m_displayModelFit->addSpectrum(curveType::data, m_dataShown); auto curveRange = m_displayModelFit->getCurveRange(curveType::data); auto rangeSelectorFit = m_displayModelFit->m_rangeSelector.at(dcRange::fit); rangeSelectorFit->setRange(curveRange.first, curveRange.second); rangeSelectorFit->setMinimum(curveRange.first); rangeSelectorFit->setMaximum(curveRange.second); // emit signalRangeSelectorFitUpdated(); }
void SceneObjectImplementation::initializeTransientMembers() { ManagedObjectImplementation::initializeTransientMembers(); // FIXME: temp hack server = Core::lookupObject<ZoneProcessServer>("ZoneProcessServer").get(); templateObject = TemplateManager::instance()->getTemplate(serverObjectCRC); if (templateObject != NULL) { containerComponent = cast<ContainerComponent*>(templateObject->getContainerComponent()); String zoneComponentClassName = templateObject->getZoneComponent(); zoneComponent = ComponentManager::instance()->getComponent<ZoneComponent*>(zoneComponentClassName); if (zoneComponent == NULL) { zoneComponent = ComponentManager::instance()->getComponent<ZoneComponent*>("ZoneComponent"); } objectMenuComponent = cast<ObjectMenuComponent*>(templateObject->getObjectMenuComponent()); } if(dataObjectComponent != NULL) { dataObjectComponent->setParent(_this.get()); dataObjectComponent->initializeTransientMembers(); } movementCounter = 0; setGlobalLogging(true); setLogging(false); setLoggingName("SceneObject"); }
ITableWorkspace_sptr ReflCatalogSearcher::search(const std::string &text) { auto sessions = CatalogManager::Instance().getActiveSessions(); if (sessions.empty()) throw std::runtime_error("You are not logged into any catalogs."); const std::string sessionId = sessions.front()->getSessionId(); auto algSearch = AlgorithmManager::Instance().create("CatalogGetDataFiles"); algSearch->initialize(); algSearch->setChild(true); algSearch->setLogging(false); algSearch->setProperty("Session", sessionId); algSearch->setProperty("InvestigationId", text); algSearch->setProperty("OutputWorkspace", "_ReflSearchResults"); algSearch->execute(); ITableWorkspace_sptr results = algSearch->getProperty("OutputWorkspace"); // Now, tidy up the data std::set<size_t> toRemove; for (size_t i = 0; i < results->rowCount(); ++i) { std::string &run = results->String(i, 0); // Too short to be more than ".raw or .nxs" if (run.size() < 5) { toRemove.insert(i); } } // Sets are sorted so if we go from back to front we won't trip over ourselves for (auto row = toRemove.rbegin(); row != toRemove.rend(); ++row) results->removeRow(*row); return results; }
TemplateManager::TemplateManager() { setLogging(false); setGlobalLogging(true); setLoggingName("TemplateManager"); // preload lua files for component checks DirectorManager::instance()->getLuaInstance(); registerTemplateObjects(); luaTemplatesInstance = new Lua(); luaTemplatesInstance->init(); templateCRCMap = new TemplateCRCMap(); clientTemplateCRCMap = new ClientTemplateCRCMap(); portalLayoutMap = new PortalLayoutMap(); floorMeshMap = new FloorMeshMap(); appearanceMap = new AppearanceMap(); registerFunctions(); registerGlobals(); loadTreArchive(); loadSlotDefinitions(); loadPlanetMapCategories(); loadAssetCustomizationManager(); }
Socket::Socket(struct ev_loop* loop, int fd, int af) : loop_(loop), watcher_(loop), timer_(loop), startedAt_(ev_now(loop)), lastActivityAt_(ev_now(loop)), fd_(fd), addressFamily_(af), secure_(false), state_(Operational), mode_(None), tcpCork_(false), remoteIP_(), remotePort_(0), localIP_(), localPort_(), callback_(nullptr), callbackData_(0) { #ifndef NDEBUG setLogging(false); static std::atomic<unsigned long long> id(0); setLoggingPrefix("Socket(%d, %s:%d)", ++id, remoteIP().c_str(), remotePort()); #endif TRACE("created. fd:%d, local(%s:%d)", fd_, localIP().c_str(), localPort()); watcher_.set<Socket, &Socket::io>(this); timer_.set<Socket, &Socket::timeout>(this); }
PingServer::PingServer() : DatagramServiceThread("PingServer") { //setLockName("PingServerLock"); setHandler(this); setLogging(false); }
void CalculateCarpenterSampleCorrection::deleteWorkspace( MatrixWorkspace_sptr workspace) { auto alg = this->createChildAlgorithm("DeleteWorkspace"); alg->initialize(); alg->setChild(true); alg->setLogging(false); alg->setProperty("Workspace", workspace); alg->execute(); }
ITableWorkspace_sptr ReflCatalogSearcher::search(const std::string& text, const std::string& instrument) { auto sessions = CatalogManager::Instance().getActiveSessions(); if(sessions.empty()) throw std::runtime_error("You are not logged into any catalogs."); const std::string sessionId = sessions.front()->getSessionId(); auto algSearch = AlgorithmManager::Instance().create("CatalogGetDataFiles"); algSearch->initialize(); algSearch->setChild(true); algSearch->setLogging(false); algSearch->setProperty("Session", sessionId); algSearch->setProperty("InvestigationId", text); algSearch->setProperty("OutputWorkspace", "_ReflSearchResults"); algSearch->execute(); ITableWorkspace_sptr results = algSearch->getProperty("OutputWorkspace"); //Now, tidy up the data std::set<size_t> toRemove; for(size_t i = 0; i < results->rowCount(); ++i) { std::string& run = results->String(i,0); //Too short to be more than ".raw" if(run.size() < 5) { toRemove.insert(i); } //If this isn't the right instrument, remove it else if(run.substr(0, instrument.size()) != instrument) { toRemove.insert(i); } //If it's not a raw file, remove it else if(run.substr(run.size() - 4, 4) != ".raw") { toRemove.insert(i); } //It's a valid run, so let's trim the instrument prefix and ".raw" suffix run = run.substr(instrument.size(), run.size() - (instrument.size() + 4)); //Let's also get rid of any leading zeros size_t numZeros = 0; while(run[numZeros] == '0') numZeros++; run = run.substr(numZeros, run.size() - numZeros); } //Sets are sorted so if we go from back to front we won't trip over ourselves for(auto row = toRemove.rbegin(); row != toRemove.rend(); ++row) results->removeRow(*row); return results; }
LoginPacketHandler::LoginPacketHandler(const String& s, LoginProcessServerImplementation* serv) : Logger(s) { processServer = serv; server = processServer->getLoginServer(); setGlobalLogging(true); setLogging(true); }
// Destructor. Messages::~Messages (void) { // Turn off and close logging. setLogging(false); // No more notifications. if (m_pStdoutNotifier) delete m_pStdoutNotifier; // No need to delete child widgets, Qt does it all for us. }
DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::string> config) :AbstractSource(engine,config),thread(NULL),shared(NULL),playback(false),playbackShared(NULL), playbackMultiplier(1) { databaseName = "storage"; tablename = "data"; tablecreate = "CREATE TABLE IF NOT EXISTS data (key TEXT, value BLOB, source TEXT, time REAL, sequence REAL)"; if(config.find("databaseFile") != config.end()) { setDatabaseFileName(config["databaseFile"]); } if(config.find("bufferLength") != config.end()) { bufferLength = atoi(config["bufferLength"].c_str()); } if(config.find("properties") != config.end()) { parseConfig(); } for(auto itr=propertiesToSubscribeTo.begin();itr!=propertiesToSubscribeTo.end();itr++) { engine->subscribeToProperty(*itr,this); } mSupported.push_back(DatabaseFile); mSupported.push_back(DatabaseLogging); mSupported.push_back(DatabasePlayback); routingEngine->setSupported(supported(), this); if(config.find("startOnLoad")!= config.end()) { setLogging(true); } if(config.find("playbackMultiplier")!= config.end()) { playbackMultiplier = boost::lexical_cast<uint>(config["playbackMultiplier"]); } if(config.find("playbackOnLoad")!= config.end()) { setPlayback(true); } }
SceneObject::SceneObject(LuaObject* templateData) : Logger("SceneObject") { parent = NULL; objectID = 0; slottedObjects.setNullValue(NULL); objectName.setStringId(String(templateData->getStringField("objectName"))); detailedDescription.setStringId(String(templateData->getStringField("detailedDescription"))); containerType = templateData->getIntField("containerType"); containerVolumeLimit = templateData->getIntField("containerVolumeLimit"); gameObjectType = templateData->getIntField("gameObjectType"); objectCRC = templateData->getIntField("clientObjectCRC"); LuaObject arrangements = templateData->getObjectField("arrangementDescriptors"); for (int i = 1; i <= arrangements.getTableSize(); ++i) { arrangementDescriptors.add(arrangements.getStringAt(i)); } arrangements.pop(); LuaObject slots = templateData->getObjectField("slotDescriptors"); for (int i = 1; i <= slots.getTableSize(); ++i) { slotDescriptors.add(slots.getStringAt(i)); } slots.pop(); containmentType = 4; initializePosition(0.f, 0.f, 0.f); movementCounter = 0; setGlobalLogging(true); setLogging(false); String fullPath; objectName.getFullPath(fullPath); client = NULL; zone = NULL; info("created " + fullPath); }
HeightMap::HeightMap() : ReadWriteLock("HeightMap"), Logger() { planes = (HeightMapPlane**) malloc(PLANESSIZE * PLANESSIZE * sizeof(HeightMapPlane*)); for (int i = 0; i < PLANESSIZE * PLANESSIZE; ++i) { planes[i] = NULL; } reader = NULL; file = NULL; setLoggingName("HeightMap"); setLogging(false); setGlobalLogging(true); }
NameManager::NameManager() { setLoggingName("NameManager"); initialize(); profaneNames = new Vector<String>(55, 5); //based on the original number of banned words developerNames = new BannedNameSet(); reservedNames = new BannedNameSet(); fictionNames = new BannedNameSet(); fillNames(); setLogging(false); }
CreatureTemplateManager::CreatureTemplateManager() : Logger("CreatureTemplateManager") { /*setLogging(false); setGlobalLogging(true);*/ //setLoggingName("CreatureTemplateManager"); lua = new Lua(); lua->init(); if (DEBUG_MODE) { setLogging(true); lua->setLogging(true); } hashTable.setNullValue(NULL); lua_register(lua->getLuaState(), "includeFile", includeFile); lua_register(lua->getLuaState(), "addTemplate", addTemplate); lua_register(lua->getLuaState(), "addWeapon", addWeapon); lua_register(lua->getLuaState(), "addDynamicGroup", addDynamicGroup); lua_register(lua->getLuaState(), "addStaticGroup", addStaticGroup); lua_register(lua->getLuaState(), "addConversationTemplate", addConversationTemplate); lua_register(lua->getLuaState(), "addLairTemplate", addLairTemplate); lua_register(lua->getLuaState(), "addLairGroup", addLairGroup); lua_register(lua->getLuaState(), "addDestroyMissionGroup", addDestroyMissionGroup); lua_register(lua->getLuaState(), "addPatrolPathTemplate", addPatrolPathTemplate); lua_register(lua->getLuaState(), "addOutfitGroup", addOutfitGroup); lua->setGlobalInt("NONE", CreatureFlag::NONE); lua->setGlobalInt("ATTACKABLE", CreatureFlag::ATTACKABLE); lua->setGlobalInt("AGGRESSIVE", CreatureFlag::AGGRESSIVE); lua->setGlobalInt("OVERT", CreatureFlag::OVERT); lua->setGlobalInt("TEF", CreatureFlag::TEF); lua->setGlobalInt("PLAYER", CreatureFlag::PLAYER); lua->setGlobalInt("ENEMY", CreatureFlag::ENEMY); lua->setGlobalInt("CHANGEFACTIONSTATUS", CreatureFlag::CHANGEFACTIONSTATUS); lua->setGlobalInt("BLINK_GREEN", CreatureFlag::BLINK_GREEN); lua->setGlobalInt("PACK", CreatureFlag::PACK); lua->setGlobalInt("HERD", CreatureFlag::HERD); lua->setGlobalInt("KILLER", CreatureFlag::KILLER); lua->setGlobalInt("STALKER", CreatureFlag::STALKER); lua->setGlobalInt("BABY", CreatureFlag::BABY); lua->setGlobalInt("LAIR", CreatureFlag::LAIR); lua->setGlobalInt("HEALER", CreatureFlag::HEALER); lua->setGlobalInt("CARNIVORE", CreatureFlag::CARNIVORE); lua->setGlobalInt("HERBIVORE", CreatureFlag::HERBIVORE); }
void ConnectionBaseWidget::syncControls(core::IConnectionSettingsBase* connection) { if (connection) { core::connection_path_t path = connection->Path(); setConnectionName(common::ConvertFromString<QString>(path.Name())); std::string ns_separator = connection->NsSeparator(); std::string delemitr = connection->Delimiter(); namespaceSeparator_->setCurrentText( StableCommandLine(common::ConvertFromString<QString>(ns_separator))); delimiter_->setCurrentText(StableCommandLine(common::ConvertFromString<QString>(delemitr))); setUIFolderText(common::ConvertFromString<QString>(path.Directory())); setLogging(connection->IsLoggingEnabled()); setLoggingInterval(connection->LoggingMsTimeInterval()); } }
ZoneServerImplementation::ZoneServerImplementation(ConfigManager* config) : ManagedServiceImplementation(), Logger("ZoneServer") { configManager = config; galaxyID = config->getZoneGalaxyID(); galaxyName = "Core3"; processor = NULL; serverCap = 3000; phandler = NULL; datagramService = new DatagramServiceThread("ZoneServer"); datagramService->setLogging(false); datagramService->setLockName("ZoneServerLock"); objectManager = NULL; playerManager = NULL; chatManager = NULL; radialManager = NULL; resourceManager = NULL; craftingManager = NULL; lootManager = NULL; stringIdManager = NULL; creatureTemplateManager = NULL; guildManager = NULL; cityManager = NULL; petManager = NULL; totalSentPackets = 0; totalResentPackets = 0; currentPlayers = 0; maximumPlayers = 0; totalPlayers = 0; totalDeletedPlayers = 0; serverState = OFFLINE; deleteNavAreas = false; setLogging(true); }
void SceneObjectImplementation::initializePrivateData() { pendingTasks = NULL; objectActiveSessions.setNullValue(NULL); objectActiveSessions.setNoDuplicateInsertPlan(); server = NULL; templateObject = NULL; parent = NULL; sendToClient = true; movementCounter = 0; serverObjectCRC = 0; clientObjectCRC = 0; planetMapCategory = 0; planetMapSubCategory = 0; gameObjectType = 0; containmentType = 4; initializePosition(0.f, 0.f, 0.f); movementCounter = 0; staticObject = false; zone = NULL; containerType = 0; containerVolumeLimit = 0; containmentType = 0; setGlobalLogging(true); setLogging(false); setLoggingName("SceneObject"); childObjects.setNoDuplicateInsertPlan(); }
PathFinderManager::PathFinderManager() : Logger("PathFinderManager"), m_navQuery(destroyNavMeshQuery) { setFileLogger("log/pathfinder.log"); setLogJSON(ConfigManager::instance()->getPathfinderLogJSON()); m_filter.setIncludeFlags(SAMPLE_POLYFLAGS_ALL ^ (SAMPLE_POLYFLAGS_DISABLED)); m_filter.setExcludeFlags(0); m_filter.setAreaCost(SAMPLE_POLYAREA_GROUND, 1.0f); m_filter.setAreaCost(SAMPLE_POLYAREA_WATER, 15.0f); m_filter.setAreaCost(SAMPLE_POLYAREA_ROAD, 1.0f); m_filter.setAreaCost(SAMPLE_POLYAREA_DOOR, 1.0f); m_filter.setAreaCost(SAMPLE_POLYAREA_GRASS, 2.0f); m_filter.setAreaCost(SAMPLE_POLYAREA_JUMP, 1.5f); m_spawnFilter.setIncludeFlags(SAMPLE_POLYFLAGS_ALL ^ (SAMPLE_POLYFLAGS_DISABLED | SAMPLE_POLYFLAGS_SWIM)); m_spawnFilter.setAreaCost(SAMPLE_POLYAREA_GROUND, 1.0f); m_spawnFilter.setExcludeFlags(0); setLogging(true); }
void CityRegionImplementation::initialize() { zoningEnabled = true; registered = false; cityTreasury = 0; cityRank = RANK_CLIENT; //Default to client city cityHall = NULL; mayorID = 0; shuttleID = 0; hasShuttle = false; zone = NULL; cityUpdateEvent = NULL; citizenAssessmentEvent = NULL; assessmentPending = false; zoningRights.setAllowOverwriteInsertPlan(); zoningRights.setNullValue(0); cityMissionTerminals.setNoDuplicateInsertPlan(); citySkillTrainers.setNoDuplicateInsertPlan(); bazaars.setNoDuplicateInsertPlan(); bazaars.setNullValue(NULL); setLoggingName("CityRegion"); setLogging(true); }
PlayerCreationManager::PlayerCreationManager() : Logger("PlayerCreationManager") { setLogging(true); setGlobalLogging(false); zoneServer = ServerCore::getZoneServer(); racialCreationData.setNoDuplicateInsertPlan(); professionDefaultsInfo.setNoDuplicateInsertPlan(); hairStyleInfo.setNoDuplicateInsertPlan(); startingCash = 100; startingBank = 1000; freeGodMode = false; loadRacialCreationData(); loadDefaultCharacterItems(); loadProfessionDefaultsInfo(); loadHairStyleInfo(); loadLuaConfig(); }
FactionManager::FactionManager() { setLoggingName("FactionManager"); setGlobalLogging(false); setLogging(false); }
ZonePacketHandler::ZonePacketHandler(const String& s, Zone * z) : Logger(s) { zone = z; setLogging(true); setGlobalLogging(true); }
SuiManager::SuiManager() : Logger("SuiManager") { server = NULL; setGlobalLogging(true); setLogging(false); }
int main (int argc, char *argv[]) { //auto p1 = Polynomial<Integer>{-5, 2, 8, -3, -3, 0, 1, 0, 1}; //auto p1 = Polynomial<Integer>{1}; //auto p2 = Polynomial<Integer>{21, -9, -4, 0, 5, 0, 3}; //auto p1 = Polynomial<Integer, 2>({Monomial<Integer, 2>(1, {1, 0})}); //auto p2 = Polynomial<Integer, 2>({Monomial<Integer, 2>(1, {0, 1})}); /*// x^2 - y^2 auto p1 = Polynomial<Integer, 2> { Monomial<Integer, 2>(1, {2, 0}), Monomial<Integer, 2>(-1, {0, 2}), }; auto p2 = Polynomial<Integer, 2> { Monomial<Integer, 2>(2, {1, 1}), };*/ // z^3 /* auto p1 = Polynomial<Integer, 2> { Monomial<Integer, 2>(1, {3, 0}), Monomial<Integer, 2>(-3, {1, 2}), }; auto p2 = Polynomial<Integer, 2> { Monomial<Integer, 2>(3, {2, 1}), Monomial<Integer, 2>(-1, {0, 3}), };*/ const unsigned int d = 2; /* auto m1 = std::list<Monomial<Integer, d>>(); auto m2 = std::list<Monomial<Integer, d>>(); unsigned int n = 3; for (unsigned int k = 0; k <= n; ++k) { if (k & 1<<0) { if (k & 1<<1) { auto exps = std::array<unsigned int, d> { n-k, k }; m2.push_back(Monomial<Integer, d>(-binom(n, k), exps)); } else { auto exps = std::array<unsigned int, d> { n-k, k }; m2.push_back(Monomial<Integer, d>(binom(n, k), exps)); } } else { if (k & 1<<1) { auto exps = std::array<unsigned int, d> { n-k, k }; m1.push_back(Monomial<Integer, d>(-binom(n, k), exps)); } else { auto exps = std::array<unsigned int, d> { n-k, k }; m1.push_back(Monomial<Integer, d>(binom(n, k), exps)); } } } */ auto p1 = Polynomial<Integer, d> { Monomial<Integer, d>(1, {1, 0}) }; auto p2 = Polynomial<Integer, d> { Monomial<Integer, d>(1, {0, 1}) }; /*auto p3 = Polynomial<Integer, d> { Monomial<Integer, d>(1, {0, 0, 1, 0}) }; auto p4 = Polynomial<Integer, d> { Monomial<Integer, d>(1, {0, 0, 0, 1}) }; */ //auto pseq = prem_seq(p1, p2); std::array<Polynomial<Integer, d>, d + 1> Pvec = { Polynomial<Integer, d>::One(), p1, p2 }; std::array<Interval<Integer>, d> Ivec = { Interval<Integer>(0, 1), Interval<Integer>(0, 1), }; auto index = Index<Integer, Integer, d>(Pvec, Ivec); index.setLogging(true); Rational idx = index.calc_idx(); std::cout << "Calculated index: " << idx << std::endl; /*std::cout << index << std::endl; for (auto p : pseq) { std::cout << p << std::endl; }*/ }
int NDBT_TestSuite::execute(int argc, const char** argv){ int res = NDBT_FAILED; /* Arguments: Run only a subset of tests -n testname Which test to run Recommendations to test functions: --records Number of records to use(default: 10000) --loops Number of loops to execute in the test(default: 100) Other parameters should: * be calculated from the above two parameters * be divided into different test cases, ex. one testcase runs with FragmentType = Single and another perfoms the same test with FragmentType = Large * let the test case iterate over all/subset of appropriate parameters ex. iterate over FragmentType = Single to FragmentType = AllLarge Remeber that the intention is that it should be _easy_ to run a complete test suite without any greater knowledge of what should be tested ie. keep arguments at a minimum */ char **_argv= (char **)argv; if (!my_progname) my_progname= _argv[0]; ndb_opt_set_usage_funcs(short_usage_sub, usage); ndb_load_defaults(NULL, load_default_groups,&argc,&_argv); // Save pointer to memory allocated by 'ndb_load_defaults' char** defaults_argv= _argv; int ho_error; #ifndef DBUG_OFF opt_debug= "d:t:i:F:L"; #endif if ((ho_error=handle_options(&argc, &_argv, my_long_options, ndb_std_get_one_option))) { usage(); ndb_free_defaults(defaults_argv); return NDBT_ProgramExit(NDBT_WRONGARGS); } if (opt_verbose) setOutputLevel(2); // Show g_info else setOutputLevel(0); // Show only g_err ? records = opt_records; loops = opt_loops; timer = opt_timer; if (opt_nologging) setLogging(false); temporaryTables = opt_temporary; m_noddl = opt_noddl; m_forceShort = opt_forceShort; if (opt_seed == 0) { opt_seed = (unsigned)NdbTick_CurrentMillisecond(); } ndbout_c("random seed: %u", opt_seed); srand(opt_seed); srandom(opt_seed); global_flag_skip_invalidate_cache = 1; int num_tables= argc; if (argc == 0) num_tables = NDBT_Tables::getNumTables(); for(int i = 0; i<num_tables; i++) { if (argc == 0) m_tables_in_test.push_back(NDBT_Tables::getTable(i)->getName()); else m_tables_in_test.push_back(_argv[i]); } if (m_createTable) { for (unsigned t = 0; t < tests.size(); t++) { const char* createFuncName= NULL; NDBT_TESTFUNC* createFunc= NULL; const char* dropFuncName= NULL; NDBT_TESTFUNC* dropFunc= NULL; if (!m_noddl) { createFuncName= m_createAll ? "runCreateTable" : "runCreateTable"; createFunc= m_createAll ? &runCreateTables : &runCreateTable; dropFuncName= m_createAll ? "runDropTables" : "runDropTable"; dropFunc= m_createAll ? &runDropTables : &runDropTable; } else { /* No DDL allowed, so we substitute 'do nothing' variants * of the create + drop table test procs */ createFuncName= "runCheckTableExists"; createFunc= &runCheckTableExists; dropFuncName= "runEmptyDropTable"; dropFunc= &runEmptyDropTable; } NDBT_TestCaseImpl1* pt= (NDBT_TestCaseImpl1*)tests[t]; NDBT_Initializer* pti = new NDBT_Initializer(pt, createFuncName, *createFunc); pt->addInitializer(pti, true); NDBT_Finalizer* ptf = new NDBT_Finalizer(pt, dropFuncName, *dropFunc); pt->addFinalizer(ptf); } for (unsigned t = 0; t < explicitTests.size(); t++) { const char* createFuncName= NULL; NDBT_TESTFUNC* createFunc= NULL; const char* dropFuncName= NULL; NDBT_TESTFUNC* dropFunc= NULL; if (!m_noddl) { createFuncName= m_createAll ? "runCreateTable" : "runCreateTable"; createFunc= m_createAll ? &runCreateTables : &runCreateTable; dropFuncName= m_createAll ? "runDropTables" : "runDropTable"; dropFunc= m_createAll ? &runDropTables : &runDropTable; } else { /* No DDL allowed, so we substitute 'do nothing' variants * of the create + drop table test procs */ createFuncName= "runCheckTableExists"; createFunc= &runCheckTableExists; dropFuncName= "runEmptyDropTable"; dropFunc= &runEmptyDropTable; } NDBT_TestCaseImpl1* pt= (NDBT_TestCaseImpl1*)explicitTests[t]; NDBT_Initializer* pti = new NDBT_Initializer(pt, createFuncName, *createFunc); pt->addInitializer(pti, true); NDBT_Finalizer* ptf = new NDBT_Finalizer(pt, dropFuncName, *dropFunc); pt->addFinalizer(ptf); } } if (opt_print == true){ printExecutionTree(); ndb_free_defaults(defaults_argv); return 0; } if (opt_print_html == true){ printExecutionTreeHTML(); ndb_free_defaults(defaults_argv); return 0; } if (opt_print_cases == true){ printCases(); ndb_free_defaults(defaults_argv); return 0; } Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid); if(m_connect_cluster && con.connect(12, 5, 1)) { ndb_free_defaults(defaults_argv); return NDBT_ProgramExit(NDBT_FAILED); } if(argc == 0){ // No table specified res = executeAll(con, opt_testname); } else { testSuiteTimer.doStart(); for(int i = 0; i<argc; i++){ executeOne(con, _argv[i], opt_testname); } testSuiteTimer.doStop(); res = report(opt_testname); } ndb_free_defaults(defaults_argv); return NDBT_ProgramExit(res); }
PathFinderManager::PathFinderManager() : Logger("PathFinderManager") { setFileLogger("log/pathfinder.log"); setLogging(true); }
static int realMain(MprCmdLine *cmdLine) { MaHttp *http; char portNumBuf[MPR_MAX_IP_PORT]; char *argp, *logSpec; int c, errflg, kill, poolThreads, outputVersion; mprSetMemHandler(memoryFailure); mprCreateMemHeap(0, 16 * 1024, MAXINT); program = mprGetBaseName(cmdLine->getArgv()[0]); poolThreads = -1; kill = errflg = 0; logSpec = 0; outputVersion = 0; autoScan = 1; background = 0; serverRoot = 0; docRoot = "web"; #if !WIN && !WINCE && !VXWORKS if (getuid()) { ipAddr = mprStrdup("4000"); } else { mprSprintf(portNumBuf, sizeof(portNumBuf), "%d", MA_SERVER_DEFAULT_PORT_NUM); ipAddr = mprStrdup(portNumBuf); } #else mprSprintf(portNumBuf, sizeof(portNumBuf), "%d", MA_SERVER_DEFAULT_PORT_NUM); ipAddr = mprStrdup(portNumBuf); #endif while ((c = cmdLine->next(&argp)) != EOF) { switch(c) { case 'A': autoScan = 0; break; case 'a': mprFree(ipAddr); ipAddr = mprStrdup(argp); break; case 'b': background++; break; case 'c': /* Ignored */ break; case 'D': mprSetDebugMode(1); break; case 'd': docRoot = argp; break; case 'f': #if BLD_FEATURE_CONFIG_PARSE configFile = argp; autoScan = 0; #else errflg++; #endif break; case 'k': kill++; logSpec = 0; break; case 'l': logSpec = (*argp) ? argp : 0; break; case 'm': mprRequestMemStats(1); break; case 'r': serverRoot = argp; break; case 't': poolThreads = atoi(argp); break; // // FUTURE -- just for test. Will be removed // case 'w': writeFile = argp; break; case 'v': outputVersion++; break; #if WIN && BLD_FEATURE_RUN_AS_SERVICE case 'i': serviceOp = MPR_INSTALL_SERVICE; if (strcmp(argp, "none") == 0) { serviceCmdLine = ""; } else if (strcmp(argp, "default") == 0) { serviceCmdLine = "-b -c -f " BLD_PRODUCT ".conf"; } else { serviceCmdLine = argp; } break; case 'g': serviceOp = MPR_GO_SERVICE; break; case 's': serviceOp = MPR_STOP_SERVICE; break; case 'u': serviceOp = MPR_UNINSTALL_SERVICE; break; #endif default: errflg++; break; } } if (errflg) { printUsage(program); return MPR_ERR_BAD_SYNTAX; } mp = new Mpr(program); mp->setAppName(BLD_PRODUCT); mp->setAppTitle(BLD_NAME); mp->setHeadless(isService || background); #if BLD_HOST_UNIX || VXWORKS initSignals(); #endif if (kill) { mp->killMpr(); delete mp; exit(0); } if (outputVersion) { printVersion(); delete mp; exit(0); } // // Create the top level HTTP service and default HTTP server // http = new MaHttp(); server = new MaServer(http, "default"); setupFileSystem(); setLogging(logSpec); // // Confirm the location of the server root // if (locateServerRoot(serverRoot) < 0) { mprError(MPR_L, MPR_USER, "Can't start server, exiting."); exit(2); } if (securityChecks(cmdLine->getArgv()[0]) < 0) { exit(3); } #if WIN #if BLD_FEATURE_RUN_AS_SERVICE if (serviceOp) { windowsServiceOps(); delete mp; return 0; } #endif if (windowsInit() < 0) { delete mp; return MPR_ERR_CANT_INITIALIZE; } #endif // // Start the MPR. This starts Timer, Socket and Pool services // if (mp->start(MPR_KILLABLE) < 0) { mprError(MPR_L, MPR_USER, "Can't start MPR for %s", mp->getAppTitle()); delete mp; return MPR_ERR_CANT_INITIALIZE; } // // Load the statically linked modules // maLoadStaticModules(); if (setupServer(http, poolThreads) < 0) { mprError(MPR_L, MPR_USER, "Can't configure the server, exiting."); exit(6); } #if BLD_FEATURE_CONFIG_SAVE if (writeFile) { server->saveConfig(writeFile); mprLog(0, "Configuration saved to %s\nExiting ...\n", writeFile); exit(0); } #endif if (http->start() < 0) { mprError(MPR_L, MPR_USER, "Can't start server, exiting."); exit(7); } else { #if LINUX && BLD_FEATURE_RUN_AS_SERVICE if (background && mp->makeDaemon(1) < 0) { mprError(MPR_L, MPR_USER, "Could not run in the background"); } else #endif { #if BLD_FEATURE_MULTITHREAD mprLog(MPR_CONFIG, "HTTP services are ready with %d pool threads\n", http->getLimits()->maxThreads); #else mprLog(MPR_CONFIG, "HTTP services are ready (single-threaded).\n"); #endif } mp->setHeadless(1); eventLoop(); mprLog(MPR_WARN, "Stopping HTTP services.\n"); http->stop(); } #if WIN if (trayIcon > 0) { closeTrayIcon(); } if (trayTimer) { trayTimer->stop(MPR_TIMEOUT_STOP); trayTimer->dispose(); trayTimer = 0; } #endif mprLog(MPR_WARN, "Stopping MPR services.\n"); mp->stop(0); maUnloadStaticModules(); delete server; delete http; delete mp; mprFree(ipAddr); #if BLD_FEATURE_ROMFS delete romFileSystem; #endif #if BLD_FEATURE_LOG mprLog(MPR_WARN, "Closing log.\n"); if (logger) { delete logger; } #if WIN if (dialog) { delete dialog; } #endif #endif return 0; }
void setStoredTable(bool x) { setLogging(x); }
void setStoredIndex(bool x) { setLogging(x); }