OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
VolumeDir.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // "Copyright Centre National d'Etudes Spatiales"
4 //
5 // License: LGPL
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
15 
16 
17 namespace ossimplugins
18 {
19 const int VolumeDir::TextRecordID = 1;
24 
26 {
27 }
28 
30 {
31  ClearRecords();
32 }
33 
35 {
36  std::map<int, RadarSatRecord*>::const_iterator it = data._records.begin();
37  while(it != data._records.end())
38  {
39  (*it).second->Write(os);
40  ++it;
41  }
42  return os;
43 
44 }
45 
47 {
48  VolumeDirFactory factory;
49 
50  data.ClearRecords();
51 
52  RadarSatRecordHeader header;
53  bool eof = false;
54  while(!eof)
55  {
56  is>>header;
57  if(is.eof())
58  {
59  eof = true;
60  }
61  else
62  {
63  RadarSatRecord* record = factory.Instanciate(header.get_rec_seq());
64  if (record != NULL)
65  {
66  record->Read(is);
67  data._records[header.get_rec_seq()] = record;
68  }
69  else
70  {
71  char* buff = new char[header.get_length()-12];
72  is.read(buff, header.get_length()-12);
73  delete[] buff;
74  }
75  }
76  }
77  return is;
78 }
79 
80 
82 {
83  std::map<int, RadarSatRecord*>::const_iterator it = rhs._records.begin();
84  while(it != rhs._records.end())
85  {
86  _records[(*it).first] = (*it).second->Clone();
87  ++it;
88  }
89 }
90 
92 {
93  ClearRecords();
94  std::map<int, RadarSatRecord*>::const_iterator it = rhs._records.begin();
95  while(it != rhs._records.end())
96  {
97  _records[(*it).first] = (*it).second->Clone();
98  ++it;
99  }
100 
101  return *this;
102 }
103 
105 {
106  std::map<int, RadarSatRecord*>::const_iterator it = _records.begin();
107  while(it != _records.end())
108  {
109  delete (*it).second;
110  ++it;
111  }
112  _records.clear();
113 }
114 
116 {
118 }
119 
121 {
123 }
124 
126 {
128 }
129 
131 {
132  return (TextRecord*)_records[TextRecordID];
133 }
134 
136 {
138 }
139 }
static const int SARLeaderFilePointerRecordID
Definition: VolumeDir.h:82
SARTrailerFilePointerRecord * get_SARTrailerFilePointerRecord()
Definition: VolumeDir.cpp:125
TextRecord * get_TextRecord()
Definition: VolumeDir.cpp:130
static const int TextRecordID
Definition: VolumeDir.h:85
RadarSatRecord * Instanciate(int id)
Instanciates a new Record.
This class is able to read the volume directory file of the RadarSat file structure.
Definition: VolumeDir.h:34
VolumeDir & operator=(const VolumeDir &rhs)
Copy operator.
Definition: VolumeDir.cpp:91
This class is able to read the Text record of the volume directory file.
Definition: TextRecord.h:26
This class is the base class of all the record classes.
virtual void Read(std::istream &is)=0
Reads the class data from a stream.
VolumeDir()
Constructor.
Definition: VolumeDir.cpp:25
This class is able to read the SAR leader file descriptor record of the leader file.
std::map< int, RadarSatRecord * > _records
Definition: VolumeDir.h:79
This class is able to read the SAR leader file descriptor record of the leader file.
std::ostream & operator<<(std::ostream &os, const AlosPalsarData &data)
static const int ImageOptionsFilePointerRecordID
Definition: VolumeDir.h:83
VolumeDescriptorRecord * get_VolumeDescriptorRecord()
Definition: VolumeDir.cpp:135
static const int SARTrailerFilePointerRecordID
Definition: VolumeDir.h:84
~VolumeDir()
Destructor.
Definition: VolumeDir.cpp:29
std::istream & operator>>(std::istream &is, AlosPalsarData &data)
This class is a factory able to construct Record base classes.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
This class is able to read a record header.
ImageOptionsFilePointerRecord * get_ImageOptionsFilePointerRecord()
Definition: VolumeDir.cpp:120
static const int VolumeDescriptorRecordID
Definition: VolumeDir.h:81
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
SARLeaderFilePointerRecord * get_SARLeaderFilePointerRecord()
Definition: VolumeDir.cpp:115
void ClearRecords()
Removes all the previous records from the VolumeDir.
Definition: VolumeDir.cpp:104