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_Cats.h,v 1.8 2002/11/24 22:07:42 mcoletti Exp $ 13 // 14 #ifndef INCLUDED_SB_CATS_H 15 #define INCLUDED_SB_CATS_H 16 17 #ifdef _MSC_VER 18 #pragma warning( disable : 4786 ) 19 #endif 20 21 #include <list> 22 #include <string> 23 24 25 #ifndef SB_MODULE_H 26 #include <sdts++/builder/sb_Module.h> 27 #endif 28 29 30 #ifndef INCLUDED_SIO8211FIELDFORMAT_H 31 #include <sdts++/io/sio_8211FieldFormat.h> 32 #endif 33 34 class sb_ForeignID; 35 class sc_Record; 36 37 38 /// 39 struct sb_Cats_Imp; 40 41 42 /** 43 This class provides a convenient access to CATS 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_Cats object. 48 */ 49 class sb_Cats : public sb_Module 50 { 51 public: 52 53 sb_Cats(); 54 55 ~sb_Cats(); 56 57 /** 58 Use these members to get subfield/field values. Pass in an appropriate 59 type to receive the value. These members will return false if the 60 corresponding value is not set. (It may not be set because a value 61 was not assigned to it, or because you previously tried to assign 62 an invalid value.) Otherwise they will return true. 63 */ 64 bool getName( std::string& val ) const; getNAME(std::string & val)65 bool getNAME( std::string& val ) const { return getName( val ); } 66 67 bool getType( std::string& val ) const; getTYPE(std::string & val)68 bool getTYPE( std::string& val ) const { return getType( val ); } 69 70 bool getDomain( std::string& val ) const; getDOMN(std::string & val)71 bool getDOMN( std::string& val ) const { return getDomain( val ); } 72 73 bool getMap( std::string& val ) const; getMAP(std::string & val)74 bool getMAP( std::string& val ) const { return getMap( val ); } 75 76 bool getThem( std::string& val ) const; getTHEM(std::string & val)77 bool getTHEM( std::string& val ) const { return getThem( val ); } 78 79 bool getAggregateObject( std::string& val ) const; getAGOB(std::string & val)80 bool getAGOB( std::string& val ) const { return getAggregateObject( val ); } 81 82 bool getAggregateObjectType( std::string& val ) const; getAGTP(std::string & val)83 bool getAGTP( std::string& val ) const { return getAggregateObjectType( val ); } 84 85 bool getComment( std::string& val ) const; getCOMT(std::string & val)86 bool getCOMT( std::string& val ) const { return getComment( val ); } 87 88 /** 89 fill the given record based on the builder's object field/subfield 90 values -- return false if in a wedged state. (E.g., a mandatory 91 field isn't set or was assigned a value outside its proper 92 domain. 93 */ 94 bool getRecord( sc_Record& val ) const; 95 96 97 /** 98 set the object with values found in the record; if not a valid 99 CATS record, this will return false 100 */ 101 bool setRecord( sc_Record const& val ); 102 103 104 /** 105 Use these members to set subfield/field values. Pass in an appropriate 106 value for the particular subfield/field to be set to. They will return 107 false if you try to assign a value outside the domain of the given 108 subfield/field. (Note that this is not too pedantic; for example, we 109 do not check to see if a conditionally mandatory or optional field has 110 been set.) 111 */ 112 bool setName( std::string const& val ); setNAME(std::string const & val)113 bool setNAME( std::string const& val ) { return setName( val ); } 114 115 bool setType( std::string const& val ); setTYPE(std::string const & val)116 bool setTYPE( std::string const& val ) { return setType( val ); } 117 118 bool setDomain( std::string const& val ); setDOMN(std::string const & val)119 bool setDOMN( std::string const& val ) { return setDomain( val ); } 120 121 bool setMap( std::string const& val ); setMAP(std::string const & val)122 bool setMAP( std::string const& val ) { return setMap( val ); } 123 124 bool setThem( std::string const& val ); setTHEM(std::string const & val)125 bool setTHEM( std::string const& val ) { return setThem( val ); } 126 127 bool setAggregateObject( std::string const& val ); setAGOB(std::string const & val)128 bool setAGOB( std::string const& val ) { return setAggregateObject( val ); } 129 130 bool setAggregateObjectType( std::string const& val ); setAGTP(std::string const & val)131 bool setAGTP( std::string const& val ) { return setAggregateObjectType( val ); } 132 133 bool setComment( std::string const& val ); setCOMT(std::string const & val)134 bool setCOMT( std::string const& val ) { return setComment( val ); } 135 136 137 /** 138 Since builder objects will be frequently 'recycled' (i.e., used for 139 more than one record), it might be convenient to 'unset' a previously 140 assigned value. So: 141 */ 142 void unDefineName( ); unDefineNAME()143 void unDefineNAME( ) { unDefineName( ); } 144 145 void unDefineType( ); unDefineTYPE()146 void unDefineTYPE( ) { unDefineType( ); } 147 148 void unDefineDomain( ); unDefineDOMN()149 void unDefineDOMN( ) { unDefineDomain( ); } 150 151 void unDefineMap( ); unDefineMAP()152 void unDefineMAP( ) { unDefineMap( ); } 153 154 void unDefineThem( ); unDefineTHEM()155 void unDefineTHEM( ) { unDefineThem( ); } 156 157 void unDefineAggregateObject( ); unDefineAGOB()158 void unDefineAGOB( ) { unDefineAggregateObject( ); } 159 160 void unDefineAggregateObjectType( ); unDefineAGTP()161 void unDefineAGTP( ) { unDefineAggregateObjectType( ); } 162 163 void unDefineComment( ); unDefineCOMT()164 void unDefineCOMT( ) { unDefineComment( ); } 165 166 167 168 private: 169 170 /// returns reference to schema 171 sio_8211Schema& schema_(); 172 173 /// 174 void buildSpecificSchema_(); 175 176 177 /// NOT NEEDED 178 sb_Cats(sb_Cats const& right); 179 180 /// NOT NEEDED 181 sb_Cats const& operator=(sb_Cats const& right); 182 183 /// pointer to opaque data structure 184 sb_Cats_Imp* imp_; 185 186 }; // sb_Cats 187 188 189 #endif // INCLUDED_SB_CATS_H 190 191