Isis 3.0 Programmer Reference
Back
|
Home
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
History.cpp
Go to the documentation of this file.
1
23
#include "
History.h
"
24
25
#include <fstream>
26
#include <sstream>
27
#include <string>
28
29
#include "
Application.h
"
30
#include "
PvlObject.h
"
31
32
using namespace
std;
33
34
namespace
Isis {
35
40
History::History(
const
QString &name) : Isis::
Blob
(name,
"History"
) {
41
p_history
.
setTerminator
(
""
);
42
}
43
49
History::History
(
const
QString &name,
const
QString &file) :
50
Isis::
Blob
(name,
"History"
) {
51
Blob::Read
(file);
52
}
53
55
History::~History
() {
56
}
57
61
void
History::AddEntry
() {
62
PvlObject
hist = Isis::iApp->
History
();
63
AddEntry
(hist);
64
}
65
71
void
History::AddEntry
(
Isis::PvlObject
&obj) {
72
p_history
.
addObject
(obj);
73
}
74
78
void
History::WriteInit
() {
79
ostringstream ostr;
80
if
(
p_nbytes
> 0) ostr << std::endl;
81
ostr <<
p_history
;
82
string
histStr = ostr.str();
83
int
bytes = histStr.size();
84
85
char
*temp =
p_buffer
;
86
p_buffer
=
new
char
[
p_nbytes
+bytes];
87
if
(temp != NULL) memcpy(
p_buffer
, temp,
p_nbytes
);
88
const
char
*ptr = histStr.c_str();
89
memcpy(&
p_buffer
[
p_nbytes
], (
void
*)ptr, bytes);
90
p_nbytes += bytes;
91
92
if
(temp != NULL)
delete
[] temp;
93
}
94
100
Pvl
History::ReturnHist
() {
101
Pvl
pvl;
102
stringstream os;
103
for
(
int
i = 0; i <
p_nbytes
; i++) os <<
p_buffer
[i];
104
os >> pvl;
105
return
pvl;
106
}
107
114
void
History::Read
(
const
Isis::Pvl
&pvl, std::istream &is) {
115
try
{
116
Blob::Read
(pvl, is);
117
}
118
catch
(
IException
&e) {
119
}
120
}
121
}
Isis::Blob::Read
void Read(const QString &file)
This method reads Pvl values from a specified file.
Definition:
Blob.cpp:243
Isis::History::WriteInit
void WriteInit()
This virtual method for classes that inherit Blob.
Definition:
History.cpp:78
Isis::Blob::p_nbytes
int p_nbytes
Size of blob data (in bytes)
Definition:
Blob.h:99
Isis::History::ReturnHist
Pvl ReturnHist()
Reads p_buffer into a pvl.
Definition:
History.cpp:100
Isis::History::~History
~History()
Destructor.
Definition:
History.cpp:55
Isis::Blob::p_buffer
char * p_buffer
Buffer blob data is stored in.
Definition:
Blob.h:97
Isis::History::p_history
Pvl p_history
History Pvl.
Definition:
History.h:66
Isis::PvlObject::addObject
void addObject(const PvlObject &object)
Add a PvlObject.
Definition:
PvlObject.h:319
Isis::Pvl::setTerminator
void setTerminator(const QString &term)
Sets the terminator used to signify the end of the PVL informationDefaults to "END".
Definition:
Pvl.h:159
Isis::Blob
Definition:
Blob.h:64
Isis::History::Read
void Read(const Isis::Pvl &pvl, std::istream &is)
Reads input stream into Pvl.
Definition:
History.cpp:114
PvlObject.h
Isis::History::History
History(const QString &name)
Constructor for reading a history blob.
Definition:
History.cpp:40
Isis::Pvl
Container for cube-like labels.
Definition:
Pvl.h:135
Isis::Application::History
PvlObject History()
Creates an application history PvlObject.
Definition:
Application.cpp:267
Isis::History::AddEntry
void AddEntry()
Adds History PvlObject.
Definition:
History.cpp:61
Isis::IException
Isis exception class.
Definition:
IException.h:99
History.h
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition:
PvlObject.h:74
Application.h
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
ISIS Support Center
File Modified: 07/12/2023 23:19:44