Exemple #1
0
void MEP::initializeMEPFragments(const char * data, const uint16_t& dataLength)
		throw (BrokenPacketReceivedError) {
	// The first subevent starts directly after the header -> offset is 12
	uint16_t offset = sizeof(MEP_HDR);

	MEPFragment* newMEPFragment;
	uint32_t expectedEventNum = getFirstEventNum();

	for (uint16_t i = 0; i < getNumberOfEvents(); i++) {
		/*
		 *  Throws exception if the event number LSB has an unexpected value
		 */
		newMEPFragment = new  MEPFragment(this,
				(MEPFragment_HDR*) (data + offset), expectedEventNum);

		expectedEventNum++;
		events[i] = newMEPFragment;
		if (newMEPFragment->getDataLength() + offset > dataLength) {
			throw BrokenPacketReceivedError(
					"Incomplete MEPFragment! Received only "
							+ boost::lexical_cast<std::string>(dataLength)
							+ " of "
							+ boost::lexical_cast<std::string>(
									offset + newMEPFragment->getDataLength())
							+ " bytes");
		}
		offset += newMEPFragment->getDataLength();
	}

	// Check if too many bytes have been transmitted
	if (offset < dataLength) {
		throw BrokenPacketReceivedError(
				"Sum of MEP events + MEP Header is smaller than expected: "
						+ boost::lexical_cast<std::string>(offset)
						+ " instead of "
						+ boost::lexical_cast<std::string>(dataLength));
	}
}
Exemple #2
0
void LogAnalyser::filterByTime()
{

    if((!xmlParser) || (!xmlParser->getEventsContainer())) return;

    const auto eventConteiner = xmlParser->getEventsContainer();

    if(eventConteiner == nullptr) return;

    QString from(ui->lineEditTimeFrom->text());
    QString to(ui->lineEditTimeTo->text());
    //qDebug() << from << to;

   for(int j = 0;j<eventConteiner->getNumberOfEvents();++j){

    if((eventConteiner->isWithinTime(eventConteiner->getEvent(j),from,to)) == false) {
        ui->tableWidget->hideRow(j);

    } else {
        ui->tableWidget->showRow(j);
        // ui->tableWidget->update();
    }
   }
}
int getEntrysInWindow(JPetInputHandler& handler)
{
  auto&  event = handler.getEntry();
  auto timeWindow = dynamic_cast<const JPetTimeWindow& >(event);
  return timeWindow.getNumberOfEvents();
}