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 // $Id: sb_Pnts.h,v 1.2 2002/11/24 22:07:42 mcoletti Exp $ 13 // 14 #ifndef INCLUDED_SB_PNTS_H 15 #define INCLUDED_SB_PNTS_H 16 17 18 19 #include <memory> 20 #include <list> 21 #include <string> 22 23 #ifndef SB_MODULE_H 24 #include <sdts++/builder/sb_Module.h> 25 #endif 26 27 #ifndef INCLUDED_SB_SPATIAL_H 28 #include <sdts++/builder/sb_Spatial.h> 29 #endif 30 31 #ifndef INCLUDED_SB_FOREIGNID_H 32 #include <sdts++/builder/sb_ForeignID.h> 33 #endif 34 35 #ifndef INCLUDED_SIO8211FIELDFORMAT_H 36 #include <sdts++/io/sio_8211FieldFormat.h> 37 #endif 38 39 40 class sc_Record; 41 42 43 // This class provides a convenient access to PNTS records. It provides 44 // members to access or set various module field and subfield values. 45 // It also provides a mechanism for populating an object of this class with 46 // values found in a valid sc_Record of this module, and for filling a 47 // sc_Record with the contents of a sb_Pnts object. 48 49 50 struct sb_Pnts_Imp; 51 52 class sb_Pnts : public sb_Module 53 { 54 public: 55 56 sb_Pnts(); 57 58 ~sb_Pnts(); 59 60 61 //@{ 62 /** 63 Use these members to get subfield/field values. Pass in an appropriate 64 type to receive the value. These members will return false if the 65 corresponding value is not set. (It may not be set because a value 66 was not assigned to it, or because you previously tried to assign 67 an invalid value.) Otherwise they will return true. 68 */ 69 bool getObjectRepresentation( std::string& val ) const; getOBRP(std::string & val)70 bool getOBRP( std::string& val ) const { return getObjectRepresentation( val ); } 71 72 bool getSpatialAddress( sb_Spatial& val ) const; getSADR(sb_Spatial & val)73 bool getSADR( sb_Spatial& val ) const { return getSpatialAddress( val ); } 74 75 bool getAttributeID( std::list<std::string> & val ) const; 76 bool getAttributeID( sb_AttributeIDs& val ) const; getATID(sb_AttributeIDs & val)77 bool getATID( sb_AttributeIDs& val ) const { return getAttributeID( val ); } 78 79 bool getLineID( sb_ForeignIDs& val ) const; 80 bool getLineID( std::list<std::string> & val ) const; getLNID(sb_ForeignIDs & val)81 bool getLNID( sb_ForeignIDs& val ) const { return getLineID( val ); } 82 83 bool getAreaID( sb_ForeignIDs& val ) const; 84 bool getAreaID( std::list<std::string> & val ) const; getARID(sb_ForeignIDs & val)85 bool getARID( sb_ForeignIDs& val ) const { return getAreaID( val ); } 86 87 bool getCompositeID( sb_ForeignIDs& val ) const; 88 bool getCompositeID( std::list<std::string> & val ) const; getCPID(sb_ForeignIDs & val)89 bool getCPID( sb_ForeignIDs& val ) const { return getCompositeID( val ); } 90 91 bool getRepresentationModuleID( sb_ForeignIDs& val ) const; 92 bool getRepresentationModuleID( std::list<std::string> & val ) const; getRPID(sb_ForeignIDs & val)93 bool getRPID( sb_ForeignIDs& val ) const { return getRepresentationModuleID( val ); } 94 95 bool getOrientationSpatialAddress( sb_ForeignIDs& val ) const; 96 bool getOrientationSpatialAddress( std::list<std::string> & val ) const; getOSAD(sb_ForeignIDs & val)97 bool getOSAD( sb_ForeignIDs& val ) const { return getOrientationSpatialAddress( val ); } 98 99 bool getAttributePrimaryForeignID( sb_ForeignIDs& val ) const; 100 bool getAttributePrimaryForeignID( std::list<std::string> & val ) const; getPAID(sb_ForeignIDs & val)101 bool getPAID( sb_ForeignIDs& val ) const { return getAttributePrimaryForeignID( val ); } 102 103 bool getArrtibuteLabel( std::list<std::string> & val ) const; 104 bool getArrtibuteLabel( sb_AttributeIDs& val ) const; getATLB(sb_AttributeIDs & val)105 bool getATLB( sb_AttributeIDs& val ) const { return getArrtibuteLabel( val ); } 106 107 bool getSymbolOrientationSpatialAddress( sb_Spatial& val ) const; getSSAD(sb_Spatial & val)108 bool getSSAD( sb_Spatial& val ) const { return getSymbolOrientationSpatialAddress( val ); } 109 110 //@} 111 112 /** 113 fill the given record based on the builder's object field/subfield 114 values -- return false if in a wedged state. (E.g., a mandatory 115 field isn't set or was assigned a value outside its proper 116 domain. 117 */ 118 bool getRecord( sc_Record& val ) const; 119 120 121 /** fills the given schema with one appropriate for PNTS 122 modules; returns false if unable to create the schema for some 123 bizarre reason. (Like maybe running out of memory.) Note that 124 an sio_Writer instance will need a schema generated from this 125 member. 126 */ 127 bool getSchema( sio_8211Schema& schema ) const; 128 129 130 /** set the object with values found in the record; if not a valid 131 PNTS record, this will return false 132 */ 133 bool setRecord( sc_Record const& val ); 134 135 136 //@{ 137 /** 138 Use these members to set subfield/field values. Pass in an appropriate 139 value for the particular subfield/field to be set to. They will return 140 false if you try to assign a value outside the domain of the given 141 subfield/field. (Note that this is not too pedantic; for example, we 142 do not check to see if a conditionally mandatory or optional field has 143 been set.) 144 */ 145 bool setObjectRepresentation( std::string const& val ); setOBRP(std::string const & val)146 bool setOBRP( std::string const& val ) { return setObjectRepresentation( val ); } 147 148 bool setSpatialAddress( sb_Spatial const& val ); setSADR(sb_Spatial const & val)149 bool setSADR( sb_Spatial const& val ) { return setSpatialAddress( val ); } 150 151 bool setAttributeID( sb_AttributeIDs const& val ); setATID(sb_AttributeIDs const & val)152 bool setATID( sb_AttributeIDs const& val ) { return setAttributeID( val ); } 153 154 bool setLineID( sb_ForeignIDs const& val ); setLNID(sb_ForeignIDs const & val)155 bool setLNID( sb_ForeignIDs const& val ) { return setLineID( val ); } 156 157 bool setAreaID( sb_ForeignIDs const& val ); setARID(sb_ForeignIDs const & val)158 bool setARID( sb_ForeignIDs const& val ) { return setAreaID( val ); } 159 160 bool setCompositeID( sb_ForeignIDs const& val ); setCPID(sb_ForeignIDs const & val)161 bool setCPID( sb_ForeignIDs const& val ) { return setCompositeID( val ); } 162 163 bool setRepresentationModuleID( sb_ForeignIDs const& val ); setRPID(sb_ForeignIDs const & val)164 bool setRPID( sb_ForeignIDs const& val ) { return setRepresentationModuleID( val ); } 165 166 bool setOrientationSpatialAddress( sb_ForeignIDs const& val ); setOSAD(sb_ForeignIDs const & val)167 bool setOSAD( sb_ForeignIDs const& val ) { return setOrientationSpatialAddress( val ); } 168 169 bool setAttributePrimaryForeignID( sb_ForeignIDs const& val ); setPAID(sb_ForeignIDs const & val)170 bool setPAID( sb_ForeignIDs const& val ) { return setAttributePrimaryForeignID( val ); } 171 172 bool setArrtibuteLabel( sb_AttributeIDs const& val ); setATLB(sb_AttributeIDs const & val)173 bool setATLB( sb_AttributeIDs const& val ) { return setArrtibuteLabel( val ); } 174 175 bool setSymbolOrientationSpatialAddress( sb_Spatial const& val ); setSSAD(sb_Spatial const & val)176 bool setSSAD( sb_Spatial const& val ) { return setSymbolOrientationSpatialAddress( val ); } 177 178 //@} 179 180 //@{ 181 /** 182 Since builder objects will be frequently 'recycled' (i.e., used for 183 more than one record), it might be convenient to 'unset' a previously 184 assigned value. So: 185 */ 186 187 void unDefineObjectRepresentation( ); unDefineOBRP()188 void unDefineOBRP( ) { unDefineObjectRepresentation( ); } 189 190 void unDefineSpatialAddress( ); unDefineSADR()191 void unDefineSADR( ) { unDefineSpatialAddress( ); } 192 193 void unDefineAttributeID( ); unDefineATID()194 void unDefineATID( ) { unDefineAttributeID( ); } 195 196 void unDefineLineID( ); unDefineLNID()197 void unDefineLNID( ) { unDefineLineID( ); } 198 199 void unDefineAreaID( ); unDefineARID()200 void unDefineARID( ) { unDefineAreaID( ); } 201 202 void unDefineCompositeID( ); unDefineCPID()203 void unDefineCPID( ) { unDefineCompositeID( ); } 204 205 void unDefineRepresentationModuleID( ); unDefineRPID()206 void unDefineRPID( ) { unDefineRepresentationModuleID( ); } 207 208 void unDefineOrientationSpatialAddress( ); unDefineOSAD()209 void unDefineOSAD( ) { unDefineOrientationSpatialAddress( ); } 210 211 void unDefineAttributePrimaryForeignID( ); unDefinePAID()212 void unDefinePAID( ) { unDefineAttributePrimaryForeignID( ); } 213 214 void unDefineArrtibuteLabel( ); unDefineATLB()215 void unDefineATLB( ) { unDefineArrtibuteLabel( ); } 216 217 void unDefineSymbolOrientationSpatialAddress( ); unDefineSSAD()218 void unDefineSSAD( ) { unDefineSymbolOrientationSpatialAddress( ); } 219 220 //@} 221 222 private: 223 224 // Returns reference to schema 225 virtual sio_8211Schema& schema_(); 226 227 virtual void buildSpecificSchema_(); 228 229 sb_Pnts(sb_Pnts const& right); // NOT NEEDED 230 sb_Pnts const& operator=(sb_Pnts const& right); // NOT NEEDED 231 232 233 std::auto_ptr<sb_Pnts_Imp> _imp; 234 235 }; // sb_Pnts 236 237 238 #endif // INCLUDED_SB_PNTS_H 239 240