libdap++ Updated for version 3.8.2

libdap::DAS Class Reference

Hold attribute data for a DAP2 dataset. More...

#include <DAS.h>

Inheritance diagram for libdap::DAS:
Collaboration diagram for libdap::DAS:

List of all members.

Public Member Functions

virtual AttrTablecontainer ()
 Returns the current attribute container when multiple files used to build this DAS.
virtual string container_name ()
 Returns the name of the current attribute container when multiple files used to build this DAS.
virtual void container_name (const string &cn)
 Sets the name of the current attribute container when multiple files used to build this DAS.
 DAS ()
virtual void dump (ostream &strm) const
 dumps information about this object
virtual void erase ()
 erase all attributes in this DAS
string get_name (AttrTable::Attr_iter &i)
 Returns the name of the referenced variable attribute table.
virtual unsigned int get_size () const
 Returns the number of attributes in the current attribute table.
virtual AttrTableget_table (const string &name)
 Returns the variable attribute table with the given name.
AttrTableget_table (AttrTable::Attr_iter &i)
 Returns the referenced variable attribute table.
virtual AttrTableget_top_level_attributes ()
 Returns the top most set of attributes.
virtual void print (ostream &out, bool dereference=false)
virtual void print (FILE *out, bool dereference=false)
AttrTable::Attr_iter var_begin ()
 Returns a reference to the attribute table for the first variable.
AttrTable::Attr_iter var_end ()
virtual ~DAS ()
 This deletes the pointers to AttrTables allocated during the parse (and at other times). jhrg 7/29/94.
add_table()

Adds an attribute table to the DAS.

virtual AttrTableadd_table (const string &name, AttrTable *at)
 Adds a variable attribute table to the DAS or the current dataset container attribute table.
parse()

Reads a DAS in from an external source.

virtual void parse (string fname)
 Reads a DAS from the named file.
virtual void parse (int fd)
 Read attributes from a file descriptor.
virtual void parse (FILE *in=stdin)
 Reads a DAS from an open file descriptor.

Detailed Description

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 DAP2 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.

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. DAP2 uses this structure to provide information about variables in a dataset. For example, consider the dataset used in the DDS example earlier.

In the following example of a DAS, several of the attribute collections have names corresponding to the names of variables in the DDS example. The attributes in that collection are said to belong to that variable. For example, the lat variable has an attribute ``units'' of ``degrees_north''.

    Attributes {
        GLOBAL {
            String title "Reynolds Optimum Interpolation (OI) SST";
        }
        lat {
            String units "degrees_north";
            String long_name "Latitude";
            Float64 actual_range 89.5, -89.5;
        }
        lon {
            String units "degrees_east";
            String long_name "Longitude";
            Float64 actual_range 0.5, 359.5;
        }
        time {
            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;
            String units "degC";
            Float64 add_offset 0.;
            Float64 scale_factor 0.0099999998;
            Int32 missing_value 32767;
        }
    }
    

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 DAP2 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 123 of file DAS.h.


Constructor & Destructor Documentation

libdap::DAS::DAS ( )

Create an empty DAS

Definition at line 80 of file DAS.cc.

libdap::DAS::~DAS ( ) [virtual]

Create a DAS object with one attribute table. Use append_attr() to add additional attributes.

See also:
append_attr()
Parameters:
attrThe initial AttrTable.
nameThe name of the DAS parent structure.

Definition at line 102 of file DAS.cc.


Member Function Documentation

AttrTable * libdap::DAS::add_table ( const string &  name,
AttrTable at 
) [virtual]

Definition at line 254 of file DAS.cc.

References libdap::AttrTable::append_container(), and libdap::AttrTable::set_is_global_attribute().

Referenced by container_name().

Here is the call graph for this function:

AttrTable * libdap::DAS::container ( ) [virtual]
Returns:
current attribute table for current container

Definition at line 146 of file DAS.cc.

void libdap::DAS::container_name ( const string &  cn) [virtual]
Parameters:
cncontainer name

Definition at line 120 of file DAS.cc.

References add_table(), and get_table().

Here is the call graph for this function:

string libdap::DAS::container_name ( ) [virtual]

Definition at line 109 of file DAS.cc.

Referenced by libdap::DDS::transfer_attributes().

void libdap::DAS::dump ( ostream &  strm) const [virtual]

Displays the pointer value of this instance and then calls parent dump

Parameters:
strmC++ i/o stream to dump the information to
Returns:
void

Implements libdap::DapObj.

Definition at line 411 of file DAS.cc.

References libdap::AttrTable::dump(), libdap::DapIndent::Indent(), libdap::DapIndent::LMarg(), and libdap::DapIndent::UnIndent().

Here is the call graph for this function:

void libdap::DAS::erase ( ) [virtual]

Definition at line 170 of file DAS.cc.

References libdap::AttrTable::erase().

Here is the call graph for this function:

string libdap::DAS::get_name ( AttrTable::Attr_iter i)

Definition at line 210 of file DAS.cc.

References libdap::AttrTable::get_name().

Here is the call graph for this function:

unsigned int libdap::DAS::get_size ( ) const [virtual]

If the there is a container set, then return the number of variable attribute tables for the current container. If not set then return the number of current attribute tables in the outermost attribute table.

Definition at line 158 of file DAS.cc.

References libdap::AttrTable::get_size().

Here is the call graph for this function:

AttrTable * libdap::DAS::get_table ( AttrTable::Attr_iter i)

Definition at line 222 of file DAS.cc.

References libdap::AttrTable::get_attr_table().

Referenced by container_name().

Here is the call graph for this function:

AttrTable * libdap::DAS::get_table ( const string &  name) [virtual]

Definition at line 234 of file DAS.cc.

References libdap::AttrTable::get_attr_table().

Here is the call graph for this function:

virtual AttrTable* libdap::DAS::get_top_level_attributes ( ) [inline, virtual]

This could be the top most variable attribute tables, or it could be the top most dataset container attribute tables, if we have multiple datasets being used to construct this DAS

Definition at line 149 of file DAS.h.

Referenced by libdap::DDS::transfer_attributes().

void libdap::DAS::parse ( FILE *  in = stdin) [virtual]

Read attributes from in (which defaults to stdin). If dasrestart() fails, return false, otherwise return the status of dasparse().

Definition at line 334 of file DAS.cc.

References das_buffer(), das_delete_buffer(), das_switch_to_buffer(), and dasparse().

Here is the call graph for this function:

void libdap::DAS::parse ( string  fname) [virtual]

Read a DAS by parsing the specified 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 278 of file DAS.cc.

References cannot_read_file, and DBG.

Referenced by parse(), libdap::Connect::request_das(), and libdap::Connect::request_das_url().

void libdap::DAS::parse ( int  fd) [virtual]

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 305 of file DAS.cc.

References DBG, and parse().

Here is the call graph for this function:

void libdap::DAS::print ( ostream &  out,
bool  dereference = false 
) [virtual]

Creates an ASCII representation of a DAS on the given output stream.

When an identifier contains a character that contains characters that cannot be present in a URL (e.g., a space) AttrTable::print replaces those characters with WWW escape codes. 7/13/2001 jhrg

Parameters:
outoutput ostream on which to print the DAS
dereferenceIf true, follow aliases. Default is false.

Definition at line 394 of file DAS.cc.

References libdap::AttrTable::print().

Here is the call graph for this function:

void libdap::DAS::print ( FILE *  out,
bool  dereference = false 
) [virtual]

Print the DAS

Creates an ASCII representation of a DAS on the given output stream.

When an identifier contains a character that contains characters that cannot be present in a URL (e.g., a space) AttrTable::print replaces those characters with WWW escape codes. 7/13/2001 jhrg

Parameters:
outoutput FILE on which to print the DAS
dereferenceIf true, follow aliases. Default is false.

Definition at line 372 of file DAS.cc.

References libdap::AttrTable::print().

Referenced by main(), and libdap::DODSFilter::send_das().

Here is the call graph for this function:

AttrTable::Attr_iter libdap::DAS::var_begin ( )

Definition at line 185 of file DAS.cc.

References libdap::AttrTable::attr_begin().

Here is the call graph for this function:

AttrTable::Attr_iter libdap::DAS::var_end ( )

Returns a reference to the end of the attribute table. Does not point to an attribute table.

Definition at line 198 of file DAS.cc.

References libdap::AttrTable::attr_end().

Here is the call graph for this function:


The documentation for this class was generated from the following files: