void Job::makeTaskIDs() { /* find maximum taskID */ int highest = 0; bool convertOK; Task *tempTask; QVector<int> needTaskID; // holds indexes of tasks that need an ID QVector<int> currentTaskIDs; // holds used IDs for (int i = 0; i < taskCount(); i++) { tempTask = getTask(i); int tempID = tempTask->getAttributeValue("TaskID").toInt(&convertOK); if (convertOK && tempID > 0 && !currentTaskIDs.contains(tempID)) { currentTaskIDs.append(tempID); if (tempID > highest) highest = tempID; } else needTaskID.append(i); } highest++; for (int i=0; i < needTaskID.size(); i++) getTask(needTaskID.at(i))->changeAttributeValue("TaskID",highest++); }
void BasicModem::run(void) { char bfr[512]; std::string line; while (!isStopping()) { if (!IO::Poll::poll(*m_handle, 1.0)) continue; size_t rv = m_handle->read(bfr, sizeof(bfr)); if (rv == 0) { IMC::IoEvent iov; iov.setSource(getTask()->getSystemId()); iov.setSourceEntity(getTask()->getEntityId()); iov.setDestinationEntity(getTask()->getEntityId()); iov.type = IMC::IoEvent::IOV_TYPE_INPUT_ERROR; getTask()->receive(&iov); break; } if (getReadMode() == READ_MODE_RAW) { for (size_t i = 0; i < rv; ++i) m_bytes.push(bfr[i]); } else { bfr[rv] = 0; m_task->spew("%s", Streams::sanitize(bfr).c_str()); for (size_t i = 0; i < rv; ++i) { m_chars.push(bfr[i]); } while (!m_chars.empty()) { if (!processInput(line)) continue; if (line.empty()) continue; if (!handleUnsolicited(line)) m_lines.push(line); } } } }
void TaskQueue::loop( util::DWORD msTimeout ) { bool exit; std::vector<Task *> tasks; // Initialize _mutex.lock(); exit = _exit = false; _mutex.unlock(); // Calculate the timeout boost::system_time timeout = msTimeout ? boost::get_system_time()+boost::posix_time::milliseconds(msTimeout) : boost::posix_time::pos_infin; // Wait for task, exit or timeout while (!exit) { //printf( "[TaskQueue %p] get task or timeout of %ldms\n", this, msTimeout ); exit = getTask( timeout, tasks ); // Run tasks BOOST_FOREACH( Task *task, tasks ) { //printf( "[TaskQueue %p] run task=%p\n", this, task ); task->run(); delete task; } tasks.clear(); }
int32_t channelSubscribe( uint32_t channelId ) { Task* t = getTask( getCurrentPid() ); return channel_subscribe( channelId, t ); }
ReviewedTest ReviewedTestSerializator::loadTest(const QString &filename) { QDomDocument xml; try { loadXmlSchema(":/xsd/xsd/reviewedtestconfig.xsd"); xml = loadXml(filename); if (!checkXml(xml)) { throw Exception(Exception::BadXMLFile, QString("Bad XML file - " + filename)); } } catch (const Exception &err) { throw; } QString title = xml.elementsByTagName("title").at(0).toElement().text(); QString version = xml.elementsByTagName("testVersion").at(0).toElement().text(); ReviewedTest test(title, version); QDomNodeList tasks = xml.elementsByTagName("task"); for (uint i = 0; i < tasks.length(); i++) { test.addTask(getTask(tasks.at(i))); } return test; }
Task * MergeFastqWorker::tick() { while (inputUrlPort->hasMessage()) { const QString url = takeUrl(); CHECK(!url.isEmpty(), NULL); inputUrls.append(url); } if (!inputUrlPort->isEnded()) { return NULL; } if(!inputUrls.isEmpty()){ const QString outputDir = FileAndDirectoryUtils::createWorkingDir(inputUrls.first(), getValue<int>(OUT_MODE_ID), getValue<QString>(CUSTOM_DIR_ID), context->workingDir()); BaseNGSSetting setting; setting.outDir = outputDir; setting.outName = getTargetName(inputUrls.first(), outputDir); setting.inputUrl = inputUrls.first(); setting.customParameters = getCustomParameters(); setting.listeners = createLogListeners(); Task *t = getTask(setting); connect(new TaskSignalMapper(t), SIGNAL(si_taskFinished(Task*)), SLOT(sl_taskFinished(Task*))); inputUrls.clear();; return t; } if (inputUrlPort->isEnded()) { setDone(); outputUrlPort->setEnded(); } return NULL; }
void parseAndLoadArgs(unsigned int procID,char *string) { struct taskStruct *t; t=getTask(procID); if(t==0) return; t->argv=(char **)(t->dataSegmentBase+t->dataSegmentSize); /* unsigned int tmp=t->dataSegmentBase+t->dataSegmentSize+4; allocMemory(procID,t->argv+user_start,5+4+1000); memcpyToTask( &tmp, 4,user_start+t->dataSegmentBase+t->dataSegmentSize,procID ); memcpyToTask( "test\0", 5,user_start+t->dataSegmentBase+t->dataSegmentSize+4,procID ); t->dataSegmentSize+=4+5; */ int n=parseArgsNum(string); t->argc=n; unsigned int *array=kmalloc(4*n); char *buffer=kmalloc(strlen(string)+1); unsigned int c,i=0,d=0; char apice=0; for(c=0; c<strlen(string); c++) { if(string[c]==' ') break; } if(c==strlen(string) || c+1==strlen(string)) { t->argc=0; kfree(array); kfree(buffer); return; } for(; c<strlen(string); c++) { if(string[c]=='\'') { apice=!apice; continue; } if(string[c]==' ' && !apice) { array[i]=t->dataSegmentBase+t->dataSegmentSize+(4*n)+d+1; i++; } else { buffer[d]=string[c]; buffer[d+1]=0; } d++; } allocMemory(procID,user_start+t->dataSegmentBase+t->dataSegmentSize,(4*n)+d+1); memcpyToTask( (char*)array, 4*n,(char*)(user_start+t->dataSegmentBase+t->dataSegmentSize),procID ); memcpyToTask( buffer, d+1,(char*)(user_start+t->dataSegmentBase+t->dataSegmentSize+(4*n)),procID ); t->dataSegmentSize+=(4*n)+d+1; kfree(array); kfree(buffer); }
int32_t receive( uint32_t channelId, MESSAGE* msg, int32_t timeout ) { Task* t = getTask( getCurrentPid() ); return channel_waitForMessage( channelId, t, timeout ); }
std::string Arguments::prepareModel() const { if (!isValid()) return ""; CCopasiDataModel* model = (*CCopasiRootContainer::getDatamodelList())[0]; model->loadModel(getFilename(), NULL); if (mDisablePlots) { for (size_t index = 0; index < model->getPlotDefinitionList()->size(); ++index) { (*model->getPlotDefinitionList())[index]->setActive(false); } } if (mClearTargets) { for (size_t index = 0; index < model->getTaskList()->size(); ++index) { (*model->getTaskList())[index]->getReport().setTarget(""); } } CCopasiTask *task = getTask(); if (task != NULL) { if (isGenerateOutput()) { // calls initialize which is private COutputAssistant::getListOfDefaultOutputDescriptions(); // generate the output COutputAssistant::createDefaultOutput(mGenerateOutput, task, model); } if (haveReportFile()) task->getReport().setTarget(mReportFile); COptTask* optTask = dynamic_cast<COptTask*>(task); if (optTask != NULL) { COptProblem *problem = (COptProblem *)optTask->getProblem(); if (mSetSolutionStatistic) optTask->setMethodType(CCopasiMethod::Statistics); if (isDisableRandomizeStartValues()) problem->setRandomizeStartValues(false); if (isDisableStatistic()) problem->setCalculateStatistics(false); } } model->saveModel(getFilename() + ".view.cps", NULL, true); return getFilename() + ".view.cps"; }
// try to restore subscriptions where possible Q_FOREACH( const Task& oldTask, oldTasks ) { const Task task = getTask( oldTask.id() ); if ( task.isValid() ) { if ( oldTask.subscribed() ) { addSubscription( user, task ); } } }
void Unix::printCallString(FILE *stream) { int argc; char **argv = getCallString(&argc); fprintf(stream, "Tool:\n %s\n\n", getTask()->getName()); fprintf(stream, "Cmd:\n%s\n", getUnixTask()->getCmd(false)); fprintf(stream, "\n"); }
/** * This is the main run-loop for each thread. * Each checks the task queue and selects one to execute. */ void DWThreadPool::dispatch() { while (_is_running) { Task task(getTask()); if (task) { task(); } } }
int main() { eeros::logger::StreamLogWriter w(std::cout); Logger::setDefaultWriter(&w); w.show(); Logger log('M'); log.trace() << "harmonic tasks example"; log.trace() << "eeros " << eeros::Version::string; eeros::Executor &executor = eeros::Executor::instance(); executor.setPeriod(1); auto ss = periodic(1, "SS", [](Logger &log) { log.trace() << (long)eeros::System::getTimeNs() << "\tSS"; }); executor.setMainTask(ss.getTask()); auto t1 = periodic(1, "t1", [](Logger &log) { static int counter = 0; log.trace() << (long)eeros::System::getTimeNs() << "\t t1"; if (++counter >= 10) { counter = 0; //sleep(4); } }); t1.periodicTask.addDefaultMonitor(); auto t2 = periodic(2, "t2", [](Logger &log) { log.trace() << (long)eeros::System::getTimeNs() << "\t t2"; }); t2.periodicTask.addDefaultMonitor(); auto t4 = periodic(4, "t4", [](Logger &log) { log.trace() << (long)eeros::System::getTimeNs() << "\t t4"; }); t2.getTask().after.push_back(t4.getTask()); t1.getTask().after.push_back(t2.getTask()); t4.periodicTask.addDefaultMonitor(); auto t3 = periodic(5, "t3", [](Logger &log) { log.trace() << (long)eeros::System::getTimeNs() << "\t t3"; }); t1.getTask().after.push_back(t3.getTask()); t3.periodicTask.addDefaultMonitor(); executor.add(t1.getTask()); executor.run(); return 0; }
void SplashScreenWidget::timerEvent(QTimerEvent *e){ getTask(); if(e->timerId()==dots_timer_id){ getDots(); } drawInfo(); update(); QObject::timerEvent(e); }
/** * \brief Retourne la liste qui correspond a un noeud du * fichier XML * \param node : pugi::xml_node, le noeud du fichier XML * \return Liste* creee depuis le fichier XML */ Liste *getList(pugi::xml_node node) { Liste *l; unsigned long int id; std::string title; std::string date; bool isChecked=false; bool ordered=false; unsigned int deep=0; for(pugi::xml_node attr = node.child(KEY_TAG); attr; attr = attr.next_sibling(KEY_TAG)) { std::string attrName=attr.attribute("name").value(); if(attrName.compare("title")==0) { title = attr.child_value(); } else if(attrName.compare("date")==0) { date = attr.child_value(); } else if(attrName.compare("isChecked")==0) { isChecked = attr.text().as_bool(); } else if(attrName.compare("isOrdered")==0) { ordered = attr.text().as_bool(); } else if(attrName.compare("deep")==0) { deep = attr.text().as_int(); } } id=node.attribute("id").as_int(); setListComponent_ID(id+1); l=new Liste(id,title,date,isChecked,ordered,deep); for(pugi::xml_node_iterator it=node.begin(); it != node.end(); ++it) { pugi::xml_node child=*it; std::string childName = child.name(); if(childName.compare(KEY_TAG)!=0) { if(childName.compare(LIST_TAG)==0) { l->add(getList(child)); } else if(childName.compare(TASK_TAG)==0) { l->add(getTask(child)); } } } return l; }
int32_t sendrcv( uint32_t channelId, MESSAGE* msg, uint32_t timeout ) { Task* t = getTask( getCurrentPid() ); if ( channel_receivesMessage( channelId, msg ) ) { return 1; } return channel_waitForMessage( channelId, t, timeout ); }
void ThreadPool::runInThread() { while(!isExit_) { Task task =getTask(); if(task!=NULL) { //task->process(); task();//执行任务 } } }
enum OpenAB_Storage::Storage::eGetItem EDSCalendarStorage::getTasks(const OpenAB::PIMItem::IDs & ids, std::vector<OpenAB::SmartPtr<OpenAB::PIMCalendarTaskItem> > & items) { for (unsigned int i = 0; i < ids.size(); ++i) { OpenAB::SmartPtr<OpenAB::PIMCalendarTaskItem> item; if (eGetItemOk != getTask(ids[i], item)) { return eGetItemFail; } items.push_back(item); } return eGetItemOk; }
//! Read the contents of the MT SBD message buffer. //! @param[in] data buffer to hold binary data. //! @param[in] data_size size of binary data buffer. //! @return number of bytes read. unsigned readBufferMT(uint8_t* data, unsigned data_size) { ReadMode saved_read_mode = getReadMode(); Counter<double> timer(getTimeout()); uint8_t bfr[2] = {0}; uint8_t ccsum[2] = {0}; unsigned length = 0; try { // Prepare to read raw data. setReadMode(READ_MODE_RAW); // Send command. sendAT("+SBDRB"); // Read incoming data length. length = getBufferSizeMT(timer); getTask()->spew("reading %u bytes of SBD binary data", length); // Read data. if (length > data_size) throw BufferTooSmall(data_size, length); if (length > 0) { readRaw(timer, data, length); computeChecksum(data, length, ccsum); } // Read and validate. readRaw(timer, bfr, 2); if ((bfr[0] != ccsum[0]) || (bfr[1] != ccsum[1])) throw Hardware::InvalidChecksum(bfr, ccsum); setReadMode(saved_read_mode); expectOK(); } catch (...) { setReadMode(saved_read_mode); throw; } return length; }
//! Send MO SBD message. //! @param[in] data data to send. //! @param[in] alert_reply true if a ring alert was received, //! false otherwise. void sendSBD(const std::vector<uint8_t>& data, bool alert_reply = false) { getTask()->debug("sending SBD with size %u", static_cast<unsigned>(data.size())); if (data.size() == 0) writeBufferMO(NULL, 0); else writeBufferMO(&data[0], data.size()); if (alert_reply) sendAT("+SBDIXA"); else sendAT("+SBDIX"); setBusy(true); }
void threadpool::runInThread() { try { while (m_running) { TaskType task( getTask() ); /// Run Task if( task ) { task(); } } } catch (const std::exception& e) { std::lock_guard<std::mutex> lock ( m_mutex_print ); std::cout << "Thread Pool Exception : " << e.what() << std::endl; } }
ThreadPool(unsigned size = std::thread::hardware_concurrency() * 1.5) { running.store(true); pool.reserve(size); for (unsigned i = 0; i < size; ++i){ pool.push_back( std::thread( [this, i](){ Log log("Thread [" + std::to_string(i) + "]"); while(running.load()){ Task& t = getTask(); try { t(); } catch (...) { log.warn("Uncaught exception!"); } } })); } }
SplashScreenWidget::SplashScreenWidget(){ setObjectName("splash_screen_widget"); Version v = Version::appVersion(); version = v.text; QImage image(":ugene/images/ugene_splash.png"); QSize widgetSize = image.size(); setFixedSize(widgetSize); image = image.scaled(widgetSize * devicePixelRatio()); image.setDevicePixelRatio(devicePixelRatio()); image1 = image2 = image; dots_number = 0; task = ""; dots_timer_id = startTimer(500); startTimer(50); getTask(); getDots(); drawInfo(); }
bool Job::generateReport(QDateTime startDate,QDateTime endDate,QString filename) { QString currentLine; QStringList sessionParts; int taskId; QMultiMap<int,taskSession> taskSessions; QFile sessionFile(attributeValues["Filename"].toString().replace(QString(".xml"),QString(".session"))); if (!sessionFile.open(QIODevice::ReadOnly | QIODevice::Text)) qDebug() << "Failed to session file!"; while (!sessionFile.atEnd()) { currentLine = QString(sessionFile.readLine()); sessionParts = currentLine.split("%"); taskSession tempsession; taskId = sessionParts.at(0).toInt(); tempsession.start = QDateTime::fromString(sessionParts.at(1),Qt::ISODate); tempsession.end = QDateTime::fromString(sessionParts.at(2),Qt::ISODate); taskSessions.insert(taskId,tempsession); } sessionFile.close(); QMap<int,int> totalTimes; QMapIterator<int,taskSession> iter(taskSessions); while (iter.hasNext()) { iter.next(); int timeSum = 0; QList<taskSession> sessions = taskSessions.values(iter.key()); for (int i = 0; i < sessions.size(); i++) { taskSession tempSession = sessions.at(i); if (tempSession.start >= startDate && tempSession.end <= endDate) // session happened completely in range timeSum += tempSession.start.secsTo(tempSession.end); else if (tempSession.start <= startDate && tempSession.end <=endDate) // started out of range, ended in range timeSum += startDate.secsTo(tempSession.end); else if (tempSession.start >= startDate && tempSession.end >= endDate) // started in range, ended out of range timeSum += tempSession.start.secsTo(endDate); else if (tempSession.start <= startDate && tempSession.end >= endDate) // continued through entire range timeSum += startDate.secsTo(endDate); } totalTimes.insert(iter.key(),timeSum); } QFile reportFile(filename); if (!reportFile.open(QIODevice::WriteOnly | QIODevice::Text)) { qDebug() << "Failed to open new report file!"; return false; } QTextStream out(&reportFile); out << "Job Session Report for " << startDate.toString() << " to " << endDate.toString() << "\n\n"; out << "Job Name: " << getAttributeValue("Name").toString() << "\n"; out << "Job Start Date: " << getAttributeValue("StartDate").toDateTime().toString() << "\n"; out << "Job End Date: " << getAttributeValue("EndDate").toDateTime().toString() << "\n\n"; Task *tempTask; int allTime = 0; QStringList completedTasksOutput; QStringList otherTasksOutput; for (int i=0;i<taskCount();i++) { tempTask = getTask(i); QString name = tempTask->getAttributeValue("Name").toString(); QString taskNum = QString::number(tempTask->getAttributeValue("TaskID").toInt()).prepend(" "); for (int j=taskNum.size(); j < 12; j++) taskNum.append(" "); for (int j=name.size(); j < 25; j++) name.append(" "); int timeSpent = totalTimes.value(tempTask->getAttributeValue("TaskID").toInt()); allTime += timeSpent; // keep track of total time for percentages QString timeTotal = QString::number(timeSpent/3600) + "hr " + QString::number((timeSpent%3600)/60) + "min " + QString::number((timeSpent%3600)%60) + "sec"; QDateTime completedDate = QDateTime::fromString(tempTask->getAttributeValue("Completed").toString(),Qt::ISODate); if (completedDate >= startDate && completedDate <= endDate) completedTasksOutput.append(QString(taskNum + name + timeTotal)); else if (timeSpent > 0) otherTasksOutput.append(QString(taskNum + name + timeTotal)); } completedTasksOutput.sort(); otherTasksOutput.sort(); out << "Tasks completed during selected time:\n\n"; out << "\tTask ID Task Name Time Spent % of Total Time\n"; out << "\t------------------------------------------------------------------------\n"; QString tempOutput; for (int i = 0; i < completedTasksOutput.size(); i++) { tempOutput = completedTasksOutput.at(i); for (int j = tempOutput.size(); j < 65; j++) tempOutput.append(" "); QString percentage = QString::number(((double)totalTimes.value(tempOutput.left(10).simplified().toInt())/(double)allTime)*100.0,'f',2); out << "\t" << tempOutput << percentage << "\n"; } out << "\n\nTasks worked on but not completed during selected time:\n\n"; out << "\tTask ID Task Name Time Spent % of Total Time\n"; out << "\t------------------------------------------------------------------------\n"; for (int i = 0; i < otherTasksOutput.size(); i++) { tempOutput = otherTasksOutput.at(i); for (int j = tempOutput.size(); j < 65; j++) tempOutput.append(" "); QString percentage = QString::number((double)(totalTimes.value(tempOutput.left(10).simplified().toInt())/(double)allTime)*100.0,'f',2); out << "\t" << tempOutput << percentage << "\n"; } reportFile.close(); return true; }
void TaskManager::init(){ remain = MAX_TASK_NUM; current = getTask(); previous = NULL; }
void TaskMap<CostInfo>::freeFromTask(Creature* c) { if (Task* t = getTask(c)) freeTask(t); }
std::list<GraphNode> AffinityTask::BFS(const TaskSet& taskSet, const GraphNode& start, const GraphNode& target, const Affinity& excludeID, const TaskSet& excludeTask) { std::list<GraphNode> returnList; //prepare link map std::unordered_map<CPUID, TaskSet> cpuToTaskList; std::unordered_map<AffinityTask*, Affinity> taskToCPUList; for(auto task : taskSet) { if(excludeTask.find(task) != excludeTask.end()) continue; Affinity affinityCopy(task->affinity); for(auto cpu : excludeID) affinityCopy.erase(cpu); taskToCPUList.insert(std::pair<AffinityTask*, Affinity>(task, affinityCopy)); for(CPUID cpu : affinityCopy) { if(cpuToTaskList.find(cpu) == cpuToTaskList.end()) cpuToTaskList.insert(std::pair<CPUID, TaskSet>(cpu, TaskSet())); cpuToTaskList.find(cpu)->second.insert(task); } } //procedure BFS(G,v) is std::unordered_map<CPUID, AffinityTask*> cpuToPrevTask; std::unordered_map<AffinityTask*, CPUID> taskToPrevCPU; bool reachable = false; std::queue<GraphNode> queue;//create a queue Q, true is Job, false is processor std::unordered_set<CPUID> visitedCPU; //create a set V std::unordered_set<AffinityTask*> visitedTask; //create a set V if(start.isTask()) visitedTask.insert(start.getTask()); //add v to V else visitedCPU.insert(start.getCPUID()); queue.push(start); //enqueue v onto Q while(!queue.empty())//while Q is not empty loop { auto currentItem = queue.front(); //t ← Q.dequeue() queue.pop(); if(currentItem.isTask()) { if(target.isTask()) if(target.getTask() == currentItem.getTask()) //if t is what we are looking for then { //return t reachable = true; break; } } else { if(!target.isTask()) if(target.getCPUID() == currentItem.getCPUID()) //if t is what we are looking for then { //return t reachable = true; break; } } //for all edges e in G.adjacentEdges(t) loop if(currentItem.isTask()) { AffinityTask* curTask = currentItem.getTask(); assert(curTask != nullptr); for(CPUID adjacentCPU : taskToCPUList.find(curTask)->second) //u ← G.adjacentVertex(t,e) { if(visitedCPU.find(adjacentCPU) == visitedCPU.end()) //if u is not in V then { visitedCPU.insert(adjacentCPU); //add u to V queue.push(GraphNode(adjacentCPU)); //enqueue u onto Q assert(cpuToPrevTask.find(adjacentCPU) == cpuToPrevTask.end()); cpuToPrevTask.insert(std::pair<CPUID,AffinityTask*>(adjacentCPU, curTask)); } } } else { CPUID curCPU = currentItem.getCPUID(); auto iter = cpuToTaskList.find(curCPU); if(iter == cpuToTaskList.end()) { continue; } assert(iter->second.size() > 0); for(AffinityTask* adjacentTask : iter->second) //u ← G.adjacentVertex(t,e) { if(visitedTask.find(adjacentTask) == visitedTask.end()) { visitedTask.insert(adjacentTask); queue.push(GraphNode(adjacentTask)); assert(taskToPrevCPU.find(adjacentTask) == taskToPrevCPU.end()); taskToPrevCPU.insert(std::pair<AffinityTask*,CPUID>(adjacentTask, curCPU)); } } } } if(reachable) { GraphNode current = target; while(true) { returnList.push_front(current); if(current.isTask()) { auto cpu_iter = taskToPrevCPU.find(current.getTask()); if(cpu_iter == taskToPrevCPU.end()) { assert(start.isTask()); assert(current.getTask() == start.getTask()); break; } current = cpu_iter->second; } else { auto task_iter = cpuToPrevTask.find(current.getCPUID()); if(task_iter == cpuToPrevTask.end()) { assert(!start.isTask()); assert(current.getCPUID() == start.getCPUID()); break; } current = task_iter->second; } } } return returnList; }
void BasicModem::send(const std::string& str) { getTask()->inf("send: %s", Streams::sanitize(str).c_str()); sendRaw((uint8_t*)str.c_str(), str.size()); }
bool BasicModem::processInput(std::string& str) { bool got_line = false; while (!m_chars.empty()) { char c = m_chars.front(); m_chars.pop(); m_line.push_back(c); //!@fixme: concurrency hazard. if (c == m_line_term_in[m_line_term_idx]) { ++m_line_term_idx; if (m_line_term_idx == m_line_term_in.size()) { m_line_term_idx = 0; got_line = true; break; } } else { } } if (isFragment(m_line)) { getTask()->inf("fragment: %s", Streams::sanitize(m_line).c_str()); return false; } // No complete line is available. if (!got_line) return false; if (m_line.size() <= m_line_term_in.size()) { str = ""; return true; } // Remove termination characters. str = m_line; str.resize(m_line.size() - m_line_term_in.size()); if (m_line_trim) str = Utils::String::trim(str); // Got a complete line, but it's empty. if (str.empty()) return true; m_task->spew("recv: %s", Streams::sanitize(str).c_str()); m_line.clear(); if (!m_skip_line.empty()) { if (m_skip_line == str) { str.clear(); m_skip_line.clear(); } } return true; }
WordTask TaskManager::getRandTask() { m_currentTask++; return getTask(m_currentTask); }