Isis 3 Programmer Reference
OriginalLabel.cpp
Go to the documentation of this file.
1 
23 #include <fstream>
24 #include <sstream>
25 #include <string>
26 #include "OriginalLabel.h"
27 #include "Application.h"
28 #include "PvlObject.h"
29 
30 using namespace std;
31 namespace Isis {
35  OriginalLabel::OriginalLabel() : Isis::Blob("IsisCube", "OriginalLabel") {
36  m_originalLabel.setTerminator("");
37  }
38 
45  OriginalLabel::OriginalLabel(const QString &file) :
46  Isis::Blob("IsisCube", "OriginalLabel") {
47  Blob::Read(file);
48  }
49 
56  OriginalLabel::OriginalLabel(Pvl pvl) : Isis::Blob("IsisCube", "OriginalLabel") {
57  m_originalLabel = pvl;
58  }
59 
60  // Destructor
61  OriginalLabel::~OriginalLabel() {
62  }
63 
68  ostringstream ostr;
69  if(p_nbytes > 0) ostr << std::endl;
70 
71  // store labels
72  ostr << m_originalLabel;
73  string orglblStr = ostr.str();
74  int bytes = orglblStr.size();
75 
76  // Copy label data to bytes variable
77  char *temp = p_buffer;
78  p_buffer = new char[p_nbytes+bytes];
79  if(temp != NULL) memcpy(p_buffer, temp, p_nbytes);
80  const char *ptr = orglblStr.c_str();
81  memcpy(&p_buffer[p_nbytes], (void *)ptr, bytes);
82  p_nbytes += bytes;
83 
84  if(temp != NULL) delete [] temp;
85  }
86 
93  Pvl pvl;
94  stringstream os;
95  for(int i = 0; i < p_nbytes; i++) os << p_buffer[i];
96  os >> pvl;
97  return pvl;
98  }
99 }
Pvl ReturnLabels()
Returns the labels in a Pvl object.
void WriteInit()
Prepare labels for writing to the output cube.
void Read(const QString &file)
This method reads Pvl values from a specified file.
Definition: Blob.cpp:243
Namespace for the standard library.
int p_nbytes
Size of blob data (in bytes)
Definition: Blob.h:99
char * p_buffer
Buffer blob data is stored in.
Definition: Blob.h:97
OriginalLabel()
Constructor for creating an original blob with a given name.
void setTerminator(const QString &term)
Sets the terminator used to signify the end of the PVL informationDefaults to "END".
Definition: Pvl.h:159
Container for cube-like labels.
Definition: Pvl.h:135
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31