1 // 2 // This file is part of the SDTS++ toolkit, written by the U.S. 3 // Geological Survey. It is experimental software, written to support 4 // USGS research and cartographic data production. 5 // 6 // SDTS++ is public domain software. It may be freely copied, 7 // distributed, and modified. The USGS welcomes user feedback, but makes 8 // no committment to any level of support for this code. See the SDTS 9 // web site at http://mcmcweb.er.usgs.gov/sdts for more information, 10 // including points of contact. 11 // 12 // 13 // sio_8211DirEntry.h 14 // 15 16 #ifndef INCLUDED_SIO_8211DIRENTRY_H 17 #define INCLUDED_SIO_8211DIRENTRY_H 18 19 20 #include <string> 21 22 #include <iostream> 23 #include <iomanip> 24 25 26 using std::string; 27 using std::ostream; 28 using std::istream; 29 30 31 32 class sio_8211Leader; 33 class sio_8211Field; 34 35 /// An ISO8211 Directory Entry. 36 class sio_8211DirEntry 37 { 38 public: 39 40 /** 41 You can't really construct a valid DirEntry without a 42 leader. This ctor allows sio_8211DirEntry to be stored in an 43 STL container. 44 */ 45 sio_8211DirEntry(); 46 47 48 /** 49 The leader is required to determine the widths of the various 50 subfields in a directory entry. Once the values are determined, 51 the leader is no longer required (may be deleted). 52 */ 53 sio_8211DirEntry(sio_8211Leader & leader); 54 55 /// 56 ~sio_8211DirEntry(); 57 58 /// We keep a ptr to the field we describe. We do not__ own it. 59 sio_8211Field const* getField() const; 60 61 /// 62 void setField(sio_8211Field const* field); 63 64 /// We keep a ptr to the leader we need for sizes. We do NOT own it. 65 sio_8211Leader const* getLeader() const; 66 67 /// 68 void setLeader(sio_8211Leader * leader); 69 70 /// 71 void setPosition(long pos); 72 73 /// 74 void setFieldLength( long length ); 75 76 /// 77 void setTag(string const& tag); 78 79 /// 80 long getFieldLength() const; 81 82 /// 83 long getPosition() const; 84 85 /// 86 string const& getTag() const; 87 88 /// 89 ostream& streamInsert(ostream& ostr) const; 90 91 friend istream& operator>>(istream& istr, sio_8211DirEntry& dirEntry); 92 friend ostream& operator<<(ostream& ostr, sio_8211DirEntry const& dirEntry); 93 94 private: 95 96 /// 97 long fieldLength_; 98 99 /// 100 long fieldPos_; 101 102 /// 103 string fieldTag_; 104 105 /// pointer to corresponding field 106 sio_8211Field const* field_; 107 108 /// pointer to corresponding leader 109 /** 110 leader's widths changed dynamically 111 with each sio_8211DirEntry::set*() 112 */ 113 sio_8211Leader * leader_; 114 115 }; // class sio_8211DirEntry 116 117 118 119 /// 120 istream& operator>>(istream& istr, sio_8211DirEntry& dirEntry); 121 122 /// 123 ostream& operator<<(ostream& ostr, sio_8211DirEntry const& dirEntry); 124 125 #endif // INCLUDED_SIO_8211DIRENTRY_H 126