libdap++  Updated for version 3.14.0
libdap::AttrTable Class Reference

Contains the attributes for a dataset. More...

#include <AttrTable.h>

Inheritance diagram for libdap::AttrTable:
Inheritance graph
Collaboration diagram for libdap::AttrTable:
Collaboration graph

Classes

struct  entry
 

Public Types

typedef std::vector< entry * >::const_iterator Attr_citer
 
typedef std::vector< entry * >::iterator Attr_iter
 

Public Member Functions

virtual void add_container_alias (const string &name, AttrTable *src)
 Add an alias to a container held by this attribute table. More...
 
virtual void add_value_alias (AttrTable *at, const string &name, const string &source)
 Add an alias for an attribute. More...
 
virtual unsigned int append_attr (const string &name, const string &type, const string &value)
 Add an attribute to the table. More...
 
virtual unsigned int append_attr (const string &name, const string &type, vector< string > *values)
 Add an attribute to the table. More...
 
virtual AttrTableappend_container (const string &name)
 Add a container to the attribute table. More...
 
virtual AttrTableappend_container (AttrTable *at, const string &name)
 Add a container to the attribute table. More...
 
virtual bool attr_alias (const string &alias, AttrTable *at, const string &name)
 Adds an alias to the set of attributes. More...
 
virtual bool attr_alias (const string &alias, const string &name)
 
virtual void dump (ostream &strm) const
 dumps information about this object More...
 
virtual void erase ()
 Erase the attribute table. More...
 
virtual void find (const string &target, AttrTable **at, Attr_iter *iter)
 
virtual AttrTablefind_container (const string &target)
 Find an attribute with a given name. More...
 
virtual string get_name () const
 Get the name of this attribute table. More...
 
virtual AttrTableget_parent () const
 
virtual unsigned int get_size () const
 Get the number of entries in this attribute table. More...
 
virtual bool is_global_attribute () const
 
virtual void print (FILE *out, string pad=" ", bool dereference=false)
 Prints the attribute table. More...
 
virtual void print (ostream &out, string pad=" ", bool dereference=false)
 Prints the attribute table. More...
 
void print_dap4 (XMLWriter &xml)
 
virtual void print_xml (FILE *out, string pad=" ", bool constrained=false)
 
virtual void print_xml (ostream &out, string pad=" ", bool constrained=false)
 
void print_xml_writer (XMLWriter &xml)
 
virtual AttrTablerecurrsive_find (const string &target, Attr_iter *location)
 
virtual void set_is_global_attribute (bool ga)
 
virtual void set_name (const string &n)
 Set the name of this attribute table. More...
 
Attr_iter simple_find (const string &target)
 
AttrTablesimple_find_container (const string &target)
 
Accessors using an attribute name

Each of the following accessors get information using the name of an attribute. They perform a simple search for the name in this attribute table only; sub-tables are not searched and the dot notation is not recognized.

virtual AttrTableget_attr_table (const string &name)
 Get an attribute container. More...
 
virtual string get_type (const string &name)
 Get the type name of an attribute within this attribute table. More...
 
virtual AttrType get_attr_type (const string &name)
 Get the type of an attribute. More...
 
virtual unsigned int get_attr_num (const string &name)
 Get the number of attributes in this container. More...
 
virtual vector< string > * get_attr_vector (const string &name)
 Get a vector-valued attribute. More...
 
virtual void del_attr (const string &name, int i=-1)
 Deletes an attribute. More...
 
get information using an iterator
virtual string get_attr (const string &name, unsigned int i=0)
 
virtual Attr_iter attr_begin ()
 
virtual Attr_iter attr_end ()
 
virtual Attr_iter get_attr_iter (int i)
 
virtual string get_name (Attr_iter iter)
 
virtual bool is_container (Attr_iter iter)
 
virtual AttrTableget_attr_table (Attr_iter iter)
 
virtual Attr_iter del_attr_table (Attr_iter iter)
 
virtual string get_type (Attr_iter iter)
 
virtual AttrType get_attr_type (Attr_iter iter)
 
virtual unsigned int get_attr_num (Attr_iter iter)
 
virtual string get_attr (Attr_iter iter, unsigned int i=0)
 
virtual std::vector< string > * get_attr_vector (Attr_iter iter)
 
virtual bool is_global_attribute (Attr_iter iter)
 
virtual void set_is_global_attribute (Attr_iter iter, bool ga)
 

Protected Member Functions

void clone (const AttrTable &at)
 
void simple_print (FILE *out, string pad, Attr_iter i, bool dereference)
 
void simple_print (ostream &out, string pad, Attr_iter i, bool dereference)
 

Friends

class AttrTableTest
 

Instance management functions

 AttrTable ()
 
 AttrTable (const AttrTable &rhs)
 
virtual ~AttrTable ()
 
AttrTableoperator= (const AttrTable &rhs)
 

Detailed Description

An AttrTable (``Attribute Table'') stores a set of names and, for each name, either a type and a value, or another attribute table. The attribute value can be a vector containing many values of the same type. The attributes can have any of the types listed in the AttrType list. However, all attribute types are stored as string data, except for the container type, which is stored as a pointer to another attribute table.

Each element in the attribute table can itself be an attribute table. The table can also contain ``alias'' attributes whose value is given by the value of another attribute to which it is linked.

The attribute tables have a standard printed representation. There is a member function print() for writing this form. Use the DAS::parse() function to read the printed form.

An attribute table might look something like this:

string long_name "Weekly Means of Sea Surface Temperature";
actual_range {
    Float64 min -1.8;
    Float64 max 35.09;
}
string units "degC";
conversion_data {
    Float64 add_offset 0.;
    Float64 scale_factor 0.0099999998;
}
Int32 missing_value 32767;

Here, long_name, units, and missing_value are simple attributes, and actual_range and conversion_data are container attributes containing other attribute tables.

@note This class is used only for DAP2.
See also
DAS
AttrType

Definition at line 142 of file AttrTable.h.

Member Typedef Documentation

typedef std::vector<entry *>::const_iterator libdap::AttrTable::Attr_citer

Definition at line 228 of file AttrTable.h.

typedef std::vector<entry *>::iterator libdap::AttrTable::Attr_iter

Definition at line 229 of file AttrTable.h.

Constructor & Destructor Documentation

libdap::AttrTable::AttrTable ( )

Definition at line 188 of file AttrTable.cc.

Referenced by append_container(), and libdap::AttrTable::entry::clone().

libdap::AttrTable::AttrTable ( const AttrTable rhs)

Definition at line 193 of file AttrTable.cc.

References clone().

Here is the call graph for this function:

libdap::AttrTable::~AttrTable ( )
virtual

Definition at line 208 of file AttrTable.cc.

Member Function Documentation

void libdap::AttrTable::add_container_alias ( const string &  name,
AttrTable src 
)
virtual
Parameters
nameThe name of the alias. May not use dot notation.
srcThe existing attribute container to alias.
Exceptions
Errorif an attribute, container or alias called name already exists in this attribute table.

Definition at line 907 of file AttrTable.cc.

References libdap::AttrTable::entry::aliased_to, libdap::Attr_container, attr_end(), libdap::AttrTable::entry::attributes, get_name(), libdap::AttrTable::entry::is_alias, libdap::AttrTable::entry::name, simple_find(), libdap::AttrTable::entry::type, and libdap::www2id().

Here is the call graph for this function:

void libdap::AttrTable::add_value_alias ( AttrTable das,
const string &  name,
const string &  source 
)
virtual

Assume source names an attribute value in some container. Add an alias name for that value in this object.

Parameters
das
nameThe name of the alias. May not use dot notation.
sourceThe name of the attribute to alias. May use dot notation.
Exceptions
Errorif the attribute table already contains an attribute, container or alias called name or if an attribute called source does not exist.

Definition at line 941 of file AttrTable.cc.

References libdap::AttrTable::entry::aliased_to, libdap::AttrTable::entry::attr, libdap::Attr_container, attr_end(), libdap::AttrTable::entry::attributes, find(), get_attr_table(), get_attr_type(), libdap::AttrTable::entry::is_alias, is_container(), libdap::AttrTable::entry::name, simple_find(), libdap::AttrTable::entry::type, and libdap::www2id().

Referenced by attr_alias().

Here is the call graph for this function:

unsigned int libdap::AttrTable::append_attr ( const string &  name,
const string &  type,
const string &  value 
)
virtual

If the given name already refers to an attribute, and the attribute has a value, the given value is appended to the attribute vector. Calling this function repeatedly is the way to append to an attribute vector.

The function throws an Error if the attribute is a container, or if the type of the input value does not match the existing attribute's type. Use append_container() to add container attributes.

This method performs a simple search for name in this attribute table only; sub-tables are not searched and the dot notation is not recognized.

Returns
Returns the length of the added attribute value.
Parameters
nameThe name of the attribute to add or modify.
typeThe type of the attribute to add or modify.
valueThe value to add to the attribute table.

Definition at line 306 of file AttrTable.cc.

References libdap::AttrTable::entry::attr, DBG, get_type(), libdap::AttrTable::entry::is_alias, libdap::AttrTable::entry::name, simple_find(), libdap::String_to_AttrType(), libdap::AttrTable::entry::type, and libdap::www2id().

Referenced by libdap::DDXParser::ddx_sax2_end_element(), libdap::Grid::transfer_attributes(), and libdap::BaseType::transfer_attributes().

Here is the call graph for this function:

unsigned int libdap::AttrTable::append_attr ( const string &  name,
const string &  type,
vector< string > *  values 
)
virtual

This version of append_attr() takes a vector<string> of values. If the given name already refers to an attribute, and the attribute has values, append the new values to the existing ones.

The function throws an Error if the attribute is a container, or if the type of the input value does not match the existing attribute's type. Use append_container() to add container attributes.

This method performs a simple search for name in this attribute table only; sub-tables are not searched and the dot notation is not recognized.

Returns
Returns the length of the added attribute value.
Parameters
nameThe name of the attribute to add or modify.
typeThe type of the attribute to add or modify.
valuesA vector of values. Note: The vector is COPIED, not stored.

Definition at line 361 of file AttrTable.cc.

References libdap::AttrTable::entry::attr, DBG, get_type(), libdap::AttrTable::entry::is_alias, libdap::AttrTable::entry::name, simple_find(), libdap::String_to_AttrType(), libdap::AttrTable::entry::type, and libdap::www2id().

Here is the call graph for this function:

AttrTable * libdap::AttrTable::append_container ( const string &  name)
virtual

Create and append an attribute container to this AttrTable. If this attribute table already contains an attribute container called name an exception is thrown. Return a pointer to the new container.

Parameters
nameThe name of the container to create.
Returns
A pointer to the new AttrTable object.

Definition at line 409 of file AttrTable.cc.

References AttrTable().

Referenced by libdap::DAS::add_table(), libdap::Grid::transfer_attributes(), libdap::DDS::transfer_attributes(), and libdap::BaseType::transfer_attributes().

Here is the call graph for this function:

AttrTable * libdap::AttrTable::append_container ( AttrTable at,
const string &  name 
)
virtual

Append a new attribute container to this attribute table. The new container is at and its name is set to name. If this attribute table already contains an attribute container called name an exception is thrown.

Note
The value of name will override the name of at set using the set_name() method.
Parameters
atA pointer to the new attribute table to append.
nameThe name of the new attribute table.
Returns
A pointer to the new AttrTable object.

Definition at line 439 of file AttrTable.cc.

References libdap::Attr_container, attr_end(), libdap::AttrTable::entry::attributes, DBG, get_name(), libdap::AttrTable::entry::is_alias, libdap::AttrTable::entry::name, set_name(), simple_find(), libdap::AttrTable::entry::type, and libdap::www2id().

Here is the call graph for this function:

bool libdap::AttrTable::attr_alias ( const string &  alias,
AttrTable at,
const string &  name 
)
virtual

Once an alias is inserted into an attribute table, reading the attributes for alias will return those stored for name.

Two forms for this function exist: one searches for name in the AttrTable referenced by at while the other uses this. You can use DAS::get_attr_table() to get the attribute table for an arbitrary name.

See also
get_attr_table
Deprecated:
The current alias design is flawed. It is impossible to map this onto the XML implementation where the DAS and DDS information are combined in one object.
Parameters
aliasThe alias to insert into the attribute table.
nameThe name of the already-existing attribute to which the alias will refer.
atAn attribute table in which to insert the alias.

Definition at line 1014 of file AttrTable.cc.

References add_value_alias().

Referenced by attr_alias().

Here is the call graph for this function:

bool libdap::AttrTable::attr_alias ( const string &  alias,
const string &  name 
)
virtual
Deprecated:
The current alias design is flawed. It is impossible to map this onto the XML implementation where the DAS and DDS information are combined in one object.
Parameters
aliasThe alias to insert into the attribute table.
nameThe name of the already-existing attribute to which the alias will refer.

Definition at line 1027 of file AttrTable.cc.

References attr_alias().

Here is the call graph for this function:

AttrTable::Attr_iter libdap::AttrTable::attr_begin ( )
virtual

Get an iterator to the first entry in this attribute table.

Returns
Attr_iter; references the end of the array if empty list.

Definition at line 710 of file AttrTable.cc.

Referenced by print_xml(), print_xml_writer(), recurrsive_find(), libdap::Grid::transfer_attributes(), libdap::DDS::transfer_attributes(), libdap::BaseType::transfer_attributes(), libdap::D4Attributes::transform_to_dap4(), and libdap::DAS::var_begin().

AttrTable::Attr_iter libdap::AttrTable::attr_end ( )
virtual
void libdap::AttrTable::clone ( const AttrTable at)
protected

Clone the given attribute table in this. Protected.

Definition at line 159 of file AttrTable.cc.

References libdap::Attr_container, libdap::AttrTable::entry::attributes, and libdap::AttrTable::entry::type.

Referenced by AttrTable(), and operator=().

void libdap::AttrTable::del_attr ( const string &  name,
int  i = -1 
)
virtual

Delete the attribute named name. If i is given, and the attribute has a vector value, delete the i$^th$ element of the vector.

You can use this function to delete container attributes, although the i parameter has no meaning for that operation.

Parameters
nameThe name of the attribute to delete. This can be an attribute of any type, including containers. However, this method looks only in this attribute table and does not recognize the dot notation.
iIf the named attribute is a vector, and i is non-negative, the i-th entry in the vector is deleted, and the array is repacked. If i equals -1 (the default), the entire attribute is deleted.

Definition at line 674 of file AttrTable.cc.

References libdap::AttrTable::entry::attr, libdap::Attr_container, simple_find(), and libdap::www2id().

Here is the call graph for this function:

AttrTable::Attr_iter libdap::AttrTable::del_attr_table ( Attr_iter  iter)
virtual

Delete the iterator. Since AttrTable stores pointers to AttrTable objects, the caller should be sure to delete the AttrTable itself. The caller will gain control of the AttrTable* located at get_attr_table(iter) prior to this call.

Note
The original semantics of this methods were odd. The caller was responsible for deleting the AttrTable, but if they did that before calling this, then memory corruption would happen (because this code accesses a field of the table). If the caller did not delete the table, memory leaked. The only correct way to call the method was to grab the pointer, call this and then delete the pointer. I added a call to delete the contained AttrTable pointer, which changes the behavior of this, but probably in a way that will fix leaks in existing code. This change can be reverted by setting NEW_DEL_ATTR_TABLE_BEHAVIOR to false. jhrg 4/26/13
calling this method invalidates the iterator iter.
Parameters
iterpoints to the entry to be deleted.
Returns
The Attr_iter for the element following iter

Definition at line 780 of file AttrTable.cc.

References libdap::Attr_container, and libdap::AttrTable::entry::attributes.

void libdap::AttrTable::dump ( ostream &  strm) const
virtual

Displays the pointer value of this instance and all attributes stored

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

Implements libdap::DapObj.

Definition at line 1509 of file AttrTable.cc.

References libdap::AttrTable::entry::aliased_to, libdap::AttrTable::entry::attr, libdap::Attr_container, libdap::AttrTable::entry::attributes, libdap::AttrType_to_String(), dump(), libdap::DapIndent::Indent(), libdap::AttrTable::entry::is_alias, libdap::DapIndent::LMarg(), libdap::AttrTable::entry::name, libdap::AttrTable::entry::type, and libdap::DapIndent::UnIndent().

Referenced by libdap::BaseType::dump(), libdap::DAS::dump(), dump(), and libdap::DDS::dump().

Here is the call graph for this function:

void libdap::AttrTable::erase ( )
virtual

Erase the entire attribute table. This returns an AttrTable to the empty state that's the same as the object generated by the null constructor.

Definition at line 1035 of file AttrTable.cc.

Referenced by libdap::DAS::erase().

void libdap::AttrTable::find ( const string &  target,
AttrTable **  at,
Attr_iter iter 
)
virtual

Look for an attribute or an attribute container. If used to search for an attribute container, this method returns the container's parent using the value-result parameter at and a reference to the container using the iterator value-result parameter iter. If used to search for an attribute, the attribute's container is returned using at; the attribute itself can be accessed using the iterator iter.

Parameters
targetThe name (using dot notation) of the attribute or container to find.
atA value-result used to return the attribute container in which target was found. Null if target was not found.
iterThe iterator which will reference the attribute found. Can be used to access target from within at. References dim_end() within at if the attribute or container does not exist.

Definition at line 480 of file AttrTable.cc.

References find_container(), and recurrsive_find().

Referenced by add_value_alias(), and find_container().

Here is the call graph for this function:

AttrTable * libdap::AttrTable::find_container ( const string &  target)
virtual

Look in this attribute table for an attribute container named target. The search starts at this attribute table; target should use the dot notation to name containers held within children of this attribute table.

To search the entire DAS object, make sure to invoke this method from that object.

Parameters
targetThe attribute container to find.
Returns
A pointer to the attribute table or null if the container cannot be found.

Definition at line 565 of file AttrTable.cc.

References find(), find_container(), and simple_find_container().

Referenced by find(), find_container(), and get_attr_table().

Here is the call graph for this function:

string libdap::AttrTable::get_attr ( const string &  name,
unsigned int  i = 0 
)
virtual

Definition at line 857 of file AttrTable.cc.

References simple_find().

Referenced by print_xml(), and print_xml_writer().

Here is the call graph for this function:

string libdap::AttrTable::get_attr ( Attr_iter  iter,
unsigned int  i = 0 
)
virtual

Returns the value of an attribute. If the attribute has a vector value, you can indicate which is the desired value with the index argument, i. If the argument is omitted, the first value is returned. If the attribute has only a single value, the index argument is ignored. If i is greater than the number of elements in the attribute, an error is produced.

All values in an attribute table are stored as string data. They may be converted to a more appropriate internal format by the calling program.

Parameters
iterReference to an attribute
iThe attribute value index, zero-based. Default value: 0
Returns
If the indicated attribute is a container, this function returns the string ``None''. If using a name to refer to the attribute and the named attribute does not exist, return the empty string.

Definition at line 850 of file AttrTable.cc.

References libdap::Attr_container.

AttrTable::Attr_iter libdap::AttrTable::get_attr_iter ( int  i)
virtual

Given an index i, return the Attr_iter to the corresponding element. This method provides a way to use all the methods that take an Attr_iter using a simple integer index. Use the get_attr_num() or get_size() methods to determine how many items the AttrTable contains.

Parameters
iThe index
Returns
The corresponding Attr_iter
See also
get_attr_num, get_size

Definition at line 731 of file AttrTable.cc.

unsigned int libdap::AttrTable::get_attr_num ( const string &  name)
virtual

If the indicated attribute is a container attribute, this function returns the number of attributes in its attribute table. If the indicated attribute is not a container, the method returns the number of values for the attribute (1 for a scalar attribute, N for a vector attribute value).

Definition at line 633 of file AttrTable.cc.

References simple_find().

Referenced by print_xml(), and print_xml_writer().

Here is the call graph for this function:

unsigned int libdap::AttrTable::get_attr_num ( Attr_iter  iter)
virtual

If the attribute referenced by iter is a container attribute, this method returns the number of attributes in its attribute table. If the indicated attribute is not a container, the method returns the number of values for the attribute (1 for a scalar attribute, N for a vector attribute value).

Parameters
iterReference to an attribute
Returns
The number of elements in the attribute.

Definition at line 828 of file AttrTable.cc.

References libdap::Attr_container.

AttrTable * libdap::AttrTable::get_attr_table ( const string &  name)
virtual
AttrTable * libdap::AttrTable::get_attr_table ( Attr_iter  iter)
virtual

Get the attribute container referenced by iter. If no such container exists, then return a reference to the end of the table.

Parameters
iterReference to a table contained by this object.
Returns
The child attribute table.

Definition at line 756 of file AttrTable.cc.

References libdap::Attr_container.

AttrType libdap::AttrTable::get_attr_type ( const string &  name)
virtual
Returns
The AttrType value describing the attribute.

Definition at line 620 of file AttrTable.cc.

References libdap::Attr_unknown, and simple_find().

Referenced by add_value_alias(), print_xml(), print_xml_writer(), libdap::Grid::transfer_attributes(), libdap::BaseType::transfer_attributes(), and libdap::D4Attributes::transform_to_dap4().

Here is the call graph for this function:

AttrType libdap::AttrTable::get_attr_type ( Attr_iter  iter)
virtual

Get the type of the attribute referenced by iter.

Parameters
iter
Returns
The datatype of this attribute in an instance of AttrType.

Definition at line 816 of file AttrTable.cc.

vector< string > * libdap::AttrTable::get_attr_vector ( const string &  name)
virtual

Get a pointer to the vector of values associated with the attribute referenced by Pix p or named name.

Note that all values in an attribute table are stored as string data. They may be converted to a more appropriate internal format by the calling program.

Returns
If the indicated attribute is a container, this function returns the null pointer. Otherwise returns a pointer to the the attribute vector value.

Definition at line 652 of file AttrTable.cc.

References simple_find().

Referenced by libdap::Grid::transfer_attributes(), libdap::BaseType::transfer_attributes(), and libdap::D4Attributes::transform_to_dap4().

Here is the call graph for this function:

vector< string > * libdap::AttrTable::get_attr_vector ( Attr_iter  iter)
virtual

Returns a pointer to the vector of values associated with the attribute referenced by iterator iter.

Note that all values in an attribute table are stored as string data. They may be converted to a more appropriate internal format by the calling program.

Parameters
iterReference to the Attribute.
Returns
If the indicated attribute is a container, this function returns the null pointer. Otherwise returns a pointer to the the attribute vector value.

Definition at line 875 of file AttrTable.cc.

References libdap::Attr_container.

string libdap::AttrTable::get_name ( Attr_iter  iter)
virtual

Returns the name of the attribute referenced by iter.

Definition at line 737 of file AttrTable.cc.

virtual AttrTable* libdap::AttrTable::get_parent ( ) const
inlinevirtual

Return a pointer to the AttrTable which holds this table (aka, its parent. If this AttrTable has no parent, this returns null.

Returns
A pointer to the parent AttrTable.

Definition at line 271 of file AttrTable.h.

unsigned int libdap::AttrTable::get_size ( ) const
virtual

Attributes that are containers count one attribute, as do attributes with both scalar and vector values.

Returns
The number of entries.

Definition at line 230 of file AttrTable.cc.

Referenced by libdap::DAS::get_size().

string libdap::AttrTable::get_type ( const string &  name)
virtual

Definition at line 612 of file AttrTable.cc.

References simple_find().

Referenced by append_attr(), print_xml(), print_xml_writer(), simple_print(), libdap::Grid::transfer_attributes(), and libdap::BaseType::transfer_attributes().

Here is the call graph for this function:

string libdap::AttrTable::get_type ( Attr_iter  iter)
virtual

Get the type name of an attribute referenced by iter.

Parameters
iterReference to the Attribute.
Returns
A string with the name of this attribute datatype.

Definition at line 807 of file AttrTable.cc.

References libdap::AttrType_to_String().

Here is the call graph for this function:

bool libdap::AttrTable::is_container ( Attr_iter  i)
virtual

Returns true if the attribute referenced by i is a container.

Definition at line 745 of file AttrTable.cc.

References libdap::Attr_container.

Referenced by add_value_alias(), print_xml(), print_xml_writer(), and simple_find_container().

virtual bool libdap::AttrTable::is_global_attribute ( ) const
inlinevirtual

Definition at line 276 of file AttrTable.h.

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

bool libdap::AttrTable::is_global_attribute ( Attr_iter  iter)
virtual

Definition at line 881 of file AttrTable.cc.

References libdap::Attr_container.

AttrTable & libdap::AttrTable::operator= ( const AttrTable rhs)

Definition at line 214 of file AttrTable.cc.

References clone().

Here is the call graph for this function:

void libdap::AttrTable::print ( FILE *  out,
string  pad = "    ",
bool  dereference = false 
)
virtual

Prints an ASCII representation of the attribute table to the indicated FILE pointer. The pad argument is prefixed to each line of the output to provide control of indentation.

Parameters
outPrint to the given output FILE.
padIndent elements of a table using this string of spaces. By default this is a string of four spaces
dereferenceIf true, follow aliases. Default is false.

Definition at line 1242 of file AttrTable.cc.

References get_name(), libdap::id2www(), and simple_print().

Referenced by libdap::DAS::print(), and libdap::DDS::print_das().

Here is the call graph for this function:

void libdap::AttrTable::print ( ostream &  out,
string  pad = "    ",
bool  dereference = false 
)
virtual

Prints an ASCII representation of the attribute table to the indicated output stream. The pad argument is prefixed to each line of the output to provide control of indentation.

Parameters
outPrint to the given output stream.
padIndent elements of a table using this string of spaces. By default this is a string of four spaces
dereferenceIf true, follow aliases. Default is false.

Definition at line 1284 of file AttrTable.cc.

References get_name(), libdap::id2www(), and simple_print().

Here is the call graph for this function:

void libdap::AttrTable::print_dap4 ( XMLWriter xml)

Write the DAP4 XML representation for this attribute table. This method is used to build the DAP4 DMR response object.

Parameters
xmlAn XMLWriter that will do the serialization

Definition at line 1497 of file AttrTable.cc.

References print_xml_writer().

Here is the call graph for this function:

void libdap::AttrTable::print_xml ( FILE *  out,
string  pad = "    ",
bool  constrained = false 
)
virtual

Print the attribute table in XML.

Parameters
outDestination
padIndent lines of text/xml this much. Default is four spaces.
constrainedNot used
Deprecated:

Definition at line 1312 of file AttrTable.cc.

References attr_begin(), attr_end(), libdap::Attr_other_xml, get_attr(), get_attr_num(), get_attr_table(), get_attr_type(), libdap::XMLWriter::get_doc(), libdap::XMLWriter::get_doc_size(), get_name(), get_type(), libdap::id2xml(), is_container(), print_xml(), and print_xml_writer().

Referenced by print_xml().

Here is the call graph for this function:

void libdap::AttrTable::print_xml ( ostream &  out,
string  pad = "    ",
bool  constrained = false 
)
virtual
void libdap::AttrTable::print_xml_writer ( XMLWriter xml)
AttrTable * libdap::AttrTable::recurrsive_find ( const string &  target,
Attr_iter location 
)
virtual

This method scans for attributes using recursion to look inside containers even when the name of the attribute is not fully qualified. It starts looking in itself and descends into its children depth first. It will find attributes and attribute containers.

Parameters
targetLook for the attribute with this name.
locationA value-result parameter. This returns an iterator to the attribute within the returned AttrTable object
Returns
Returns a pointer to the AttrTable which holds target, or null if target is not found. In the latter case, the value of location is attr_end() for this AttrTable.

Definition at line 512 of file AttrTable.cc.

References attr_begin(), libdap::Attr_container, attr_end(), and recurrsive_find().

Referenced by find(), and recurrsive_find().

Here is the call graph for this function:

virtual void libdap::AttrTable::set_is_global_attribute ( bool  ga)
inlinevirtual
void libdap::AttrTable::set_is_global_attribute ( Attr_iter  iter,
bool  ga 
)
virtual

Definition at line 890 of file AttrTable.cc.

References libdap::Attr_container.

void libdap::AttrTable::set_name ( const string &  n)
virtual
Parameters
nThe new name of the attribute table.

Definition at line 244 of file AttrTable.cc.

References libdap::www2id().

Referenced by append_container().

Here is the call graph for this function:

AttrTable::Attr_iter libdap::AttrTable::simple_find ( const string &  target)

Look in this AttrTable for the attribute called name. If found return an Attr_iter which references it, otherwise return the end iterator for this AttrTable.

Parameters
targetThe name of the attribute.
Returns
An Attr_iter which references target.

Definition at line 540 of file AttrTable.cc.

Referenced by add_container_alias(), add_value_alias(), append_attr(), append_container(), del_attr(), get_attr(), get_attr_num(), get_attr_type(), get_attr_vector(), and get_type().

AttrTable * libdap::AttrTable::simple_find_container ( const string &  target)

Definition at line 582 of file AttrTable.cc.

References get_name(), and is_container().

Referenced by find_container().

Here is the call graph for this function:

void libdap::AttrTable::simple_print ( FILE *  out,
string  pad,
Attr_iter  i,
bool  dereference 
)
protected

A simple printer that does nothing fancy with aliases. Protected.

Definition at line 1102 of file AttrTable.cc.

References libdap::Attr_container, libdap::Attr_other_xml, libdap::Attr_string, get_name(), get_type(), and libdap::id2www().

Referenced by print().

Here is the call graph for this function:

void libdap::AttrTable::simple_print ( ostream &  out,
string  pad,
Attr_iter  i,
bool  dereference 
)
protected

A simple printer that does nothing fancy with aliases. Protected.

Definition at line 1172 of file AttrTable.cc.

References libdap::Attr_container, libdap::Attr_other_xml, libdap::Attr_string, get_name(), get_type(), and libdap::id2www().

Here is the call graph for this function:

Friends And Related Function Documentation

friend class AttrTableTest
friend

Definition at line 246 of file AttrTable.h.


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