Isis Developer Reference
Blob.h
Go to the documentation of this file.
1 #ifndef Blob_h
2 #define Blob_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <string>
11 #include <QList>
12 #include <QPair>
13 
14 #include "PvlObject.h"
15 
16 namespace Isis {
17  bool IsBlob(PvlObject &obj);
18  class Pvl;
51  class Blob {
52  public:
53  Blob(const QString &name, const QString &type);
54  Blob(const QString &name, const QString &type,
55  const QString &file);
56  Blob(const Blob &other);
57  Blob() = default;
58  Blob &operator=(const Blob &other);
59 
60  virtual ~Blob();
61 
62  QString Type() const;
63  QString Name() const;
64  int Size() const;
65  PvlObject &Label();
66 
67  void Read(const QString &file, const std::vector<PvlKeyword>
68  keywords=std::vector<PvlKeyword>());
69  void Read(const QString &file, const Pvl &pvlLabels,
70  const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
71  virtual void Read(const Pvl &pvl, std::istream &is,
72  const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
73 
74  void Write(const QString &file);
75  void Write(Pvl &pvl, std::fstream &stm,
76  const QString &detachedFileName = "", bool overwrite=true);
77 
78 
79  char *getBuffer();
80  void setData(const char *buffer, int nbytes);
81  void takeData(char *buffer, int nbytes);
82 
83  protected:
84  void Find(const Pvl &pvl, const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
85  virtual void ReadInit();
86  virtual void ReadData(std::istream &is);
87  virtual void WriteInit();
88  virtual void WriteData(std::fstream &os);
89 
91  QString p_blobName;
92 
93  char *p_buffer;
95  int p_nbytes;
96  QString p_type;
97  QString p_detached;
98  QString p_labelFile;
99  };
100 };
101 
102 #endif
Isis::Blob::WriteInit
virtual void WriteInit()
This virtual method for classes that inherit Blob.
Definition: Blob.cpp:554
Isis::IsBlob
bool IsBlob(PvlObject &obj)
Checks pvl object and returns whether or not it is a Blob.
Definition: Blob.cpp:580
FileName.h
Isis::Blob::takeData
void takeData(char *buffer, int nbytes)
Set the data stored in the BLOB without copying it.
Definition: Blob.cpp:398
Isis::Blob::p_startByte
BigInt p_startByte
Byte blob data starts at in buffer.
Definition: Blob.h:94
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Blob::Type
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition: Blob.cpp:124
Isis::Blob::setData
void setData(const char *buffer, int nbytes)
Set the data stored in the BLOB.
Definition: Blob.cpp:382
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::Message::FileOpen
QString FileOpen(const QString &filename)
This error should be used when a file could not be opened.
Definition: FileOpen.cpp:11
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::Blob::operator=
Blob & operator=(const Blob &other)
This makes the two blob objects exactly the same (copies the blob)
Definition: Blob.cpp:92
Isis::PvlObject::objects
int objects() const
Returns the number of objects.
Definition: PvlObject.h:219
Isis::PvlObject::addObject
void addObject(const PvlObject &object)
Add a PvlObject.
Definition: PvlObject.h:307
Isis::Blob::Find
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.
Definition: Blob.cpp:167
Isis::Pvl::write
void write(const QString &file)
Opens and writes PVL information to a file and handles the end of line sequence.
Definition: Pvl.cpp:130
Isis::Blob::p_labelFile
QString p_labelFile
The file containing the labels.
Definition: Blob.h:98
Isis::PvlObject::object
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:489
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::Blob::Name
QString Name() const
Accessor method that returns a string containing the Blob name.
Definition: Blob.cpp:133
Isis::Blob::p_blobPvl
PvlObject p_blobPvl
Pvl Blob object.
Definition: Blob.h:90
Isis::Blob::Write
void Write(const QString &file)
Write the blob data out to a file.
Definition: Blob.cpp:417
Isis::Blob::Read
void Read(const QString &file, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >())
This method reads Pvl values from a specified file.
Definition: Blob.cpp:255
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::Pvl::read
void read(const QString &file)
Loads PVL information from a stream.
Definition: Pvl.cpp:90
Isis::PvlContainer::isNamed
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Definition: PvlContainer.h:72
Isis::Blob::getBuffer
char * getBuffer()
Get the internal data buff of the Blob.
Definition: Blob.cpp:546
Isis::Blob::Label
PvlObject & Label()
Accessor method that returns a PvlObject containing the Blob label.
Definition: Blob.cpp:151
Isis::PvlObject::hasKeyword
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
Definition: PvlObject.cpp:236
Blob.h
Isis::BigInt
long long int BigInt
Big int.
Definition: Constants.h:49
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::Blob::p_detached
QString p_detached
Used for reading detached blobs.
Definition: Blob.h:97
Isis::PvlContainer::name
QString name() const
Returns the container name.
Definition: PvlContainer.h:63
Isis::Blob::p_type
QString p_type
Type of data stored in the buffer.
Definition: Blob.h:96
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Blob::Size
int Size() const
Accessor method that returns the number of bytes in the blob data.
Definition: Blob.cpp:142
Isis::Blob::p_buffer
char * p_buffer
Buffer blob data is stored in.
Definition: Blob.h:93
Isis::Blob::ReadInit
virtual void ReadInit()
This virtual method for classes that inherit Blob.
Definition: Blob.cpp:341
IException.h
std
Namespace for the standard library.
Isis::Blob::ReadData
virtual void ReadData(std::istream &is)
Read binary data from an input stream into the Blob object.
Definition: Blob.cpp:351
Isis::Blob::Blob
Blob()=default
PvlObject.h
Isis::Blob::p_nbytes
int p_nbytes
Size of blob data (in bytes)
Definition: Blob.h:95
Isis::PvlObject::findKeyword
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Definition: PvlObject.cpp:177
Isis::PvlKeyword::isEquivalent
bool isEquivalent(QString string1, int index=0) const
Checks to see if a value with a specified index is equivalent to another QString.
Definition: PvlKeyword.cpp:562
Isis::Blob::~Blob
virtual ~Blob()
Destroys the Blob object.
Definition: Blob.cpp:115
Isis::Blob
Definition: Blob.h:51
Isis::Blob::WriteData
virtual void WriteData(std::fstream &os)
Writes blob data to a stream.
Definition: Blob.cpp:564
Isis::Blob::p_blobName
QString p_blobName
Name of the Blob object.
Definition: Blob.h:91
Isis::FileName::path
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:103
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Message.h