Data Access Library (DAL)
 All Classes Functions Variables Typedefs Friends
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
dal::Group Class Reference

#include <Group.h>

Inheritance diagram for dal::Group:
dal::Node dal::BF_BeamGroup dal::BF_ProcessingHistory dal::BF_SubArrayPointing dal::BF_SysLog dal::Coordinate dal::CoordinatesGroup dal::Dataset< T > dal::File dal::TBB_Station dal::TBB_Trigger dal::Dataset< float > dal::Dataset< short >

List of all members.

Public Member Functions

 Group (Group &parent, const std::string &name)
 Group (const Group &other)
Groupoperator= (Group rhs)
virtual Groupcreate ()
virtual bool exists () const
void remove () const
void set (const Group &other, bool deepcopy)
Attribute< std::string > groupType ()
std::vector< std::string > nodeNames ()
ImplicitDowncast< NodegetNode (const std::string &name)

Protected Member Functions

friend Node::Node (Group &parent, const std::string &name)
const hid_gcgroup ()
virtual void initNodes ()
void addNode (Node *attr)
std::vector< std::string > memberNames ()
 Group (const hid_gc &fileId, FileInfo fileInfo)
 Constructor for root group (in File) only.

Protected Attributes

hid_gc _group
 hid of the Group. Always read it through group(). Set only once, then call initNodes().

Friends

void swap (Group &first, Group &second)

Detailed Description

Wraps an HDF5 group, providing core functionality.

A Group maintains a set of registered Nodes that it expects to be present.


Member Function Documentation

void dal::Group::addNode ( Node attr) [protected]

Add a node to the node map. Ownerschip is taken. Do not pass NULL.

Group & dal::Group::create ( ) [virtual]

Add this group to the HDF5 file.

Note: any attributes and subgroups must be added separately.

Reimplemented in dal::Dataset< T >, dal::Dataset< float >, and dal::Dataset< short >.

bool dal::Group::exists ( ) const [virtual]

Returns whether this group exists as a HDF5 group or dataset in the HDF5 file.

Reimplemented from dal::Node.

Reimplemented in dal::File.

ImplicitDowncast< Node > dal::Group::getNode ( const std::string &  name)

Returns a reference to a node from the map. initNodes() is called if needed, and an exception is thrown if the group has not been opened or created yet.

ImplicitDowncast<Node> allows getNode to be automatically cast to the required type (a subclass of Node), for example:

Attribute<int> &attr = getNode("MY_INTEGER");

It is the responsibility of the caller to request a type that is compatible with the type of object that is retrieved. If not, an std::bad_cast exception is thrown.

const hid_gc & dal::Group::group ( ) [protected]

Exposes the HDF5 object ID of this group. Opens the group if needed.

vector< string > dal::Group::nodeNames ( )

Returns a list of the HDF5 names of all nodes registered in this class.

void dal::Group::remove ( ) const

Removes this group/dataset from the HDF5 file. (Actually, a link to this data set is removed, but since we do not offer a way to create multiple links to a group, the group is indeed removed from the file.) Any members of this group will also be removed, although they will appear to still exists until all references to them have been dropped (like with Unix files). If this is a dataset, external files (if any) are not touched.

Python example:

    # Create and close a new HDF5 file called "example.h5"
    >>> f = File("example.h5", File.CREATE)

    # Create a group
    >>> g = Group(f, "GROUP")
    >>> g.create()
    >>> g.exists()
    True

    # Delete the group
    >>> g.remove()
    >>> g.exists()
    False

    # Clean up
    >>> import os
    >>> os.remove("example.h5")
void dal::Group::set ( const Group other,
bool  deepcopy 
)

Copies all members from another group into this one.

If `deepcopy` is set, subgroups and datasets are copied as well.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Friends