![]() |
Isis Developer Reference
|
#include <Blob.h>
Public Member Functions | |
Blob (const QString &name, const QString &type) | |
Constructs a Blob object using a name and type. More... | |
Blob (const QString &name, const QString &type, const QString &file) | |
Constructs a Blob object using a name, type, and reading Pvl values from a file. More... | |
Blob (const Blob &other) | |
This copies the blob object. More... | |
Blob ()=default | |
Blob & | operator= (const Blob &other) |
This makes the two blob objects exactly the same (copies the blob) More... | |
virtual | ~Blob () |
Destroys the Blob object. More... | |
QString | Type () const |
Accessor method that returns a string containing the Blob type. More... | |
QString | Name () const |
Accessor method that returns a string containing the Blob name. More... | |
int | Size () const |
Accessor method that returns the number of bytes in the blob data. More... | |
PvlObject & | Label () |
Accessor method that returns a PvlObject containing the Blob label. More... | |
void | Read (const QString &file, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) |
This method reads Pvl values from a specified file. More... | |
void | Read (const QString &file, const Pvl &pvlLabels, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) |
This method reads the given a file and labels. More... | |
virtual void | Read (const Pvl &pvl, std::istream &is, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) |
This method reads the Blob data from an open input file stream. More... | |
void | Write (const QString &file) |
Write the blob data out to a file. More... | |
void | Write (Pvl &pvl, std::fstream &stm, const QString &detachedFileName="", bool overwrite=true) |
Write the blob data out to a Pvl object. More... | |
char * | getBuffer () |
Get the internal data buff of the Blob. More... | |
void | setData (const char *buffer, int nbytes) |
Set the data stored in the BLOB. More... | |
void | takeData (char *buffer, int nbytes) |
Set the data stored in the BLOB without copying it. More... | |
Protected Member Functions | |
void | Find (const Pvl &pvl, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) |
This method searches the given Pvl for the Blob by the Blob's type and name. More... | |
virtual void | ReadInit () |
This virtual method for classes that inherit Blob. More... | |
virtual void | ReadData (std::istream &is) |
Read binary data from an input stream into the Blob object. More... | |
virtual void | WriteInit () |
This virtual method for classes that inherit Blob. More... | |
virtual void | WriteData (std::fstream &os) |
Writes blob data to a stream. More... | |
Protected Attributes | |
PvlObject | p_blobPvl |
Pvl Blob object. More... | |
QString | p_blobName |
Name of the Blob object. More... | |
char * | p_buffer |
Buffer blob data is stored in. More... | |
BigInt | p_startByte |
Byte blob data starts at in buffer. More... | |
int | p_nbytes |
Size of blob data (in bytes) More... | |
QString | p_type |
Type of data stored in the buffer. More... | |
QString | p_detached |
Used for reading detached blobs. More... | |
QString | p_labelFile |
The file containing the labels. More... | |
Isis::Blob::Blob | ( | const QString & | name, |
const QString & | type | ||
) |
Constructs a Blob object using a name and type.
name | The blob name |
type | The blob type |
Isis::Blob::Blob | ( | const QString & | name, |
const QString & | type, | ||
const QString & | file | ||
) |
Constructs a Blob object using a name, type, and reading Pvl values from a file.
name | The blob name |
type | The blob type |
file | The filename to read from. |
References Isis::FileName::expanded().
Isis::Blob::Blob | ( | const Blob & | other | ) |
This copies the blob object.
other | Blob to be copied |
References p_blobName, p_blobPvl, p_buffer, p_detached, p_labelFile, p_nbytes, p_startByte, and p_type.
|
default |
|
virtual |
Destroys the Blob object.
|
protected |
This method searches the given Pvl for the Blob by the Blob's type and name.
If found, the start byte, number of bytes are read from the Pvl. Also, if a keyword label pointer is found, the filename for the detached blob is stored and the pointer is removed from the blob pvl.
pvl | The Pvl to be searched |
keywords | A list of keyword, value pairs to match inside the blob's PVL object. Only if all the keyword match is the blob processed. This is used when there are multiple blobs with the same name, but different keywords that define the exact blob (see Stretch with a band number) |
References _FILEINFO_, Isis::PvlObject::findKeyword(), Isis::PvlObject::hasKeyword(), Isis::PvlKeyword::isEquivalent(), Isis::PvlContainer::isNamed(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::FileName::path().
char * Isis::Blob::getBuffer | ( | ) |
Get the internal data buff of the Blob.
Referenced by Isis::CSMCamera::CSMCamera(), Isis::CubeStretch::CubeStretch(), Isis::OriginalXmlLabel::fromBlob(), Isis::History::History(), Isis::ImagePolygon::ImagePolygon(), and Isis::Table::initFromBlob().
PvlObject & Isis::Blob::Label | ( | ) |
Accessor method that returns a PvlObject containing the Blob label.
Referenced by Isis::CSMCamera::CSMCamera(), Isis::CubeStretch::CubeStretch(), Isis::Table::initFromBlob(), Isis::CubeStretch::toBlob(), Isis::OriginalXmlLabel::toBlob(), and Isis::Table::toBlob().
QString Isis::Blob::Name | ( | ) | const |
Accessor method that returns a string containing the Blob name.
Referenced by Isis::Image::isFootprintable(), Isis::Shape::isFootprintable(), and Isis::Cube::write().
This makes the two blob objects exactly the same (copies the blob)
other | Blob to be copied |
References p_blobName, p_blobPvl, p_buffer, p_detached, p_labelFile, p_nbytes, p_startByte, and p_type.
|
virtual |
This method reads the Blob data from an open input file stream.
pvl | A Pvl containing the label information. |
istm | The input file stream containing the blob data to be read. |
iException::Io | - Unable to open file |
References _FILEINFO_, and Isis::Message::FileOpen().
void Isis::Blob::Read | ( | const QString & | file, |
const Pvl & | pvlLabels, | ||
const std::vector< PvlKeyword > | keywords = std::vector<PvlKeyword>() |
||
) |
This method reads the given a file and labels.
file | The filename to read from. |
pvlLabels | A Pvl containing the label information. |
iException::Io | - Unable to open file |
References _FILEINFO_, and Isis::Message::FileOpen().
void Isis::Blob::Read | ( | const QString & | file, |
const std::vector< PvlKeyword > | keywords = std::vector<PvlKeyword>() |
||
) |
This method reads Pvl values from a specified file.
file | The filename to read from. |
iException::Io | - Unable to open file |
iException::Pvl | - Invalid label format |
References _FILEINFO_, and Isis::Pvl::read().
Referenced by Isis::OriginalLabel::OriginalLabel(), Isis::OriginalXmlLabel::OriginalXmlLabel(), Isis::Cube::read(), and Isis::Table::Table().
|
protectedvirtual |
Read binary data from an input stream into the Blob object.
stream | The input stream to read from. |
IException::Io | - Error reading data from stream |
References _FILEINFO_.
|
protectedvirtual |
void Isis::Blob::setData | ( | const char * | buffer, |
int | nbytes | ||
) |
Set the data stored in the BLOB.
This function will copy the data buffer, if you want to avoid that use takeData which will take ownership of the buffer.
buffer | The buffer of data. The BLOB does not take ownership of this, the caller is still responsible for cleaning it up. |
nbytes | The amount of data in the buffer |
Referenced by Isis::OriginalLabel::toBlob(), Isis::CubeStretch::toBlob(), Isis::ImagePolygon::toBlob(), and Isis::OriginalXmlLabel::toBlob().
int Isis::Blob::Size | ( | ) | const |
Accessor method that returns the number of bytes in the blob data.
Referenced by Isis::CSMCamera::CSMCamera(), Isis::CubeStretch::CubeStretch(), Isis::OriginalXmlLabel::fromBlob(), Isis::History::History(), and Isis::ImagePolygon::ImagePolygon().
void Isis::Blob::takeData | ( | char * | buffer, |
int | nbytes | ||
) |
Set the data stored in the BLOB without copying it.
This function takes ownership of the data buffer and will delete is when the BLOB is cleaned up.
buffer | The buffer of data. The BLOB takes ownership of this. |
nbytes | The amount of data in the buffer |
Referenced by Isis::Table::toBlob(), and Isis::History::toBlob().
QString Isis::Blob::Type | ( | ) | const |
Accessor method that returns a string containing the Blob type.
Referenced by Isis::Image::isFootprintable(), Isis::Shape::isFootprintable(), and Isis::Cube::write().
void Isis::Blob::Write | ( | const QString & | file | ) |
Write the blob data out to a file.
file | The filename to write to. |
IException::Io | - Unable to open file |
IException::Io | - Error preparing to write data to file |
IException::Io | - Error creating file |
References _FILEINFO_, Isis::PvlObject::addObject(), Isis::PvlObject::findObject(), Isis::toString(), and Isis::Pvl::write().
Referenced by Isis::Cube::write(), and Isis::Table::Write().
void Isis::Blob::Write | ( | Pvl & | pvl, |
std::fstream & | stm, | ||
const QString & | detachedFileName = "" , |
||
bool | overwrite = true |
||
) |
Write the blob data out to a Pvl object.
pvl | The pvl object to update |
stm | stream to write data to |
detachedFileName | If the stream is detached from the labels give the name of the file |
References Isis::PvlObject::addObject(), Isis::PvlContainer::name(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::toString().
|
protectedvirtual |
Writes blob data to a stream.
stream | Output steam blob data will be written to |
IException::Io | - Error writing data to stream |
References _FILEINFO_.
|
protectedvirtual |
|
protected |
Name of the Blob object.
Referenced by Blob(), and operator=().
|
protected |
Referenced by Blob(), and operator=().
|
protected |
Buffer blob data is stored in.
Referenced by Blob(), and operator=().
|
protected |
Used for reading detached blobs.
Referenced by Blob(), and operator=().
|
protected |
The file containing the labels.
Referenced by Blob(), and operator=().
|
protected |
Size of blob data (in bytes)
Referenced by Blob(), and operator=().
|
protected |
Byte blob data starts at in buffer.
Referenced by Blob(), and operator=().
|
protected |
Type of data stored in the buffer.
Referenced by Blob(), and operator=().
U.S. Department of the Interior | U.S. Geological Survey ISIS | Privacy & Disclaimers | Astrogeology Research Program To contact us, please post comments and questions on the USGS Astrogeology Discussion Board To report a bug, or suggest a feature go to: ISIS Github File Modified: 07/13/2023 15:13:07 |