void PhyxCompoundUnit::compoundSimplify(int index) { PhyxUnit *unit = m_compounds.at(index).unit; PhyxFloatDataType power = m_compounds.at(index).power; //qDebug() << static_cast<double>(power) << unit->symbol() << static_cast<double>(unit->scaleFactor()) << static_cast<double>(unit->offset()) << index; emit scaleValue(pow(unit->scaleFactor(), power)); emit offsetValue(-unit->offset()); if (power == PHYX_FLOAT_NULL) //if unit is 1 remove it { m_compounds[index].power = PHYX_FLOAT_NULL; } else { PhyxUnit *tmpUnit = new PhyxUnit(); copyUnit(unit,tmpUnit); tmpUnit->setOffset(PHYX_FLOAT_NULL); tmpUnit->setScaleFactor(PHYX_FLOAT_ONE); PhyxUnit *newUnit = m_unitSystem->verifyUnit(tmpUnit); if (newUnit != NULL) { compoundDivide(unit, power); //remove old unit compoundMultiply(newUnit, PHYX_FLOAT_ONE); //add new unit } else { compoundStrip(index); //strip compound } tmpUnit->deleteLater(); } }
unsigned EthernetFrame::setBack(ACE_UINT8* buffer, const unsigned bufLen) { ACE_TRACE("EthernetFrame::setBack"); throwIfUninitialized(); // setHeader() has to be called first if ( getExpectedLength() != bufLen + minBytesToDetermineLength() ) { ND_ERROR("Expected length %d != %d + buffer size %d (type is %04X)!\n", getExpectedLength(), minBytesToDetermineLength(), bufLen, getEtherType()); throw std::runtime_error("Expected Ethernet header/payload length is different than buffer."); } setBufferSize(getExpectedLength()); copyUnit(ptrUnit() + minBytesToDetermineLength(), buffer, bufLen); return getUnitLength(); }