icedb  version 0.5.1
Snow particle scattering database API
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
icedb::Groups::Group Class Referenceabstract

A group is similar to a folder / directory. It can have Attributes and Tables. More...

#include <Group.hpp>

Inheritance diagram for icedb::Groups::Group:
Inheritance graph
[legend]
Collaboration diagram for icedb::Groups::Group:
Collaboration graph
[legend]

Public Types

typedef std::unique_ptr< Groups::GroupGroup_ptr
 
typedef std::shared_ptr< H5::Group > Group_HDF_shared_ptr
 

Public Member Functions

virtual ~Group ()
 
virtual Group_ptr createGroup (const std::string &groupName)=0
 Create a group. More...
 
virtual Group_ptr openGroup (const std::string &groupName) const =0
 Opens a group. More...
 
virtual bool doesGroupExist (const std::string &groupName) const =0
 Does a group with this name exist? More...
 
virtual std::set< std::string > getGroupNames () const =0
 Get the names of all sub-groups within the current group. More...
 
virtual void deleteGroup (const std::string &groupName)=0
 Unlink the specified child group. More...
 
virtual Group_HDF_shared_ptr getHDF5Group () const =0
 Get the fundamental HDF5 object that the group is built on. More...
 
- Public Member Functions inherited from icedb::Attributes::CanHaveAttributes
 ~CanHaveAttributes ()
 
bool doesAttributeExist (const std::string &attributeName) const
 Does the object have an attribute with the given name? More...
 
std::type_index getAttributeTypeId (const std::string &attributeName) const
 Returns the type of an attribute. More...
 
template<class Type >
bool isAttributeOfType (const std::string &attributeName) const
 Is the type of the attribute "Type"? More...
 
std::set< std::string > getAttributeNames () const
 List all attributes attached to this object. More...
 
void deleteAttribute (const std::string &attributeName)
 Delete an attribute, by name, that is attached to this object. More...
 
template<class DataType >
void readAttributeData (const std::string &attributeName, std::vector< size_t > &dimensions, std::vector< DataType > &data) const
 Function to read the data from an attribute using the provided input vectors. More...
 
template<class DataType >
void writeAttributeData (const std::string &attributeName, const std::vector< size_t > &dimensionas, const std::vector< DataType > &data)
 Function to write an attribute to an object, with the provided raw data. More...
 
template<class DataType >
Attribute< DataType > readAttribute (const std::string &attributeName) const
 Convenience function to read an attribute's data and return an Attribute object. More...
 
template<class DataType >
void writeAttribute (const Attribute< DataType > &attribute)
 Convenience function to write an Attribute to an object. More...
 
template<class DataType >
void writeAttribute (const std::string &name, std::initializer_list< size_t > dims, std::initializer_list< DataType > data)
 Convenience function to write a small Attribute to an object, using initializer lists. More...
 
- Public Member Functions inherited from icedb::Tables::CanHaveTables
 ~CanHaveTables ()
 
std::set< std::string > getTableNames () const
 Lists all table names that are children of this object. More...
 
bool doesTableExist (const std::string &tableName) const
 Does a table exist with the given name. More...
 
void unlinkTable (const std::string &tableName)
 Unlink a table. In HDF5, this is not the same as erasing a table, which never actually happens. More...
 
Table::Table_Type openTable (const std::string &tableName)
 
std::vector< size_t > getChunkStrategy (const std::vector< size_t > &dims)
 The default chunking strategy for this table. Used for storage i/o speed, and for compression. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, const std::vector< size_t > &dims, const std::vector< size_t > *chunks=nullptr)
 Create a table. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, std::initializer_list< size_t > dims, const std::vector< size_t > *chunks=nullptr)
 Create a table. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, std::initializer_list< size_t > dims, std::initializer_list< DataType > data, const std::vector< size_t > *chunks=nullptr)
 Create a table and writes initial data. Used with small tables. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, std::initializer_list< size_t > dims, const std::vector< DataType > &data, const std::vector< size_t > *chunks=nullptr)
 Create a table and sets the table's initial data. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, std::initializer_list< size_t > dims, const gsl::span< DataType > &data, const std::vector< size_t > *chunks=nullptr)
 Create a table and sets the table's initial data. More...
 
template<class DataType >
Table::Table_Type createTable (const std::string &tableName, std::initializer_list< size_t > dims, const gsl::span< const DataType > &data, const std::vector< size_t > *chunks=nullptr)
 Create a table and sets the table's initial data. More...
 

Static Public Member Functions

static Group_ptr createGroup (const std::string &name, gsl::not_null< H5::Group *> parent)
 Create a group with a specified parent (static function) More...
 
static Group_ptr createGroup (const std::string &name, gsl::not_null< H5::H5File *> parent)
 Create a group with a specified parent (static function) More...
 
static Group_ptr createGroup (const std::string &name, gsl::not_null< const Group *> parent)
 Create a group with a specified parent (static function) More...
 
static Group_ptr openGroup (const std::string &name, gsl::not_null< H5::Group *> parent)
 Open a group under the specified parent (static function) More...
 
static Group_ptr openGroup (const std::string &name, gsl::not_null< H5::H5File *> parent)
 Open a group under the specified parent (static function) More...
 
static Group_ptr openGroup (const std::string &name, gsl::not_null< const Group *> parent)
 Open a group under the specified parent (static function) More...
 
static Group_ptr openGroup (Group_HDF_shared_ptr group)
 Open an icedb group from an HDF5 group object. More...
 
static Group_ptr mount (const std::string &subdirname, gsl::not_null< const Group *> containingParent, gsl::not_null< H5::H5File *> pointsTo)
 Mount an HDF5 file as a child 'group'. More...
 
- Static Public Member Functions inherited from icedb::Attributes::CanHaveAttributes
static bool doesAttributeExist (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName)
 Does an object (parent) have an attribute with the given name? More...
 
static std::type_index getAttributeTypeId (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName)
 Returns the type of an attribute. More...
 
template<class DataType >
static void readAttributeData (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName, std::vector< size_t > &dimensions, std::vector< DataType > &data)
 Function to read the data from an attribute. More...
 
template<class DataType >
static Attribute< DataType > readAttribute (gsl::not_null< const H5::H5Object *> obj, const std::string &attributeName)
 Convenience function to read an attribute's data and return an Attribute object. More...
 

Public Attributes

const std::string name
 The name of the group. More...
 

Static Public Attributes

static const std::string _icedb_obj_type_identifier = { "_icedb_obj_type" }
 The tag used in icedb to identify a group. More...
 

Protected Member Functions

 Group ()
 
 Group (const std::string &name)
 
- Protected Member Functions inherited from icedb::Attributes::CanHaveAttributes
 CanHaveAttributes ()
 
virtual void _setAttributeParent (std::shared_ptr< H5::H5Object > obj)=0
 
virtual std::shared_ptr< H5::H5Object > _getAttributeParent () const =0
 
- Protected Member Functions inherited from icedb::Tables::CanHaveTables
 CanHaveTables ()
 Trivial constructor used when CanHaveTables is a virtual base class. More...
 
virtual void _setTablesParent (std::shared_ptr< H5::Group > obj)=0
 CanHaveTables needs post-constructor setup. This sets the base HDF5 object that gets manipulated. More...
 
virtual std::shared_ptr< H5::Group > _getTablesParent () const =0
 Gets the base HDF5 object that is manipulated. More...
 

Detailed Description

A group is similar to a folder / directory. It can have Attributes and Tables.

Definition at line 22 of file Group.hpp.

Member Typedef Documentation

◆ Group_HDF_shared_ptr

typedef std::shared_ptr<H5::Group> icedb::Groups::Group::Group_HDF_shared_ptr

Definition at line 32 of file Group.hpp.

◆ Group_ptr

Definition at line 30 of file Group.hpp.

Constructor & Destructor Documentation

◆ Group() [1/2]

icedb::Groups::Group::Group ( )
protected

Definition at line 9 of file Groups.cpp.

9 : name{} {}
const std::string name
The name of the group.
Definition: Group.hpp:34

◆ Group() [2/2]

icedb::Groups::Group::Group ( const std::string &  name)
protected

Definition at line 10 of file Groups.cpp.

10 : name{ name } {}
const std::string name
The name of the group.
Definition: Group.hpp:34

◆ ~Group()

icedb::Groups::Group::~Group ( )
virtual

Definition at line 15 of file Groups.cpp.

15 {}

Member Function Documentation

◆ createGroup() [1/4]

virtual Group_ptr icedb::Groups::Group::createGroup ( const std::string &  groupName)
pure virtual

Create a group.

Parameters
groupNameis the new group's name
Exceptions
ifread-only
ifa group with htis name already exists
Returns
a pointer to the new group

Implemented in icedb::Groups::Group_impl.

Referenced by icedb::Groups::_Impl_createGroup(), icedb::Groups::Group_impl::createGroup(), icedb::Databases::Database_impl::createGroup(), createGroup(), and icedb::Shapes::Shape::createShape().

Here is the caller graph for this function:

◆ createGroup() [2/4]

Group::Group_ptr icedb::Groups::Group::createGroup ( const std::string &  name,
gsl::not_null< H5::Group *>  parent 
)
static

Create a group with a specified parent (static function)

Parameters
nameis the new group's name
isthe new group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifparent is read only
ifa group with this name already exists

Definition at line 91 of file Groups.cpp.

References icedb::Attributes::CanHaveAttributes_impl::parent.

91  {
92  return _Impl_createGroup<H5::Group>(groupName, parent);
93  }

◆ createGroup() [3/4]

Group::Group_ptr icedb::Groups::Group::createGroup ( const std::string &  name,
gsl::not_null< H5::H5File *>  parent 
)
static

Create a group with a specified parent (static function)

Parameters
nameis the new group's name
isthe new group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifparent is read only
ifa group with this name already exists

Definition at line 95 of file Groups.cpp.

References icedb::Attributes::CanHaveAttributes_impl::parent.

95  {
96  return _Impl_createGroup<H5::H5File>(groupName, parent);
97  }

◆ createGroup() [4/4]

Group::Group_ptr icedb::Groups::Group::createGroup ( const std::string &  name,
gsl::not_null< const Group *>  parent 
)
static

Create a group with a specified parent (static function)

Parameters
nameis the new group's name
isthe new group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifparent is read only
ifa group with this name already exists

Definition at line 101 of file Groups.cpp.

References createGroup().

101  {
102  return std::move(Group::createGroup(name, parent->getHDF5Group().get()));
103  }
virtual Group_ptr createGroup(const std::string &groupName)=0
Create a group.
const std::string name
The name of the group.
Definition: Group.hpp:34
Here is the call graph for this function:

◆ deleteGroup()

virtual void icedb::Groups::Group::deleteGroup ( const std::string &  groupName)
pure virtual

Unlink the specified child group.

Parameters
groupNameis the name of the group to be unlinked
Exceptions
ifgroupName is invalid
ifa group with name groupName does not exist

Implemented in icedb::Groups::Group_impl.

◆ doesGroupExist()

virtual bool icedb::Groups::Group::doesGroupExist ( const std::string &  groupName) const
pure virtual

Does a group with this name exist?

Returns
true if it exists, false otherwise
Parameters
groupNameis the name of the group
Exceptions
ifgroupName is somehow invalid

Implemented in icedb::Groups::Group_impl.

Referenced by icedb::Shapes::Shape::createShape(), icedb::Shapes::Shape::isShape(), and icedb::Shapes::Shape::openShape().

Here is the caller graph for this function:

◆ getGroupNames()

virtual std::set<std::string> icedb::Groups::Group::getGroupNames ( ) const
pure virtual

Get the names of all sub-groups within the current group.

Returns
a set of group names

Implemented in icedb::Groups::Group_impl.

◆ getHDF5Group()

virtual Group_HDF_shared_ptr icedb::Groups::Group::getHDF5Group ( ) const
pure virtual

Get the fundamental HDF5 object that the group is built on.

Implemented in icedb::Groups::Group_impl.

Referenced by icedb::Shapes::Shape::createShape(), icedb::Shapes::Shape::isShape(), icedb::Shapes::Shape::isValid(), and icedb::Shapes::Shape::openShape().

Here is the caller graph for this function:

◆ mount()

Group::Group_ptr icedb::Groups::Group::mount ( const std::string &  subdirname,
gsl::not_null< const Group *>  containingParent,
gsl::not_null< H5::H5File *>  pointsTo 
)
static

Mount an HDF5 file as a child 'group'.

Parameters
subdirnameis the mount point
containingParentis the parent location of the mount point
pointsTois the file that gets mounted into containingParent/subdirname
Exceptions
ifeither containingParent or points to are invalid
Returns
A pointer to the mounted location
Note
HDF5 C++ bug in constness on 1.8.5, CentOS 6. I cannot directly pass H5P_DEFAULT to the trivial constructor for H5::PropList as an rvalue

Definition at line 158 of file Groups.cpp.

References icedb::Groups::Group_impl::openGroup().

161  {
164  H5::PropList pl(H5P_DEFAULT);
165  containingParent->getHDF5Group()->mount(subdirname, *(pointsTo.get()), pl);
166  return openGroup(subdirname, containingParent);
167  }
virtual Group_ptr openGroup(const std::string &groupName) const =0
Opens a group.
Here is the call graph for this function:

◆ openGroup() [1/5]

virtual Group_ptr icedb::Groups::Group::openGroup ( const std::string &  groupName) const
pure virtual

Opens a group.

Parameters
groupNameis the name of the group to be opened
Exceptions
ifthe group does not exist
Returns
a pointer to the newly-opened group

Implemented in icedb::Groups::Group_impl.

Referenced by icedb::Databases::Database_impl::createGroupStructure(), icedb::Shapes::Shape::createShape(), icedb::Shapes::Shape::isShape(), main(), icedb::Groups::Group_impl::openGroup(), icedb::Databases::Database_impl::openGroup(), openGroup(), and icedb::Shapes::Shape::openShape().

Here is the caller graph for this function:

◆ openGroup() [2/5]

Group::Group_ptr icedb::Groups::Group::openGroup ( const std::string &  name,
gsl::not_null< H5::Group *>  parent 
)
static

Open a group under the specified parent (static function)

Parameters
nameis the group's name
isthe group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifa group with this name does not exist

Definition at line 119 of file Groups.cpp.

References name, and icedb::Attributes::CanHaveAttributes_impl::parent.

119  {
120  return std::make_unique<Group_impl>(name, parent);
121  //return std::move(Group::Group_ptr( new Group_impl(name, parent)));
122  }
const std::string name
The name of the group.
Definition: Group.hpp:34

◆ openGroup() [3/5]

Group::Group_ptr icedb::Groups::Group::openGroup ( const std::string &  name,
gsl::not_null< H5::H5File *>  parent 
)
static

Open a group under the specified parent (static function)

Parameters
nameis the group's name
isthe group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifa group with this name does not exist

Definition at line 123 of file Groups.cpp.

References name, and icedb::Attributes::CanHaveAttributes_impl::parent.

123  {
124  return std::make_unique<Group_impl>(name, parent);
125  //return std::move(Group::Group_ptr( new Group_impl(name, parent)));
126  }
const std::string name
The name of the group.
Definition: Group.hpp:34

◆ openGroup() [4/5]

Group::Group_ptr icedb::Groups::Group::openGroup ( const std::string &  name,
gsl::not_null< const Group *>  parent 
)
static

Open a group under the specified parent (static function)

Parameters
nameis the group's name
isthe group's parent
Exceptions
ifparent is invalid
ifname is invalid
ifa group with this name does not exist

Definition at line 134 of file Groups.cpp.

References openGroup().

134  {
135  return std::move(Group::openGroup(name, parent->getHDF5Group().get()));
136  }
virtual Group_ptr openGroup(const std::string &groupName) const =0
Opens a group.
const std::string name
The name of the group.
Definition: Group.hpp:34
Here is the call graph for this function:

◆ openGroup() [5/5]

Group::Group_ptr icedb::Groups::Group::openGroup ( Group_HDF_shared_ptr  group)
static

Open an icedb group from an HDF5 group object.

Parameters
groupis the HDF5 group

Definition at line 130 of file Groups.cpp.

References icedb::Attributes::CanHaveAttributes_impl::parent.

130  {
131  return std::make_unique<Group_impl>(parent);
132  }

Member Data Documentation

◆ _icedb_obj_type_identifier

std::string const icedb::Groups::Group::_icedb_obj_type_identifier = { "_icedb_obj_type" }
static

The tag used in icedb to identify a group.

Definition at line 29 of file Group.hpp.

Referenced by icedb::Groups::Group_impl::Group_impl(), and icedb::Shapes::Shape::isValid().

◆ name

const std::string icedb::Groups::Group::name

The name of the group.

Definition at line 34 of file Group.hpp.

Referenced by icedb::Groups::Group_impl::Group_impl(), icedb::Groups::Group_impl::openGroup(), and openGroup().


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