Beispiel #1
0
bool MemoryBuffer::copyFrom( const MemoryBuffer& other )
{
	if ( other.getSizeInBytes()!=getSizeInBytes() )
		return false;
	memcpy( mBytes, other.getBytes(), getSizeInBytes() );
	return true;
}
Beispiel #2
0
bool MemoryBuffer::copyFrom( const unsigned char* bytes, unsigned int sizeInBytes )
{
	unsigned int n = sizeInBytes;
	if ( n>getSizeInBytes() )
		n = getSizeInBytes();
	memcpy( mBytes, bytes, n );
	return true;
}
void DataSection::setBytesAtOffset(uint64_t offset, uint32_t size, char* content){
    if (offset + size > getSizeInBytes()){
        PRINT_INFOR("offset %ld size %d GetSize %ld", offset, size, getSizeInBytes());
    }
    ASSERT(offset + size <= getSizeInBytes());
    ASSERT(rawBytes);

    memcpy(rawBytes + offset, content, size);
}
	//---------------------------------------------------------------------
	void GLHardwareVertexBuffer::unlockImpl(void)
    {
		if (mLockedToScratch)
		{
			if (mScratchUploadOnUnlock)
			{
				// have to write the data back to vertex buffer
				writeData(mScratchOffset, mScratchSize, mScratchPtr, 
					mScratchOffset == 0 && mScratchSize == getSizeInBytes());
			}

			// deallocate from scratch buffer
			static_cast<GLHardwareBufferManager*>(
				HardwareBufferManager::getSingletonPtr())->deallocateScratch(mScratchPtr);

			mLockedToScratch = false;
		}
		else
		{

			glBindBufferARB(GL_ARRAY_BUFFER_ARB, mBufferId);

			if(!glUnmapBufferARB( GL_ARRAY_BUFFER_ARB ))
			{
				OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
					"Buffer data corrupted, please reload", 
					"GLHardwareVertexBuffer::unlock");
			}
		}

        mIsLocked = false;
    }
    void GLES2HardwareIndexBuffer::unlockImpl(void)
    {
        if (mLockedToScratch)
        {
            if (mScratchUploadOnUnlock)
            {
                    // have to write the data back to vertex buffer
                    writeData(mScratchOffset, mScratchSize, mScratchPtr,
                              mScratchOffset == 0 && mScratchSize == getSizeInBytes());
            }

            static_cast<GLES2HardwareBufferManager*>(
                    HardwareBufferManager::getSingletonPtr())->deallocateScratch(mScratchPtr);

            mLockedToScratch = false;
        }
        else
        {
#if GL_OES_mapbuffer
            dynamic_cast<GLES2RenderSystem*>(Root::getSingleton().getRenderSystem())->_bindGLBuffer(GL_ELEMENT_ARRAY_BUFFER, mBufferId);

			if(!glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER))
			{
				OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
					"Buffer data corrupted, please reload", 
					"GLES2HardwareIndexBuffer::unlock");
			}
#else
            OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
                        "Lock to scratch is only supported",
                        "GLES2HardwareIndexBuffer::unlockImpl");
#endif
        }
        mIsLocked = false;
    }
Beispiel #6
0
std::ostream& ossimNitfGeoPositioningTag::print(
   std::ostream& out, const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   
   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:"
       << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "TYP:" << theType << "\n"
       << pfx << std::setw(24) << "UNI:" << theCoordinateUnits << "\n"
       << pfx << std::setw(24) << "DAG:" << theGeodeticDatumName << "\n"
       << pfx << std::setw(24) << "DCD:" << theGeodeticDatumCode << "\n"
       << pfx << std::setw(24) << "ELL:" << theEllipsoidName << "\n"
       << pfx << std::setw(24) << "ELC:" << theEllipsoidCode << "\n"
       << pfx << std::setw(24) << "DVR:" << theVerticalDatumReference << "\n"
       << pfx << std::setw(24) << "VDCDVR:" << theVerticalReferenceCode << "\n"
       << pfx << std::setw(24) << "SDA:" << theSoundingDatumName << "\n"
       << pfx << std::setw(24) << "VDCSDA:" << theSoundingDatumCode << "\n"
       << pfx << std::setw(24) << "ZOR:" << theZFalseOrigin << "\n"
       << pfx << std::setw(24) << "GRD:" << theGridCode << "\n"
       << pfx << std::setw(24) << "GRN:" << theGridDescription << "\n"
       << pfx << std::setw(24) << "ZNA:" << theGridZoneNumber << "\n";
   
   return out;
}
std::ostream& ossimNitfProjectionParameterTag::print(
   std::ostream& out, const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";

   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:" << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "PRN:"   << theProjectionName << "\n"
       << pfx << std::setw(24) << "PCO:"   << theProjectionCode << "\n"
       << pfx << std::setw(24) << "NUM_PRJ:" << theNumberOfParameters << "\n";

   for (ossim_uint32 i = 0; i < theProjectionParameters.size(); ++i)
   {
      ossimString s = "PRJ";
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << theProjectionParameters[i] << "\n";
   }

   out << pfx << std::setw(24) << "XOR:"   <<theFalseXOrigin << "\n"
       << pfx << std::setw(24) << "YOR:"   <<theFalseYOrigin << std::endl;
   
   return out;   
}
void DataSection::dump(BinaryOutputFile* binaryOutputFile, uint32_t offset){
    ASSERT(rawBytes);
    binaryOutputFile->copyBytes(charStream(), getSizeInBytes(), offset);
    for (uint32_t i = 0; i < dataReferences.size(); i++){
        dataReferences[i]->dump(binaryOutputFile,offset);
    }
}
Beispiel #9
0
void InstAlloca::dump(const Cfg *Func) const {
  Ostream &Str = Func->getContext()->getStrDump();
  dumpDest(Func);
  Str << " = alloca i8, i32 ";
  getSizeInBytes()->dump(Func);
  Str << ", align " << getAlignInBytes();
}
void RawSection::dump(BinaryOutputFile* binaryOutputFile, uint32_t offset){ 
    if (getType() != PebilClassType_RawSection && getType() != PebilClassType_no_type &&
        getType() != PebilClassType_DwarfSection && getType() != PebilClassType_DwarfLineInfoSection){
        PRINT_ERROR("You should implement the dump function for class type %d", getType());
    }

    
    if (getSectionHeader()->hasBitsInFile() && getSizeInBytes()){
        char* sectionOutput = getFilePointer();
        
        binaryOutputFile->copyBytes(sectionOutput, getSizeInBytes(), offset); 
        for (uint32_t i = 0; i < dataReferences.size(); i++){
            dataReferences[i]->dump(binaryOutputFile,offset);
        }
    }
}
std::ostream& ossimNitfMstgtaTag::print(
   std::ostream& out, const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   
   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:"
       << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "TGT_NUM:" << theTgtNum << "\n"
       << pfx << std::setw(24) << "TGT_ID:" << theTgtId << "\n"
       << pfx << std::setw(24) << "TGT_BE:" << theTgtBe << "\n"
       << pfx << std::setw(24) << "TGT_PRI:" << theTgtPri << "\n"
       << pfx << std::setw(24) << "TGT_REQ:" << theTgtReq << "\n"
       << pfx << std::setw(24) << "TGT_LTIOV:" << theTgtLtiov << "\n"
       << pfx << std::setw(24) << "TGT_TYPE:" << theTgtType << "\n"
       << pfx << std::setw(24) << "TGT_COLL:" << theTgtColl << "\n"
       << pfx << std::setw(24) << "TGT_CAT:" << theTgtCat << "\n"
       << pfx << std::setw(24) << "TGT_UTC:" << theTgtUtc << "\n"
       << pfx << std::setw(24) << "TGT_ELEV:" << theTgtElev << "\n"
       << pfx << std::setw(24) << "TGT_ELEV_UNIT:" << theTgtElevUnit << "\n"
       << pfx << std::setw(24) << "TGT_LOC:" << theTgtLoc << "\n";
   
   return out;
}
    void GLESHardwareVertexBuffer::unlockImpl(void)
    {
        if (mLockedToScratch)
        {
            if (mScratchUploadOnUnlock)
            {
                    // have to write the data back to vertex buffer
                    writeData(mScratchOffset, mScratchSize, mScratchPtr,
                              mScratchOffset == 0 && mScratchSize == getSizeInBytes());
            }

            static_cast<GLESHardwareBufferManager*>(
                HardwareBufferManager::getSingletonPtr())->deallocateScratch(mScratchPtr);

            mLockedToScratch = false;
        }
        else
        {
#if defined(GL_GLEXT_PROTOTYPES)
			glBindBuffer(GL_ARRAY_BUFFER, mBufferId);
            
			if(!glUnmapBufferOES( GL_ARRAY_BUFFER ))
			{
				OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
                            "Buffer data corrupted, please reload", 
                            "GLESHardwareVertexBuffer::unlock");
			}
#else
            OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
                        "Only locking to scratch is supported",
                        "GLESHardwareVertexBuffer::unlockImpl");
#endif
        }
        mIsLocked = false;
    }
//-----------------------------------------------------------------------------
void D3D9HardwarePixelBuffer::bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *volume, IDirect3DBaseTexture9 *mipTex)
{
    D3D9_DEVICE_ACCESS_CRITICAL_SECTION

    BufferResources* bufferResources = getBufferResources(dev);
    bool isNewBuffer = false;

    if (bufferResources == NULL)
    {
        bufferResources = createBufferResources();
        mMapDeviceToBufferResources[dev] = bufferResources;
        isNewBuffer = true;
    }

    bufferResources->mipTex = mipTex;
    bufferResources->volume = volume;
    bufferResources->volume->AddRef();
    
    D3DVOLUME_DESC desc;
    if(volume->GetDesc(&desc) != D3D_OK)
        OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Could not get volume information",
         "D3D9HardwarePixelBuffer::D3D9HardwarePixelBuffer");
    mWidth = desc.Width;
    mHeight = desc.Height;
    mDepth = desc.Depth;
    mFormat = D3D9Mappings::_getPF(desc.Format);
    // Default
    mRowPitch = mWidth;
    mSlicePitch = mHeight*mWidth;
    mSizeInBytes = PixelUtil::getMemorySize(mWidth, mHeight, mDepth, mFormat);

    if (isNewBuffer && mOwnerTexture->isManuallyLoaded())
    {
        DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
        
        while (it != mMapDeviceToBufferResources.end())
        {
            if (it->second != bufferResources &&
                it->second->volume != NULL &&
                it->first->TestCooperativeLevel() == D3D_OK &&
                dev->TestCooperativeLevel() == D3D_OK)
            {
                Box fullBufferBox(0,0,0,mWidth,mHeight,mDepth);
                PixelBox dstBox(fullBufferBox, mFormat);

                dstBox.data = OGRE_MALLOC(getSizeInBytes(), MEMCATEGORY_RESOURCE);
                blitToMemory(fullBufferBox, dstBox, it->second, it->first);
                blitFromMemory(dstBox, fullBufferBox, bufferResources);
                OGRE_FREE(dstBox.data, MEMCATEGORY_RESOURCE);
                break;
            }
            ++it;           
        }               
    }
}
std::ostream& ossimNitfAimidbTag::print(
   std::ostream& out, const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   
   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:"
       << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "ACQUISITION_DATE:"
       << theAcquisitionDate << "\n"
       << pfx << std::setw(24) << "MISSION_NO:"
       << theMissionNumber << "\n"
       << pfx << std::setw(24) << "MISSION_IDENTIFICATION:"
       << theMissionIdentification<< "\n"
       << pfx << std::setw(24) << "FLIGHT_NO:"
       << theFlightNo << "\n"
       << pfx << std::setw(24) << "OP_NUM:"
       << theOpNum << "\n"
       << pfx << std::setw(24) << "CURRENT_SEGMENT:"
       << theCurrentSegment << "\n"
       << pfx << std::setw(24) << "REPRO_NUM:"
       << theReproNum<< "\n"
       << pfx << std::setw(24) << "REPLAY:"
       << theReplay<< "\n"
       << pfx << std::setw(24) << "START_TILE_COLUMN:"
       << theStartTileColumn << "\n"
       << pfx << std::setw(24) << "START_TILE_ROW:"
       << theStartTileRow << "\n"
       << pfx << std::setw(24) << "END_SEGMENT:"
       << theEndSegment << "\n"
       << pfx << std::setw(24) << "END_TILE_COLUMN:"
       << theTileColumn << "\n"
       << pfx << std::setw(24) << "END_TILE_ROW:"
       << theTileRow << "\n"
       << pfx << std::setw(24) << "COUNTRY:"
       << theCountry << "\n"
       << pfx << std::setw(24) << "LOCATION:"
       << theLocation << "\n";
   
   return out;
}
std::ostream& ossimNitfCsccgaTag::print(std::ostream& out,
	                                     const std::string& prefix) const
{
	std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   out << setiosflags(ios::left)
       << pfx << std::setw(24) << "CETAG:"      << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"        << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "CCG_SOURCE:" << m_ccgSource << "\n"
       << pfx << std::setw(24) << "CCG_SOURCE:" << m_regSensor << "\n"
       << pfx << std::setw(24) << "ORIGIN_LINE:" << m_originLine << "\n"
       << pfx << std::setw(24) << "ORIGIN_SAMPLE:" << m_originSample << "\n"
       << pfx << std::setw(24) << "AS_CELL_SIZE:" << m_asCellSize << "\n"
       << pfx << std::setw(24) << "CS_CELL_SIZE:" << m_csCellSize << "\n"
       << pfx << std::setw(24) << "CCG_MAX_LINE:" << m_ccgMaxLine << "\n"
       << pfx << std::setw(24) << "CCG_MAX_SAMPLE:" << m_ccgMaxSample << "\n";


	return out;
}
    void GL3PlusHardwareVertexBuffer::unlockImpl(void)
    {
        if (mLockedToScratch)
        {
            if (mScratchUploadOnUnlock)
            {
                // have to write the data back to vertex buffer
                writeData(mScratchOffset, mScratchSize, mScratchPtr,
                          mScratchOffset == 0 && mScratchSize == getSizeInBytes());
            }

			// deallocate from scratch buffer
            static_cast<GL3PlusHardwareBufferManager*>(
                HardwareBufferManager::getSingletonPtr())->deallocateScratch(mScratchPtr);

            mLockedToScratch = false;
        }
        else
        {
            OGRE_CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, mBufferId));

			if (mUsage & HBU_WRITE_ONLY)
            {
                OGRE_CHECK_GL_ERROR(glFlushMappedBufferRange(GL_ARRAY_BUFFER, mLockStart, mLockSize));
            }

            GLboolean mapped;
            OGRE_CHECK_GL_ERROR(mapped = glUnmapBuffer(GL_ARRAY_BUFFER));
			if(!mapped)
			{
				OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
					"Buffer data corrupted, please reload", 
					"GL3PlusHardwareVertexBuffer::unlock");
			}
            OGRE_CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, 0));
        }

        mIsLocked = false;
    }
void rspfNitfJ2klraTag::parseStream(std::istream& in)
{
   clearFields();
   
   in.read(m_orig, ORIG_SIZE);
   in.read(m_levels_o, NLEVELS_O_SIZE);
   in.read(m_bands_o, NBANDS_O_SIZE);
   in.read(m_layers_o, NLAYERS_O_SIZE);

   rspf_uint32 layers = getNumberOfLayersOriginal();
   if ( layers && (layers < 1000) ) // 999 max
   {
      m_layer.resize(layers);
      for ( rspf_uint32 i = 0; i < layers; ++i )
      {
         in.read(m_layer[i].m_layer_id, LAYER_ID_SIZE);
         in.read(m_layer[i].m_bitrate, BITRATE_SIZE);
         m_layer[i].m_layer_id[LAYER_ID_SIZE] = '\0';
         m_layer[i].m_bitrate[BITRATE_SIZE]   = '\0';
      }
   }
   else
   {
      m_layer.clear();
   }

   // Conditional:
   rspf_uint32 orig = getOriginNumber();
   if ( (orig == 1) || ( orig == 3 ) || ( orig == 9 ) )
   {
      in.read(m_nlevels_i, NLEVELS_I_SIZE);
      in.read(m_nbands_i, NBANDS_I_SIZE);
      in.read(m_nlayers_i, NLAYERS_I_SIZE);
   }

   // Set the base tag length.
   setTagLength( getSizeInBytes() );
}
std::ostream& ossimNitfBlockaTag::print(std::ostream& out,
                                        const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   
   // Grab the corners parsed into points.
   ossimDpt ulPt;
   ossimDpt urPt;
   ossimDpt lrPt;
   ossimDpt llPt;
   getFrfcLoc(ulPt);
   getFrlcLoc(urPt);
   getLrlcLoc(lrPt);
   getLrfcLoc(llPt);
   
   out << setiosflags(ios::left)
       << pfx << std::setw(24) << "CETAG:" << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "BLOCK_INSTANCE:" << theBlockInstance << "\n"
       << pfx << std::setw(24) << "N_GRAY:"         << theNGray << "\n"
       << pfx << std::setw(24) << "L_LINES:"        << theLLines << "\n"
       << pfx << std::setw(24) << "LAYOVER_ANGLE:"  << theLayoverAngle << "\n"
       << pfx << std::setw(24) << "SHADOW_ANGLE:"   << theShadowAngle << "\n"
       << pfx << std::setw(24) << "FIELD_6:"        << theField6 << "\n"
       << pfx << std::setw(24) << "FRLC_LOC:"       << theFrlcLoc << "\n"
       << pfx << std::setw(24) << "LRLC_LOC:"       << theLrlcLoc << "\n"
       << pfx << std::setw(24) << "LRFC_LOC:"       << theLrfcLoc << "\n"
       << pfx << std::setw(24) << "FRFC_LOC:"       << theFrfcLoc << "\n"
       << pfx << std::setw(24) << "FIELD_11:"       << theField11 << "\n"
       << pfx << std::setw(24) << "upper left:"     << ulPt << "\n"
       << pfx << std::setw(24) << "upper right:"    << urPt << "\n"
       << pfx << std::setw(24) << "lower right:"    << lrPt << "\n"
       << pfx << std::setw(24) << "lower left:"     << llPt << "\n";

   return out;
}
std::ostream& ossimNitfUnknownTag::print(std::ostream& out,
                                         const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";

   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:" << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "unformatted_tag_data: ";
   
   if (tagDataIsAscii())
   {
      out << theTagData << "\n";
   }
   else
   {
      out << "binary not displayed\n";
   }
   
   return out;
}
std::ostream& ossimNitfUse00aTag::print(std::ostream& out,
                                        const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";

   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:" << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"   << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "ANGLETONORTH:" << theAngleToNorth << "\n" 
       << pfx << std::setw(24) << "MEANGSD:"      << theMeanGsd << "\n"
       << pfx << std::setw(24) << "DYNAMICRANGE:" << theDynamicRange << "\n"
       << pfx << std::setw(24) << "OBLANG:"       << theOblAng << "\n"
       << pfx << std::setw(24) << "ROLLANG:"      << theRollAng << "\n"
       << pfx << std::setw(24) << "NREF:"         << theNRef << "\n"
       << pfx << std::setw(24) << "REVNUM:"       << theRevNum << "\n"
       << pfx << std::setw(24) << "NSEG:"         << theNSeg << "\n"
       << pfx << std::setw(24) << "MAXLPSEG:"     << theMaxLpSeg << "\n"
       << pfx << std::setw(24) << "SUNEL:"        << theSunEl << "\n"
       << pfx << std::setw(24) << "SUNAZ:"        << theSunAz << "\n";

   return out; 
}
Beispiel #21
0
void ShaderStorageBufferObject::upload(void * dataStart, GLuint nBytes)
{
    // check if enough bytes allocated
    if (nBytes != (GLuint)getSizeInBytes())
    {
        myDebug << "SSBO::reallocated:size: " << nBytes << std::endl;
        create(dataStart, nBytes);
        return;
    }

    bind(true);

    void * data = glMapBufferRange(GL_SHADER_STORAGE_BUFFER,
                                   0,
                                   nBytes,
                                   GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_WRITE_BIT);
    myDebug << "SSBO::upload:size: " << nBytes << std::endl;

    memcpy(data, dataStart, nBytes);

    glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);

    bind(false);
}
void RawSection::wedge(uint32_t shamt){

    ProgramHeader* dataSeg = elfFile->getProgramHeader(elfFile->getDataSegmentIdx());
    ASSERT(dataSeg);

    SectionHeader* sec = elfFile->getSectionHeader(sectionIndex);

    // only wedge raw/data sections from the data segment
    if (!dataSeg->inRange(sec->GET(sh_addr))){
        return;
    }

    //PRINT_INFOR("Original raw/data section %d", getSectionIndex());

    uint32_t intro = containsIntroString();
    if (intro){
        //PRINT_INFOR("INTRO STRING (%d) %s", intro, charStream());
    }
    //printBufferPretty(charStream(), getSizeInBytes(), getSectionHeader()->GET(sh_offset), 0, 0);

    if (elfFile->is64Bit()){
        uint32_t inc = sizeof(uint64_t);
        for (uint32_t current = intro; current < getSizeInBytes(); current += inc){
            uint64_t data;
            memcpy(&data, charStream() + current, sizeof(uint64_t));
            if (data && elfFile->isDataWedgeAddress(data + shamt)){
                data += shamt;
                memcpy(charStream() + current, &data, sizeof(uint64_t));
                //PRINT_INFOR("\t\tpatching @ %#lx: %#lx -> %#lx", getSectionHeader()->GET(sh_addr) + current, data - shamt, data);
            }
        }
    }

    //PRINT_INFOR("Patched raw/data section %d", getSectionIndex());
    //printBufferPretty(charStream(), getSizeInBytes(), getSectionHeader()->GET(sh_offset), 0, 0);
}
void rspfNitfProjectionParameterTag::parseStream(std::istream& in)
{
   clearFields();
   
   in.read(theProjectionName, 80);
   in.read(theProjectionCode, 2);
   in.read(theNumberOfParameters, 1);

   rspf_uint32 numberOfParameters = rspfString(theNumberOfParameters).toUInt32();

   for(rspf_uint32 i = 0; i < numberOfParameters; ++i)
   {
      char param[15];

      in.read(param, 15);
      theProjectionParameters.push_back(rspfString(param,
                                                    param + 15));
   }
   in.read(theFalseXOrigin, 15);
   in.read(theFalseYOrigin, 15);

   // Set the base tag length.
   setTagLength( getSizeInBytes() );
}
ComExtents::ComExtents (Int64      maxSize,
	                ComUnits   units)
: maxSize_(maxSize)
, units_(units)
{
  // ---------------------------------------------------------------------
  // Calculate the extent size:
  //
  // maxFileSize = MAX(maxSizeInBytes, 20MB)
  //
  // maxFileSize = MIN(maxFileSize, 2gbytes) -- make sure this size
  //   does not go over 2gbytes (largest supported by NSK)
  //
  // Extent sizes are no longer calculated because DP2 decides on
  // the extent sizes to use.
  // ---------------------------------------------------------------------

   const Int64 maxSizeInBytes = getSizeInBytes ( maxSize_
                                               , units_
                                               );

   Int64 maxFileSize = maxSizeInBytes;
   // If maxSize_ is too small, set it to the minimum allowed (in bytes).
   if (maxFileSize < COM_MIN_PART_SIZE_IN_BYTES)
   {
     maxSize_ = COM_MIN_PART_SIZE_IN_BYTES;
     units_ = COM_BYTES;
   }
   // If maxSize_ is too large, set it to the maximum allowed (in bytes).
   else if (maxFileSize > COM_MAX_PART_SIZE_IN_BYTES)
   {
     maxSize_ = COM_MAX_PART_SIZE_IN_BYTES;
     units_ = COM_BYTES;
   }
   // If maxSize_ is within the allowed range, leave it and units_ unchanged.
};
Beispiel #25
0
std::ostream& ossimNitfRpcBase::print(std::ostream& out,
                                      const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getTagName();
   pfx += ".";

   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:"
       << getTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"
       << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "SUCCESS:"
       << theSuccess << "\n" 
       << pfx << std::setw(24) << "ERR_BIAS:"
       << theErrorBias << "\n"
       << pfx << std::setw(24) << "ERR_RAND:"
       <<theErrRand  << "\n" 
       << pfx << std::setw(24) << "LINE_OFF:"
       << theLineOffset << "\n"
       << pfx << std::setw(24) << "SAMP_OFF:"
       << theSampleOffset << "\n" 
       << pfx << std::setw(24) << "LAT_OFF:"
       << theGeodeticLatOffset << "\n"
       << pfx << std::setw(24) << "LONG_OFF:"
       << theGeodeticLonOffset << "\n" 
       << pfx << std::setw(24) << "HEIGHT_OFF:"
       << theGeodeticHeightOffset << "\n"
       << pfx << std::setw(24) << "LINE_SCALE:"
       << theLineScale  << "\n" 
       << pfx << std::setw(24)
       << "SAMP_SCALE:" << theSampleScale << "\n"
       << pfx << std::setw(24) << "LAT_SCALE:"
       << theGeodeticLatScale << "\n" 
       << pfx << std::setw(24) << "LONG_SCALE:"
       << theGeodeticLonScale << "\n"
       << pfx << std::setw(24) << "HEIGHT_SCALE:"
       << theGeodeticHeightScale << "\n";

   ossim_int32 i;
   ossimString s;
   
   for (i=0; i<LINE_NUMERATOR_COEFFICIENT_COUNT; ++i)
   {
      s = "LINE_NUM_COEFF_";
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << theLineNumeratorCoefficient[i] << "\n";
   }

   for (i=0; i<LINE_DENOMINATOR_COEFFICIENT_COUNT; ++i)
   {
      s = "LINE_DEN_COEFF_";
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << theLineDenominatorCoefficient[i] << "\n";
   }

   for (i=0; i<LINE_NUMERATOR_COEFFICIENT_COUNT; ++i)
   {
      s = "SAMP_NUM_COEFF_";
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << theSampleNumeratorCoefficient[i] << "\n";
   }

   for (i=0; i<LINE_DENOMINATOR_COEFFICIENT_COUNT; ++i)
   {
      s = "SAMP_DEN_COEFF_";
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << theSampleDenominatorCoefficient[i] << "\n";
   }

   out.flush();
   
   return out;
}
Beispiel #26
0
std::ostream& ossimNitfCsexraTag::print(
   std::ostream& out, const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getRegisterTagName();
   pfx += ".";
   
   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:"
       << getRegisterTagName() << "\n"
       << pfx << std::setw(24) << "CEL:"
       << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "SENSOR:"
       << theSensor << "\n"
       << pfx << std::setw(24) << "TIME_FIRST_LINE_IMAGE:"
       << theTileFirstLine << "\n"
       << pfx << std::setw(24) << "TIME_IMAGE_DURATION:"
       << theImageTimeDuration << "\n"
       << pfx << std::setw(24) << "MAX_GSD:"
       << theMaxGsd << "\n"
       << pfx << std::setw(24) << "ALONG_SCAN_GSD:"
       << theAlongScanGsd << "\n"
       << pfx << std::setw(24) << "CROSS_SCAN_GSD:"
       << theCrossScanGsd << "\n"
       << pfx << std::setw(24) << "GEO_MEAN_GSD:"
       << theGeoMeanGsd << "\n"
       << pfx << std::setw(24) << "A_S_VERT_GSD:"
       << theAlongScanVertGsd << "\n"
       << pfx << std::setw(24) << "C_S_VERT_GSD:"
       << theCrossScanVertGsd << "\n"
       << pfx << std::setw(24) << "GEO_MEAN_VERT_GSD:"
       << theGeoMeanVertGsd << "\n"
       << pfx << std::setw(24) << "GEO_BETA_ANGLE:"
       << theGeoBetaAngle << "\n"
       << pfx << std::setw(24) << "DYNAMIC_RANGE:"
       << theDynamicRange << "\n"
       << pfx << std::setw(24) << "NUM_LINES:"
       << theLine << "\n"
       << pfx << std::setw(24) << "NUM_SAMPLES:"
       << theSamples << "\n"
       << pfx << std::setw(24) << "ANGLE_TO_NORTH:"
       << theAngleToNorth << "\n"
       << pfx << std::setw(24) << "OBLIQUITY_ANGLE:"
       << theObliquityAngle << "\n"
       << pfx << std::setw(24) << "AZ_OF_OBLIQUITY:"
       << theAzOfObliquity << "\n"
       << pfx << std::setw(24) << "GRD_COVER:"
       << theGrdCover << "\n"
       << pfx << std::setw(24) << "SNOW_DEPTH_CAT:"
       << theSnowDepthCategory << "\n"
       << pfx << std::setw(24) << "SUN_AZIMUTH:"
       << theSunAzimuth << "\n"
       << pfx << std::setw(24) << "SUN_ELEVATION:"
       << theSunElevation << "\n"
       << pfx << std::setw(24) << "PREDICTED_NIIRS:"
       << thePredictedNiirs << "\n"
       << pfx << std::setw(24) << "CIRCL_ERR:"
       << theCircularError << "\n"
       << pfx << std::setw(24) << "LINEAR_ERR:"
       << theLinearError<< "\n";
   
   return out;
}
Beispiel #27
0
void MemoryBuffer::fill( char value )
{
	memset( mBytes, value, getSizeInBytes() );
}
std::ostream& ossimNitfRsmpcaTag::print(std::ostream& out,
                                      const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += getTagName();
   pfx += ".";

   out << setiosflags(std::ios::left)
       << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
       << pfx << std::setw(24) << "CEL:" << getSizeInBytes() << "\n"
       << pfx << std::setw(24) << "IID:" << m_iid << "\n" 
       << pfx << std::setw(24) << "EDITION:" << m_edition << "\n"
       << pfx << std::setw(24) << "RSN:" << m_rsn << "\n" 
       << pfx << std::setw(24) << "CSN:" << m_csn << "\n"
       << pfx << std::setw(24) << "RFEP:" << m_rfep << "\n" 
       << pfx << std::setw(24) << "CFEP:" << m_cfep << "\n"
       << pfx << std::setw(24) << "RNRMO:" << m_rnrmo << "\n" 
       << pfx << std::setw(24) << "CNRMO:" << m_cnrmo << "\n"                
       << pfx << std::setw(24) << "XNRMO:" << m_xnrmo << "\n"                
       << pfx << std::setw(24) << "YNRMO:" << m_ynrmo << "\n"                
       << pfx << std::setw(24) << "ZNRMO:" << m_znrmo << "\n"                
       << pfx << std::setw(24) << "RNRMSF:" << m_rnrmsf << "\n"                
       << pfx << std::setw(24) << "CNRMSF:" << m_cnrmsf << "\n"
       << pfx << std::setw(24) << "XNRMSF:" << m_xnrmsf << "\n"
       << pfx << std::setw(24) << "YNRMSF:" << m_ynrmsf << "\n"
       << pfx << std::setw(24) << "ZNRMSF:" << m_znrmsf << "\n"
       << pfx << std::setw(24) << "RNPWRX:" << m_rnpwrx << "\n"
       << pfx << std::setw(24) << "RNPWRY:" << m_rnpwry << "\n"
       << pfx << std::setw(24) << "RNPWRZ:" << m_rnpwrz << "\n"
       << pfx << std::setw(24) << "RNTRMS:" << m_rntrms << "\n"
       << pfx << std::setw(24) << "RDPWRX:" << m_rdpwrx << "\n"
       << pfx << std::setw(24) << "RDPWRY:" << m_rdpwry << "\n"
       << pfx << std::setw(24) << "RDPWRZ:" << m_rdpwrz << "\n"
       << pfx << std::setw(24) << "RDTRMS:" << m_rdtrms << "\n"
       << pfx << std::setw(24) << "CNPWRX:" << m_rnpwrx << "\n"
       << pfx << std::setw(24) << "CNPWRY:" << m_rnpwry << "\n"
       << pfx << std::setw(24) << "CNPWRZ:" << m_rnpwrz << "\n"
       << pfx << std::setw(24) << "CNTRMS:" << m_rntrms << "\n"
       << pfx << std::setw(24) << "CDPWRX:" << m_rdpwrx << "\n"
       << pfx << std::setw(24) << "CDPWRY:" << m_rdpwry << "\n"
       << pfx << std::setw(24) << "CDPWRZ:" << m_rdpwrz << "\n"
       << pfx << std::setw(24) << "CDTRMS:" << m_rdtrms << "\n";


   ossim_uint32 i;
   ossimString s;
   
   for (i=0; i<m_rowNumNumTerms; ++i)
   {
      s = ossimString(RNPCF_KW);
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << m_rnpcf[i] << "\n";
   }
   for (i=0; i<m_rowDenNumTerms; ++i)
   {
      s = ossimString(RDPCF_KW);
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << m_rdpcf[i] << "\n";
   }
   for (i=0; i<m_colNumNumTerms; ++i)
   {
      s = ossimString(CNPCF_KW);
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << m_cnpcf[i] << "\n";
   }
   for (i=0; i<m_colDenNumTerms; ++i)
   {
      s = ossimString(CDPCF_KW);
      s += ossimString::toString(i);
      s += ":";
      out << pfx << std::setw(24) << s
          << m_cdpcf[i] << "\n";
   }

   out.flush();
   
   return out;
}
void RawSection::printBytes(uint64_t offset, uint32_t bytesPerWord, uint32_t bytesPerLine){
    fprintf(stdout, "\n");
    PRINT_INFOR("Raw bytes for RAW section %d:", sectionIndex);
    printBufferPretty(charStream() + offset, getSizeInBytes(), getSectionHeader()->GET(sh_offset) + offset, bytesPerWord, bytesPerLine);
}
Beispiel #30
0
void HardwareBuffer::copyData(HardwareBuffer& srcBuffer)
{
    size_t sz = std::min(getSizeInBytes(), srcBuffer.getSizeInBytes());
    copyData(srcBuffer, 0, 0, sz, TRUE);
}