Isis Developer Reference
Isis::Blob Class Reference

#include <Blob.h>

Collaboration diagram for Isis::Blob:
Collaboration graph

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 ()=default
 
Bloboperator= (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.
 
PvlObjectLabel ()
 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.
 

Detailed Description

Author
????-??-?? Unknown

Constructor & Destructor Documentation

◆ Blob() [1/4]

Isis::Blob::Blob ( const QString & name,
const QString & type )

Constructs a Blob object using a name and type.

Parameters
nameThe blob name
typeThe blob type

References p_blobName, p_blobPvl, p_buffer, p_labelFile, p_nbytes, p_type, and Isis::PvlContainer::setName().

◆ Blob() [2/4]

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.

Parameters
nameThe blob name
typeThe blob type
fileThe filename to read from.

References Isis::FileName::expanded(), p_blobName, p_buffer, p_labelFile, p_nbytes, p_type, and Read().

◆ Blob() [3/4]

Isis::Blob::Blob ( const Blob & other)

This copies the blob object.

Parameters
otherBlob to be copied

References p_blobName, p_blobPvl, p_buffer, p_detached, p_labelFile, p_nbytes, p_startByte, and p_type.

◆ Blob() [4/4]

Isis::Blob::Blob ( )
default

◆ ~Blob()

Isis::Blob::~Blob ( )
virtual

Destroys the Blob object.

References p_buffer.

Member Function Documentation

◆ Find()

void Isis::Blob::Find ( const Pvl & pvl,
const std::vector< PvlKeyword > keywords = std::vector<PvlKeyword>() )
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.

Parameters
pvlThe Pvl to be searched
keywordsA 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::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().

◆ getBuffer()

char * Isis::Blob::getBuffer ( )

Get the internal data buff of the Blob.

Returns
char* A data buffer containing Blob::Size bytes

References p_buffer.

Referenced by Isis::CSMCamera::CSMCamera().

◆ Label()

PvlObject & Isis::Blob::Label ( )

Accessor method that returns a PvlObject containing the Blob label.

Returns
PvlObject The label of the blob.

References p_blobPvl.

Referenced by Isis::CSMCamera::CSMCamera().

◆ Name()

QString Isis::Blob::Name ( ) const

Accessor method that returns a string containing the Blob name.

Returns
string The name of the blob.

References p_blobName.

◆ operator=()

Blob & Isis::Blob::operator= ( const Blob & other)

This makes the two blob objects exactly the same (copies the blob)

Parameters
otherBlob to be copied
Returns
Copied Blob

References p_blobName, p_blobPvl, p_buffer, p_detached, p_labelFile, p_nbytes, p_startByte, and p_type.

◆ Read() [1/3]

void Isis::Blob::Read ( const Pvl & pvl,
std::istream & istm,
const std::vector< PvlKeyword > keywords = std::vector<PvlKeyword>() )
virtual

This method reads the Blob data from an open input file stream.

Parameters
pvlA Pvl containing the label information.
istmThe input file stream containing the blob data to be read.
Exceptions
iException::Io- Unable to open file

References _FILEINFO_, Isis::Message::FileOpen(), Find(), Isis::IException::Io, p_blobName, p_detached, p_type, ReadData(), and ReadInit().

◆ Read() [2/3]

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.

Parameters
fileThe filename to read from.
pvlLabelsA Pvl containing the label information.
Exceptions
iException::Io- Unable to open file

References _FILEINFO_, Isis::Message::FileOpen(), Isis::IException::Io, p_blobName, p_type, and Read().

◆ Read() [3/3]

void Isis::Blob::Read ( const QString & file,
const std::vector< PvlKeyword > keywords = std::vector<PvlKeyword>() )

This method reads Pvl values from a specified file.

Parameters
fileThe filename to read from.
Exceptions
iException::Io- Unable to open file
iException::Pvl- Invalid label format

References _FILEINFO_, p_type, Isis::Pvl::read(), Read(), and Isis::IException::Unknown.

Referenced by Blob(), Read(), and Read().

◆ ReadData()

void Isis::Blob::ReadData ( std::istream & stream)
protectedvirtual

Read binary data from an input stream into the Blob object.

Parameters
streamThe input stream to read from.
Exceptions
IException::Io- Error reading data from stream

References _FILEINFO_, Isis::IException::Io, p_blobName, p_buffer, p_nbytes, p_startByte, and p_type.

Referenced by Read().

◆ ReadInit()

void Isis::Blob::ReadInit ( )
protectedvirtual

This virtual method for classes that inherit Blob.

It is not defined in the Blob class.

Referenced by Read().

◆ setData()

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.

Parameters
bufferThe buffer of data. The BLOB does not take ownership of this, the caller is still responsible for cleaning it up.
nbytesThe amount of data in the buffer

References takeData().

◆ Size()

int Isis::Blob::Size ( ) const

Accessor method that returns the number of bytes in the blob data.

Returns
int Number of bytes in the blob data.

References p_nbytes.

Referenced by Isis::CSMCamera::CSMCamera().

◆ takeData()

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.

Parameters
bufferThe buffer of data. The BLOB takes ownership of this.
nbytesThe amount of data in the buffer

References p_buffer, and p_nbytes.

Referenced by setData().

◆ Type()

QString Isis::Blob::Type ( ) const

Accessor method that returns a string containing the Blob type.

Returns
string Type of blob.

References p_type.

Referenced by Isis::Image::isFootprintable(), and Isis::Shape::isFootprintable().

◆ Write() [1/2]

void Isis::Blob::Write ( const QString & file)

Write the blob data out to a file.

Parameters
fileThe filename to write to.
Exceptions
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::IException::Io, p_blobName, p_blobPvl, p_nbytes, p_startByte, p_type, Isis::toString(), WriteData(), and WriteInit().

◆ Write() [2/2]

void Isis::Blob::Write ( Pvl & pvl,
std::fstream & stm,
const QString & detachedFileName = "",
bool overwrite = true )

Write the blob data out to a Pvl object.

Parameters
pvlThe pvl object to update
stmstream to write data to
detachedFileNameIf the stream is detached from the labels give the name of the file

References Isis::PvlObject::addObject(), Isis::PvlContainer::deleteKeyword(), Isis::PvlContainer::name(), Isis::PvlObject::object(), p_blobPvl, p_nbytes, p_type, Isis::toString(), WriteData(), and WriteInit().

◆ WriteData()

void Isis::Blob::WriteData ( std::fstream & stream)
protectedvirtual

Writes blob data to a stream.

Parameters
streamOutput steam blob data will be written to
Exceptions
IException::Io- Error writing data to stream

References _FILEINFO_, Isis::IException::Io, p_blobName, p_buffer, p_nbytes, and p_type.

Referenced by Write(), and Write().

◆ WriteInit()

void Isis::Blob::WriteInit ( )
protectedvirtual

This virtual method for classes that inherit Blob.

It is not defined in the Blob class.

Referenced by Write(), and Write().

Member Data Documentation

◆ p_blobName

QString Isis::Blob::p_blobName
protected

Name of the Blob object.

Referenced by Blob(), Blob(), Blob(), Find(), Name(), operator=(), Read(), Read(), ReadData(), Write(), and WriteData().

◆ p_blobPvl

PvlObject Isis::Blob::p_blobPvl
protected

Pvl Blob object.

Referenced by Blob(), Blob(), Find(), Label(), operator=(), Write(), and Write().

◆ p_buffer

char* Isis::Blob::p_buffer
protected

Buffer blob data is stored in.

Referenced by Blob(), Blob(), Blob(), getBuffer(), operator=(), ReadData(), takeData(), WriteData(), and ~Blob().

◆ p_detached

QString Isis::Blob::p_detached
protected

Used for reading detached blobs.

Referenced by Blob(), Find(), operator=(), and Read().

◆ p_labelFile

QString Isis::Blob::p_labelFile
protected

The file containing the labels.

Referenced by Blob(), Blob(), Blob(), Find(), and operator=().

◆ p_nbytes

int Isis::Blob::p_nbytes
protected

Size of blob data (in bytes)

Referenced by Blob(), Blob(), Blob(), Find(), operator=(), ReadData(), Size(), takeData(), Write(), Write(), and WriteData().

◆ p_startByte

BigInt Isis::Blob::p_startByte
protected

Byte blob data starts at in buffer.

Referenced by Blob(), Find(), operator=(), ReadData(), and Write().

◆ p_type

QString Isis::Blob::p_type
protected

Type of data stored in the buffer.

Referenced by Blob(), Blob(), Blob(), Find(), operator=(), Read(), Read(), Read(), ReadData(), Type(), Write(), Write(), and WriteData().


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