File failed to load: https://isis.astrogeology.usgs.gov/dev/Object/assets/jax/output/NativeMML/config.js
Isis Developer Reference
Blob.h
Go to the documentation of this file.
1#ifndef Blob_h
2#define Blob_h
7
8/* SPDX-License-Identifier: CC0-1.0 */
9
10#include <string>
11#include <QList>
12#include <QPair>
13
14#include "gdal_priv.h"
15
16#include "PvlObject.h"
17
18namespace Isis {
19 bool IsBlob(PvlObject &obj);
20 class Pvl;
53 class Blob {
54 public:
55 Blob(const QString &name, const QString &type);
56 Blob(const QString &name, const QString &type,
57 const QString &file);
58 Blob(const Blob &other);
59 Blob() = default;
60 Blob &operator=(const Blob &other);
61
62 virtual ~Blob();
63
64 QString Type() const;
65 QString Name() const;
66 int Size() const;
68
69 void Read(const QString &file, const std::vector<PvlKeyword>
70 keywords=std::vector<PvlKeyword>());
71 void Read(const QString &file, const Pvl &pvlLabels,
72 const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
73 virtual void Read(const Pvl &pvl, std::istream &is,
74 const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
75 void ReadData(std::string &hexdata);
76
77 void Write(const QString &file);
78 void Write(Pvl &pvl, std::fstream &stm,
79 const QString &detachedFileName = "", bool overwrite=true, bool inline_data=true);
80 void WriteGdal(GDALDataset *dataset);
81 void ReadGdal(GDALDataset *dataset);
82
83 char *getBuffer();
84 void setData(const char *buffer, int nbytes);
85 void takeData(char *buffer, int nbytes);
86
87 protected:
88 void Find(const Pvl &pvl, const std::vector<PvlKeyword> keywords = std::vector<PvlKeyword>());
89 virtual void ReadInit();
90 virtual void ReadData(std::istream &is);
91 virtual void WriteInit();
92 virtual void WriteData(std::fstream &os);
93 virtual void WriteData(std::stringstream &os);
94
96 QString p_blobName;
97
98 char *p_buffer;
101 QString p_type;
102 QString p_detached;
103 QString p_labelFile;
104 };
105};
106
107#endif
PvlObject p_blobPvl
Pvl Blob object.
Definition Blob.h:95
int Size() const
Accessor method that returns the number of bytes in the blob data.
Definition Blob.cpp:148
void setData(const char *buffer, int nbytes)
Set the data stored in the BLOB.
Definition Blob.cpp:416
Blob(const QString &name, const QString &type)
Constructs a Blob object using a name and type.
Definition Blob.cpp:34
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:288
QString p_labelFile
The file containing the labels.
Definition Blob.h:103
void Write(const QString &file)
Write the blob data out to a file.
Definition Blob.cpp:499
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition Blob.cpp:130
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:173
BigInt p_startByte
Byte blob data starts at in buffer.
Definition Blob.h:99
virtual void WriteInit()
This virtual method for classes that inherit Blob.
Definition Blob.cpp:635
void ReadGdal(GDALDataset *dataset)
Definition Blob.cpp:253
Blob()=default
virtual void ReadInit()
This virtual method for classes that inherit Blob.
Definition Blob.cpp:374
void WriteGdal(GDALDataset *dataset)
Definition Blob.cpp:450
QString Name() const
Accessor method that returns a string containing the Blob name.
Definition Blob.cpp:139
char * getBuffer()
Get the internal data buff of the Blob.
Definition Blob.cpp:627
virtual void WriteData(std::fstream &os)
Writes blob data to a stream.
Definition Blob.cpp:645
PvlObject & Label()
Accessor method that returns a PvlObject containing the Blob label.
Definition Blob.cpp:157
QString p_type
Type of data stored in the buffer.
Definition Blob.h:101
QString p_detached
Used for reading detached blobs.
Definition Blob.h:102
int p_nbytes
Size of blob data (in bytes)
Definition Blob.h:100
void takeData(char *buffer, int nbytes)
Set the data stored in the BLOB without copying it.
Definition Blob.cpp:440
Blob & operator=(const Blob &other)
This makes the two blob objects exactly the same (copies the blob)
Definition Blob.cpp:98
virtual ~Blob()
Destroys the Blob object.
Definition Blob.cpp:121
char * p_buffer
Buffer blob data is stored in.
Definition Blob.h:98
QString p_blobName
Name of the Blob object.
Definition Blob.h:96
void ReadData(std::string &hexdata)
Writes blob data to a stream.
Definition Blob.cpp:683
Container for cube-like labels.
Definition Pvl.h:122
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
bool IsBlob(PvlObject &obj)
Checks pvl object and returns whether or not it is a Blob.
Definition Blob.cpp:710
long long int BigInt
Big int.
Definition Constants.h:49