File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
OriginalLabel.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <fstream>
8 #include <sstream>
9 #include <string>
10 #include "OriginalLabel.h"
11 #include "Application.h"
12 #include "PvlObject.h"
13 
14 using namespace std;
15 namespace Isis {
19  OriginalLabel::OriginalLabel() {
20  m_originalLabel.setTerminator("");
21  }
22 
23 
27  OriginalLabel::OriginalLabel(Isis::Blob &blob) {
28  fromBlob(blob);
29  }
30 
31 
38  OriginalLabel::OriginalLabel(const QString &file){
39  Blob blob = Blob("IsisCube", "OriginalLabel");
40  blob.Read(file);
41  fromBlob(blob);
42  }
43 
44 
51  OriginalLabel::OriginalLabel(Pvl pvl){
52  m_originalLabel = pvl;
53  }
54 
55  // Destructor
56  OriginalLabel::~OriginalLabel() {
57  }
58 
59 
65  void OriginalLabel::fromBlob(Isis::Blob blob) {
66  Pvl pvl;
67  stringstream os;
68  char *buff = blob.getBuffer();
69  for(int i = 0; i < blob.Size(); i++){
70  os << buff[i];
71  }
72  os >> pvl;
73  m_originalLabel = pvl;
74  }
75 
76 
82  Isis::Blob OriginalLabel::toBlob() {
83  std::stringstream sstream;
84  sstream << m_originalLabel;
85  string orglblStr = sstream.str();
86  Isis::Blob blob("IsisCube", "OriginalLabel");
87  blob.setData(orglblStr.c_str(), orglblStr.size());
88  return blob;
89  }
90 
91 
97  Pvl OriginalLabel::ReturnLabels() const {
98  return m_originalLabel;
99  }
100 }
Isis::Blob::setData
void setData(const char *buffer, int nbytes)
Set the data stored in the BLOB.
Definition: Blob.cpp:382
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
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::Blob::getBuffer
char * getBuffer()
Get the internal data buff of the Blob.
Definition: Blob.cpp:546
Isis::Blob::Size
int Size() const
Accessor method that returns the number of bytes in the blob data.
Definition: Blob.cpp:142
std
Namespace for the standard library.
Isis::Blob
Definition: Blob.h:51
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

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:16:58