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 Initialize ()
 Internal segment initializer.
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 void SetDescription (const std::string &description)=0
 Set segment description.
virtual std::string GetMetadataValue (const std::string &key) const =0
virtual void SetMetadataValue (const std::string &key, const std::string &value)=0
 Set metadata value.
virtual std::vector< std::string > GetMetadataKeys () const=0
virtual std::vector< std::string > GetHistoryEntries () const=0
 fetch history records
virtual void SetHistoryEntries (const std::vector< std::string > &entries)=0
 Set all history records.
virtual void PushHistory (const std::string &app, const std::string &message)=0
 Push a new history message.
virtual void Synchronize ()=0
 Write pending information to disk.
virtual std::string ConsistencyCheck ()=0


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() );
  }

See also:
PCIDSKGeoref, PCIDSKVectorSegment, PCIDSK_PCT, PCIDSKChannel, PCIDSK_TEX, PCIDSKGCPSegment, PCIDSKRPCSegment


Member Function Documentation

void PCIDSK::PCIDSKSegment::Initialize (  )  [inline, virtual]

Internal segment initializer.

This method is only intended to be called by PCIDSKFile::CreateSegment(). It should never be called by application code.

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:
buffer pointer to the data to write to disk.
offset the byte offset in the file (zero based) at which to write the data.
size the number of bytes from buffer to write.

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:
buffer pointer to the buffer into which the data should be read.
offset the byte offset in the file (zero based) at which to read the data.
size the number of bytes from the file to read.

eSegType PCIDSK::PCIDSKSegment::GetSegmentType (  )  [pure virtual]

Fetch segment type.

Returns:
the type of this segment.

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.

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.

int PCIDSK::PCIDSKSegment::GetSegmentNumber (  )  [pure virtual]

Fetch segment number.

Returns:
the segment number (1+).

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.

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::SetDescription ( const std::string &  description  )  [pure virtual]

Set segment description.

Parameters:
description a string of up to 64 characters.

void PCIDSK::PCIDSKSegment::SetMetadataValue ( const std::string &  key,
const 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:
key the key to fetch the value for.
value the value to assign to the key. An empty string deletes the item.
See also:
GetMetadataValue()

std::vector< std::string > PCIDSK::PCIDSKSegment::GetHistoryEntries (  )  const [pure virtual]

fetch history records

Returns:
a vector of the 8 history records for this segment.

void PCIDSK::PCIDSKSegment::SetHistoryEntries ( const std::vector< std::string > &  entries  )  [pure virtual]

Set all history records.

Normally applications will just use the PushHistory() method. This method is used for bulk copying of history for special situations.

Parameters:
entries - should be a vector of 8 strings of at most 80 characters.

void PCIDSK::PCIDSKSegment::PushHistory ( const std::string &  app,
const std::string &  message 
) [pure virtual]

Push a new history message.

This method will push a new history message at the front of the history stack. The top seven history messages will be pushed down one to make space and the last one will be lost. The current date is automatically appended to the message.

Parameters:
app the application name, only 7 characters are used.
message the history message, only 56 characters are used.

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.


The documentation for this class was generated from the following files:
Generated on Fri Jul 16 16:01:31 2010 for libpcidsk by  doxygen 1.5.1