Hold attribute data for a DODS dataset.
#include DAS.h Inheritance diagram for DAS::
DAS AttrTable
Public Methods
DAS(AttrTable dflt=(AttrTable ) NULL, unsigned int sz=0) DAS(AttrTable attr table, string name)
virtual DAS () Pixfirst var()
Returns a pointer to the first attribute table.
voidnext var(Pix &p)
Increments an attribute table pointer to indicate the next table in the series.
stringget name(Pix p)
Returns the name of the indicated attribute table.
voidprint(ostream &os=cout, bool dereference=false)
Creates an ASCII representation of a DAS on the given output stream.
AttrTable get table(Pix p) Returns the indicated attribute table.
AttrTable get table(const string &name) Returns the attribute table with the given name string.
AttrTable get table(const char name) Returns the attribute table with the given name.
AttrTable add table(const string &name,AttrTable at) Adds an attribute table to the DAS.
AttrTable add table(const char name,AttrTable at) Adds an attribute table to the DAS.
parse()
Reads aDASin from an external source.
voidparse(string fname)
Reads a DAS from the named file.
voidparse(int fd)
Read attributes from a file descriptor.
voidparse(FILE in=stdin)
Reads a DAS from an open file descriptor.
Protected Methods
AttrTable das find (string name)
3.9.1 Detailed Description
Hold attribute data for a DODS dataset.
The Data Attribute Structure is a set of name-value pairs used to describe the data in a particular dataset. The name-value pairs are called the “attributes”. The values may be of any of the DODS simple data types (Byte,Int16,UInt16,Int32, UInt32, Float32,Float64, String and URL), and may be scalar or vector. Note that all values are actually stored as String data, making the easy to read/check using a web browser.
label api:das
A value may also consist of a set of other name-value pairs. This makes it possible to nest collections of attributes, giving rise to a hierarchy of attributes. DODS uses this structure to provide information about variables in a dataset. For example, consider the dataset used in theDDSexample earlier.
In the following example of a DAS, several of the attribute collections have names corresponding to the names of variables in the DDSexample. The attributes in that collection are said to belong to that variable. For example, thelatvariable has an attribute “units” of “degrees north”.
Attributes GLOBAL
String title "Reynolds Optimum Interpolation (OI) SST";
String units "days since 1-1-1 00:00:00";
String long_name "Time";
Float64 actual_range 726468., 729289.;
String delta_t "0000-00-07 00:00:00";
sst
String long_name "Weekly Means of Sea Surface Temperature";
Float64 actual_range -1.8, 35.09;
Attributes may have arbitrary names, although in most datasets it is important to choose these names so a reader will know what they describe. In the above example, the
“GLOBAL” attribute provides information about the entire dataset.
Data attribute information is an important part of the the data provided to a DODS client by a server, and the DAS is how this data is packaged for sending (and how it is received).
The DAS class is simply a sequence of attribute tables and names. It may be thought of as the top level of the attribute hierarchy.
See also:
DDS,AttrTable
Definition at line 105 of file DAS.h.
3.9.2 Constructor & Destructor Documentation
3.9.2.1 DAS::DAS (AttrTable dflt = (AttrTable )NULL, unsigned int sz = 0) Create a DAS from a single attribute table.
Note:
In an older version of this class,dfltandszinitialized a hash table. That is no longer used and these params should no longer matter. Note that this constructor is effectively the empty constructor. 11/23/98 jhrg
Parameters:
dflt A pointer to a valid attribute table.
sz The number of entries in the table. This is unused. It was part of the ctor when DAS used the old GNU VHMap class. I switched from that to a SLList of struct toplevel entry objects because the VHMap class had bugs I didn’t want to fix. 11/23/98 jhrg
Definition at line 64 of file DAS.cc.
3.9.2.2 DAS::DAS (AttrTable attr, string name)
Create a DAS object with one attribute table. Useappend attr()to add additional attributes.
See also:
append attr() Parameters:
attr The initialAttrTable.
name The name of the DAS parent structure.
Definition at line 76 of file DAS.cc.
References AttrTable::append container.
3.9.3 Member Function Documentation
3.9.3.1 AttrTable DAS::get table (const char name) Returns the attribute table with the given name.
This function is necessary because (char ) arguments will be converted to Pixs (and not strings). Without this member function get table(name) needs a cast, and it seems tough to believe folks will always remember that.
Definition at line 141 of file DAS.cc.
References get table.
3.9.3.2 void DAS::parse (FILE in = stdin) Reads a DAS from an open file descriptor.
Read attributes from in (which defaults to stdin). If dasrestart() fails, return false, otherwise return the status of dasparse().
Definition at line 232 of file DAS.cc.
3.9.3.3 void DAS::parse (int fd) Read attributes from a file descriptor.
If the file descriptor cannot be fdopen’d, return false, otherwise return the status of the mfunc parse.
Note:
Added call to dup() within fdopen so that once the FILE is closed the decriptor fd will not also be closed (instead the duplicate descriptor will be closed). Thus further information can be read from the descriptor fd.
Definition at line 205 of file DAS.cc.
References parse.
3.9.3.4 void DAS::parse (string fname) Reads a DAS from the named file.
Read attributes from a file. Returns false if unable to open the file, otherwise returns the result of the mfunc parse.
Definition at line 181 of file DAS.cc.
Referenced by parse, and DODSFilter::read ancillary das.
3.9.3.5 void DAS::print (ostream & os = cout, bool dereference = false) Creates an ASCII representation of a DAS on the given output stream.
Write attributes from tables to ‘out’ (which defaults to stdout). Return true.
When an identifier contains a character that contains characters that cannot be present in a URL (e.g., a space)AttrTable::printreplaces those characters with WWW escape codes. 7/13/2001 jhrg
Definition at line 267 of file DAS.cc.
References AttrTable::print.
Referenced by DODSFilter::send das.
The documentation for this class was generated from the following files:
DAS.h DAS.cc