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_Ddsh.h,v 1.6 2002/11/24 22:07:42 mcoletti Exp $
13 //
14 #ifndef INCLUDED_SB_DDSH_H
15 #define INCLUDED_SB_DDSH_H
16 
17 #include <list>
18 
19 #include <string>
20 
21 #ifndef SB_MODULE_H
22 #include <sdts++/builder/sb_Module.h>
23 #endif
24 
25 
26 #ifndef INCLUDED_SIO8211FIELDFORMAT_H
27 #include <sdts++/io/sio_8211FieldFormat.h>
28 #endif
29 
30 class  sb_ForeignID;
31 class  sc_Record;
32 
33 
34 struct sb_Ddsh_Imp;
35 
36 
37 /**
38  This class provides a convenient access to DDSH records.  It provides
39  members to access or set various module field and subfield values.
40  It also provides a mechanism for populating an object of this class with
41  values found in a valid sc_Record of this module, and for filling a
42  sc_Record with the contents of a sb_Ddsh object.
43 */
44 class sb_Ddsh : public sb_Module
45 {
46    public:
47 
48       sb_Ddsh();
49 
50       ~sb_Ddsh();
51 
52       /**
53        Use these members to get subfield/field values.  Pass in an appropriate
54        type to receive the value.  These members will return false if the
55        corresponding value is not set.  (It may not be set because a value
56        was not assigned to it, or because you previously tried to assign
57        an invalid value.)  Otherwise they will return true.
58       */
59       bool getName( std::string& val ) const;
getNAME(std::string & val)60       bool getNAME( std::string& val ) const { return getName( val ); }
61 
62       bool getType( std::string& val ) const;
getTYPE(std::string & val)63       bool getTYPE( std::string& val ) const { return getType( val ); }
64 
65       bool getEntityLabel( std::string& val ) const;
getETLB(std::string & val)66       bool getETLB( std::string& val ) const { return getEntityLabel( val ); }
67 
68       bool getEntityAuthority( std::string& val ) const;
getEUTH(std::string & val)69       bool getEUTH( std::string& val ) const { return getEntityAuthority( val ); }
70 
71       bool getAttributeLabel( std::string& val ) const;
getATLB(std::string & val)72       bool getATLB( std::string& val ) const { return getAttributeLabel( val ); }
73 
74       bool getAttributeAuthority( std::string& val ) const;
getAUTH(std::string & val)75       bool getAUTH( std::string& val ) const { return getAttributeAuthority( val ); }
76 
77       bool getFormat( std::string& val ) const;
getFMT(std::string & val)78       bool getFMT( std::string& val ) const { return getFormat( val ); }
79 
80       bool getUnit( std::string& val ) const;
getUNIT(std::string & val)81       bool getUNIT( std::string& val ) const { return getUnit( val ); }
82 
83       bool getPrecision( double& val ) const;
getPREC(double & val)84       bool getPREC( double& val ) const { return getPrecision( val ); }
85 
86       bool getMaximumSubfieldLength( long& val ) const;
getMXLN(long & val)87       bool getMXLN( long& val ) const { return getMaximumSubfieldLength( val ); }
88 
89       bool getKey( std::string& val ) const;
getKEY(std::string & val)90       bool getKEY( std::string& val ) const { return getKey( val ); }
91 
92 
93       /**
94        fill the given record based on the builder's object field/subfield
95        values -- return false if in a wedged state. (E.g., a mandatory
96        field isn't set or was assigned a value outside its proper
97        domain.
98       */
99       bool getRecord( sc_Record& val ) const;
100 
101 
102       /**
103        set the object with values found in the record; if not a valid
104        DDSH record, this will return false
105       */
106       bool setRecord( sc_Record const& val );
107 
108 
109       /**
110        Use these members to set subfield/field values.  Pass in an appropriate
111        value for the particular subfield/field to be set to.  They will return
112        false if you try to assign a value outside the domain of the given
113        subfield/field.  (Note that this is not too pedantic; for example, we
114        do not check to see if a conditionally mandatory or optional field has
115        been set.)
116       */
117       bool setName( std::string const& val );
setNAME(std::string const & val)118       bool setNAME( std::string const& val ) { return setName( val ); }
119 
120       bool setType( std::string const& val );
setTYPE(std::string const & val)121       bool setTYPE( std::string const& val ) { return setType( val ); }
122 
123       bool setEntityLabel( std::string const& val );
setETLB(std::string const & val)124       bool setETLB( std::string const& val ) { return setEntityLabel( val ); }
125 
126       bool setEntityAuthority( std::string const& val );
setEUTH(std::string const & val)127       bool setEUTH( std::string const& val ) { return setEntityAuthority( val ); }
128 
129       bool setAttributeLabel( std::string const& val );
setATLB(std::string const & val)130       bool setATLB( std::string const& val ) { return setAttributeLabel( val ); }
131 
132       bool setAttributeAuthority( std::string const& val );
setAUTH(std::string const & val)133       bool setAUTH( std::string const& val ) { return setAttributeAuthority( val ); }
134 
135       bool setFormat( std::string const& val );
setFMT(std::string const & val)136       bool setFMT( std::string const& val ) { return setFormat( val ); }
137 
138       bool setUnit( std::string const& val );
setUNIT(std::string const & val)139       bool setUNIT( std::string const& val ) { return setUnit( val ); }
140 
141       bool setPrecision( double val );
setPREC(double val)142       bool setPREC( double val ) { return setPrecision( val ); }
143 
144       bool setMaximumSubfieldLength( long val );
setMXLN(long val)145       bool setMXLN( long val ) { return setMaximumSubfieldLength( val ); }
146 
147       bool setKey( std::string const& val );
setKEY(std::string const & val)148       bool setKEY( std::string const& val ) { return setKey( val ); }
149 
150 
151 
152       /**
153        Since builder objects will be frequently 'recycled' (i.e., used for
154        more than one record), it might be convenient to 'unset' a previously
155        assigned value.  So:
156       */
157       void unDefineName( );
unDefineNAME()158       void unDefineNAME( ) { unDefineName( ); }
159 
160       void unDefineType( );
unDefineTYPE()161       void unDefineTYPE( ) { unDefineType( ); }
162 
163       void unDefineEntityLabel( );
unDefineETLB()164       void unDefineETLB( ) { unDefineEntityLabel( ); }
165 
166       void unDefineEntityAuthority( );
unDefineEUTH()167       void unDefineEUTH( ) { unDefineEntityAuthority( ); }
168 
169       void unDefineAttributeLabel( );
unDefineATLB()170       void unDefineATLB( ) { unDefineAttributeLabel( ); }
171 
172       void unDefineAttributeAuthority( );
unDefineAUTH()173       void unDefineAUTH( ) { unDefineAttributeAuthority( ); }
174 
175       void unDefineFormat( );
unDefineFMT()176       void unDefineFMT( ) { unDefineFormat( ); }
177 
178       void unDefineUnit( );
unDefineUNIT()179       void unDefineUNIT( ) { unDefineUnit( ); }
180 
181       void unDefinePrecision( );
unDefinePREC()182       void unDefinePREC( ) { unDefinePrecision( ); }
183 
184       void unDefineMaximumSubfieldLength( );
unDefineMXLN()185       void unDefineMXLN( ) { unDefineMaximumSubfieldLength( ); }
186 
187       void unDefineKey( );
unDefineKEY()188       void unDefineKEY( ) { unDefineKey( ); }
189 
190 
191    private:
192 
193 
194       /// returns reference to schema
195       sio_8211Schema& schema_();
196 
197       ///
198       void buildSpecificSchema_();
199 
200       /// NOT NEEDED
201       sb_Ddsh(sb_Ddsh const& right);
202 
203       /// NOT NEEDED
204       sb_Ddsh const& operator=(sb_Ddsh const& right);
205 
206 
207       /// pointer to hidden opaque data structure
208       sb_Ddsh_Imp* imp_;
209 
210 }; // sb_Ddsh
211 
212 
213 #endif // INCLUDED_SB_DDSH_H
214 
215