Isis 3 Programmer Reference
|
#include <Blob.h>
Public Member Functions | |
Blob (const QString &name, const QString &type) | |
Constructs a Blob object using a name and type. | |
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. | |
Blob (const Blob &other) | |
This copies the blob object. | |
Blob & | operator= (const Blob &other) |
This makes the two blob objects exactly the same (copies the blob) | |
virtual | ~Blob () |
Destroys the Blob object. | |
QString | Type () const |
Accessor method that returns a string containing the Blob type. | |
QString | Name () const |
Accessor method that returns a string containing the Blob name. | |
int | Size () const |
Accessor method that returns the number of bytes in the blob data. | |
PvlObject & | Label () |
Accessor method that returns a PvlObject containing the Blob label. | |
void | Read (const QString &file, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) |
This method reads Pvl values from a specified file. | |
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. | |
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. | |
void | Write (const QString &file) |
Write the blob data out to a file. | |
void | Write (Pvl &pvl, std::fstream &stm, const QString &detachedFileName="", bool overwrite=true) |
Write the blob data out to a Pvl object. | |
char * | getBuffer () |
Get the internal data buff of the Blob. | |
void | setData (const char *buffer, int nbytes) |
Set the data stored in the BLOB. | |
void | takeData (char *buffer, int nbytes) |
Set the data stored in the BLOB without copying it. | |
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. | |
virtual void | ReadInit () |
This virtual method for classes that inherit Blob. | |
virtual void | ReadData (std::istream &is) |
Read binary data from an input stream into the Blob object. | |
virtual void | WriteInit () |
This virtual method for classes that inherit Blob. | |
virtual void | WriteData (std::fstream &os) |
Writes blob data to a stream. | |
Protected Attributes | |
PvlObject | p_blobPvl |
Pvl Blob object. | |
QString | p_blobName |
Name of the Blob object. | |
char * | p_buffer |
Buffer blob data is stored in. | |
BigInt | p_startByte |
Byte blob data starts at in buffer. | |
int | p_nbytes |
Size of blob data (in bytes) | |
QString | p_type |
Type of data stored in the buffer. | |
QString | p_detached |
Used for reading detached blobs. | |
QString | p_labelFile |
The file containing the labels. | |
2006-04-04 Jeff Anderson Class was not overwriting existing blobs correctly.
2007-02-20 Elizabeth Miller Fixed bug with OriginalLabel naming and modified to be backwards compatible
????-??-?? Steven Lambright Added copy constructor, assignment operator
2010-05-15 Steven Lambright Changed Read to use an istream instead of an fstream
2011-05-25 Janet Barrett and Steven Lambright Added a Read method that takes the pvl labels so they do not have to be re-read, which is a very expensive operation.
2012-10-04 Jeannie Backer Added include due to forward declaration in TableField. Ordered includes and added forward declaration. Fixed header definition statement. Moved method implementation to cpp and reordered methods in cpp. Added documentation. Improved test coverage in all categories. Added padding to control statements. References #1169.
2013-01-11 Steven Lambright and Tracie Sucharski - Fixed support of writing blobs in very large cubes. This was caused by calling the wrong number to string conversion function. Introduced when refactoring the IString class. Fixes #1388.
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 |
Definition at line 28 of file Blob.cpp.
References p_blobName, p_blobPvl, p_buffer, p_labelFile, p_nbytes, p_type, and Isis::PvlContainer::setName().
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. |
Definition at line 49 of file Blob.cpp.
References Isis::FileName::expanded(), p_blobName, p_buffer, p_labelFile, p_nbytes, p_type, and Read().
Isis::Blob::Blob | ( | const Blob & | other | ) |
This copies the blob object.
other | Blob to be copied |
Definition at line 65 of file Blob.cpp.
References p_blobName, p_blobPvl, p_buffer, p_detached, p_labelFile, p_nbytes, p_startByte, and p_type.
|
virtual |
|
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) |
Definition at line 167 of file Blob.cpp.
References Isis::PvlContainer::deleteKeyword(), Isis::PvlObject::hasKeyword(), Isis::PvlObject::object(), p_blobName, p_blobPvl, p_detached, p_labelFile, p_nbytes, p_startByte, p_type, Isis::FileName::path(), Isis::IException::Programmer, and Isis::IException::Unknown.
Referenced by Read().
char * Isis::Blob::getBuffer | ( | ) |
Get the internal data buff of the Blob.
Definition at line 546 of file Blob.cpp.
References p_buffer.
Referenced by Isis::CSMCamera::CSMCamera().
PvlObject & Isis::Blob::Label | ( | ) |
QString Isis::Blob::Name | ( | ) | const |
Accessor method that returns a string containing the Blob name.
Definition at line 133 of file Blob.cpp.
References p_blobName.
This makes the two blob objects exactly the same (copies the blob)
other | Blob to be copied |
Definition at line 92 of file Blob.cpp.
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 |
Definition at line 313 of file Blob.cpp.
References Isis::Message::FileOpen(), Find(), Isis::IException::Io, p_blobName, p_detached, p_type, ReadData(), and ReadInit().
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 |
Definition at line 279 of file Blob.cpp.
References Isis::Message::FileOpen(), Isis::IException::Io, p_blobName, p_type, and Read().
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 |
Definition at line 255 of file Blob.cpp.
References p_type, Isis::Pvl::read(), Read(), and Isis::IException::Unknown.
|
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 |
Definition at line 351 of file Blob.cpp.
References Isis::IException::Io, p_blobName, p_buffer, p_nbytes, p_startByte, and p_type.
Referenced by Read().
|
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 |
Definition at line 382 of file Blob.cpp.
References takeData().
int Isis::Blob::Size | ( | ) | const |
Accessor method that returns the number of bytes in the blob data.
Definition at line 142 of file Blob.cpp.
References p_nbytes.
Referenced by Isis::CSMCamera::CSMCamera().
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 |
Definition at line 398 of file Blob.cpp.
References p_buffer, and p_nbytes.
Referenced by setData().
QString Isis::Blob::Type | ( | ) | const |
Accessor method that returns a string containing the Blob type.
Definition at line 124 of file Blob.cpp.
References p_type.
Referenced by Isis::Image::isFootprintable(), and Isis::Shape::isFootprintable().
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 |
Definition at line 417 of file Blob.cpp.
References Isis::PvlObject::addObject(), Isis::IException::Io, p_blobName, p_blobPvl, p_nbytes, p_startByte, p_type, Isis::toString(), WriteData(), and WriteInit().
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 |
Definition at line 466 of file Blob.cpp.
References Isis::PvlObject::addObject(), Isis::PvlContainer::deleteKeyword(), Isis::PvlContainer::name(), Isis::PvlObject::object(), p_blobPvl, p_nbytes, p_type, Isis::toString(), WriteData(), and WriteInit().
|
protectedvirtual |
Writes blob data to a stream.
stream | Output steam blob data will be written to |
IException::Io | - Error writing data to stream |
Definition at line 564 of file Blob.cpp.
References Isis::IException::Io, p_blobName, p_buffer, p_nbytes, and p_type.
|
protectedvirtual |
|
protected |
Name of the Blob object.
Definition at line 91 of file Blob.h.
Referenced by Blob(), Blob(), Blob(), Find(), Name(), operator=(), Read(), Read(), ReadData(), Write(), and WriteData().
|
protected |
|
protected |
Buffer blob data is stored in.
Definition at line 93 of file Blob.h.
Referenced by Blob(), Blob(), Blob(), getBuffer(), operator=(), ReadData(), takeData(), WriteData(), and ~Blob().
|
protected |
|
protected |
|
protected |
Size of blob data (in bytes)
Definition at line 95 of file Blob.h.
Referenced by Blob(), Blob(), Blob(), Find(), operator=(), ReadData(), Size(), takeData(), Write(), Write(), and WriteData().
|
protected |
Byte blob data starts at in buffer.
Definition at line 94 of file Blob.h.
Referenced by Blob(), Find(), operator=(), ReadData(), and Write().
|
protected |
Type of data stored in the buffer.
Definition at line 96 of file Blob.h.
Referenced by Blob(), Blob(), Blob(), Find(), operator=(), Read(), Read(), Read(), ReadData(), Type(), Write(), Write(), and WriteData().