libpcidsk
Public Member Functions
PCIDSK::PCIDSKSegment Class Reference

Public tnterface for the PCIDSK Segment Type. More...

#include <pcidsk_segment.h>

List of all members.

Public Member Functions

virtual void WriteToFile (const void *buffer, uint64 offset, uint64 size)=0
 Write data to segment.
virtual void ReadFromFile (void *buffer, uint64 offset, uint64 size)=0
 Read data from segment.
virtual eSegType GetSegmentType ()=0
 Fetch segment type.
virtual std::string GetName ()=0
 Fetch segment name.
virtual std::string GetDescription ()=0
 Fetch segment description.
virtual int GetSegmentNumber ()=0
 Fetch segment number.
virtual uint64 GetContentSize ()=0
 Get size of segment data.
virtual bool IsAtEOF ()=0
 Is segment last in file?
virtual std::string GetMetadataValue (std::string key)=0
 Fetch metadata value.
virtual void SetMetadataValue (std::string key, std::string value)=0
 Set metadata value.
virtual std::vector< std::string > GetMetadataKeys ()=0
 Fetch metadata keys.
virtual void Synchronize ()=0
 Write pending information to disk.

Detailed Description

Public tnterface for the PCIDSK Segment Type.

This class interface is used for access to PCIDSK segments and associated data. The class should never be instantiated by the application. Instead all instances are owned by the corresponding PCIDSK::PCIDSKFile object and a pointer can be fetched using PCIDSKFile::GetSegment() or related methods.

Some segments types such as binary (SEG_BIN) provide no custom interfaces and can only be accessed using the generic PCIDSKSegment methods. Others, such as georeferencing segments (SEG_GEO) offer additional segment specific interfaces via multiple inheritance. Use dynamic casts to get access to the type specific interfaces.

Example:

  PCIDSK::PCIDSKSegment *seg = file->GetSegment(1);

  if( seg->GetSegmentType() == PCIDSK::SEG_GEO )
  {                                                                     
      PCIDSK::PCIDSKGeoref *georef = dynamic_cast<PCIDSK::PCIDSKGeoref*>( seg );

      printf( "Geosys = %s\n", georef->GetGeosys() );
  }

Member Function Documentation

uint64 PCIDSK::PCIDSKSegment::GetContentSize ( ) [pure virtual]

Get size of segment data.

Returns the size of the data portion of this segment (header excluded) in bytes.

Returns:
segment data size in bytes.
const char * PCIDSK::PCIDSKSegment::GetDescription ( ) [pure virtual]

Fetch segment description.

The returned pointer is to internally managed data of the PCIDSKSegment, and should not be modified, freed, or used after the segment object ceases to exist. The description is at most 80 characters long.

Returns:
the segment description.
std::vector< std::string > PCIDSK::PCIDSKSegment::GetMetadataKeys ( ) [pure virtual]

Fetch metadata keys.

Returns a vector of metadata keys that occur on this object. The values associated with each may be fetched with GetMetadataValue().

Returns:
list of keys
See also:
GetMetadataValue()
std::string PCIDSK::PCIDSKSegment::GetMetadataValue ( std::string  key) [pure virtual]

Fetch metadata value.

Fetch the metadata value associated with the passed key on this object. If there is no such item an empty string is returned.

Parameters:
keythe key to fetch the value for.
Returns:
the value of the indicated metadata item, or an empty string if it does not exist on the target object.
See also:
GetMetadataKeys()

Note that the returned pointer is to an internal structure and it may become invalid if another thread modifies the metadata for this object.

Parameters:
keythe key to fetch the value for.
Returns:
the value of the indicated metadata item, or NULL if it does not exist on the target object.
See also:
GetMetadataKeys()
const char * PCIDSK::PCIDSKSegment::GetName ( ) [pure virtual]

Fetch segment name.

The returned pointer is to internally managed data of the PCIDSKSegment, and should not be modified, freed, or used after the segment object ceases to exist. The name is at most eight characters long.

Returns:
the segment name.
int PCIDSK::PCIDSKSegment::GetSegmentNumber ( ) [pure virtual]

Fetch segment number.

Returns:
the segment number (1+).
eSegType PCIDSK::PCIDSKSegment::GetSegmentType ( ) [pure virtual]

Fetch segment type.

Returns:
the type of this segment.
bool PCIDSK::PCIDSKSegment::IsAtEOF ( ) [pure virtual]

Is segment last in file?

Returns true if the segment is the last one in the file, and thus can be grown without having to move it. Primarily this method is used by the SDK itself.

Returns:
true if segment at EOF or false otherwise.
void PCIDSK::PCIDSKSegment::ReadFromFile ( void *  buffer,
uint64  offset,
uint64  size 
) [pure virtual]

Read data from segment.

Read from data area of this segment. Offset zero refers to the start of the data area of the segment, access to to the segment header is not available via ReadFromFile().

Parameters:
bufferpointer to the buffer into which the data should be read.
offsetthe byte offset in the file (zero based) at which to read the data.
sizethe number of bytes from the file to read.
void PCIDSK::PCIDSKSegment::SetMetadataValue ( std::string  key,
std::string  value 
) [pure virtual]

Set metadata value.

Assign the metadata value associated with the passed key on this object. The file needs to be open for update. Note that keys should be well formed tokens (no special characters, spaces, etc).

Parameters:
keythe key to fetch the value for.
valuethe value to assign to the key. An empty string deletes the item.
See also:
GetMetadataValue()
void PCIDSK::PCIDSKSegment::Synchronize ( ) [pure virtual]

Write pending information to disk.

Some write and update operations on PCIDSK files are not written to disk immediately after write calls. This method will ensure that any pending writes are flushed through to disk.

NOTE: Currently this method does not invalidate read-cached information. At some point in the future it might be extended to do this as well.

void PCIDSK::PCIDSKSegment::WriteToFile ( const void *  buffer,
uint64  offset,
uint64  size 
) [pure virtual]

Write data to segment.

Write to data area of this segment. Offset zero refers to the start of the data area of the segment, access to to the segment header is not available via WriteToFile().

Parameters:
bufferpointer to the data to write to disk.
offsetthe byte offset in the file (zero based) at which to write the data.
sizethe number of bytes from buffer to write.

The documentation for this class was generated from the following files:

Generated for GDAL by doxygen 1.7.5.