Operand CCodeGenerator::alloc_temp(Type* type) { line(); brace(); operator()(type); op_ = Operand(RegisterId(op_.reg().id()+1, 0)); out_ << " " << op_ << " = "; return op_; }
std::vector< terrama2::core::ProcessLogger::Log > terrama2::core::ProcessLogger::getLogs(const ProcessId processId, uint32_t begin, uint32_t end) const { if(!isValid_) throw terrama2::core::LogException() << ErrorDescription("Error on log!"); if(tableName_.empty()) { QString errMsg = QObject::tr("Can not find log table name. Is it setted?"); TERRAMA2_LOG_ERROR() << errMsg; throw terrama2::core::LogException() << ErrorDescription(errMsg); } if(begin > end) std::swap(begin, end); int rowNumbers = (end - begin) + 1; std::string sql ="SELECT * FROM " + tableName_ + " WHERE process_id = " + std::to_string(processId) + " ORDER BY id DESC" + " LIMIT " + std::to_string(rowNumbers) + " OFFSET " + std::to_string(begin); std::unique_ptr< te::da::DataSourceTransactor > transactor = dataSource_->getTransactor(); std::unique_ptr<te::da::DataSet> tempDataSet(transactor->query(sql)); std::vector< Log > logs; while(tempDataSet->moveNext()) { Log tempLog; tempLog.id = tempDataSet->getInt32("id"); tempLog.processId = tempDataSet->getInt32("process_id"); tempLog.status = Status(tempDataSet->getInt32("status")); tempLog.start_timestamp = std::shared_ptr<te::dt::TimeInstantTZ>(dynamic_cast<te::dt::TimeInstantTZ*>(tempDataSet->getDateTime("start_timestamp").release())); tempLog.data_timestamp = std::shared_ptr<te::dt::TimeInstantTZ>(dynamic_cast<te::dt::TimeInstantTZ*>(tempDataSet->getDateTime("data_timestamp").release())); tempLog.last_process_timestamp = std::shared_ptr<te::dt::TimeInstantTZ>(dynamic_cast<te::dt::TimeInstantTZ*>(tempDataSet->getDateTime("last_process_timestamp").release())); tempLog.data = tempDataSet->getAsString("data"); std::string sqlMessages ="SELECT * FROM " + messagesTableName_ + " WHERE log_id = " + std::to_string(tempLog.id) + "ORDER BY id"; std::unique_ptr<te::da::DataSet> tempMessagesDataSet(transactor->query(sqlMessages)); std::vector< MessageLog > messages; while(tempMessagesDataSet->moveNext()) { MessageLog tempMessage; tempMessage.id = tempMessagesDataSet->getInt32("id"); tempMessage.log_id = RegisterId(tempMessagesDataSet->getInt32("log_id")); tempMessage.type = MessageType(tempMessagesDataSet->getInt32("type")); tempMessage.description = tempMessagesDataSet->getAsString("description"); tempMessage.timestamp = std::shared_ptr<te::dt::TimeInstantTZ>(dynamic_cast<te::dt::TimeInstantTZ*>(tempMessagesDataSet->getDateTime("timestamp").release())); messages.push_back(tempMessage); } tempLog.messages = messages; logs.push_back(tempLog); } return logs; }
// Represents the value of a literal, i.e., LITERAL. explicit Operand(FloatLiteral* literal) : obj_(literal), reg_(RegisterId(0, RegisterId::FLOAT)) {}