Public tnterface for the PCIDSK Segment Type. More...
#include <pcidsk_segment.h>
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. |
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() ); }
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.
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.
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().
std::string PCIDSK::PCIDSKSegment::GetMetadataValue | ( | std::string | key | ) | [pure virtual] |
Fetch metadata value.
Note that the returned pointer is to an internal structure and it may become invalid if another thread modifies the metadata for this object.
key | the key to fetch the value for. |
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.
int PCIDSK::PCIDSKSegment::GetSegmentNumber | ( | ) | [pure virtual] |
Fetch segment number.
eSegType PCIDSK::PCIDSKSegment::GetSegmentType | ( | ) | [pure virtual] |
Fetch segment type.
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.
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().
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. |
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).
key | the key to fetch the value for. | |
value | the value to assign to the key. An empty string deletes the item. |
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().
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. |