icedb  version 0.5.1
Snow particle scattering database API
Public Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
icedb::Databases::Database_impl Class Reference

#include <Database_impl.hpp>

Inheritance diagram for icedb::Databases::Database_impl:
Inheritance graph
[legend]
Collaboration diagram for icedb::Databases::Database_impl:
Collaboration graph
[legend]

Public Member Functions

 Database_impl ()
 
 Database_impl (size_t virtualMemSizeInBytes)
 
virtual ~Database_impl ()
 
Groups::Group::Group_ptr openGroup (const std::string &path) override
 
Groups::Group::Group_ptr createGroup (const std::string &path) override
 
Groups::Group::Group_ptr createGroupStructure (const std::string &groupName) override
 
Groups::Group::Group_ptr createGroupStructure (const std::vector< std::string > &groupNames) override
 
- Public Member Functions inherited from icedb::Databases::Database
virtual ~Database ()
 

Static Private Member Functions

static std::shared_ptr< H5::H5File > makeDatabaseFileStandard (const std::string &p)
 

Private Attributes

std::shared_ptr< H5::H5File > hFile
 
file_image hFileImage
 Used if a virtual base is needed (the typical case) More...
 

Friends

class Database
 

Additional Inherited Members

- Public Types inherited from icedb::Databases::Database
typedef std::unique_ptr< DatabaseDatabase_ptr
 
- Static Public Member Functions inherited from icedb::Databases::Database
static Database_ptr createSampleDatabase (const std::string &location)
 
static Database_ptr createSingleFileDatabase (const std::string &location)
 
static Database_ptr openDatabase (const std::string &location, fs::IOopenFlags flags=fs::IOopenFlags::READ_ONLY)
 
static Database_ptr openVirtualDatabase (size_t memSizeInBytes)
 
static void indexDatabase (const std::string &location)
 
- Protected Member Functions inherited from icedb::Databases::Database
 Database ()
 

Detailed Description

Definition at line 19 of file Database_impl.hpp.

Constructor & Destructor Documentation

◆ Database_impl() [1/2]

icedb::Databases::Database_impl::Database_impl ( )

Definition at line 56 of file databases.cpp.

56  : hFileImage(fs::impl::getUniqueVROOTname(), 10 * 1024 * 1024)
57  { }
file_image hFileImage
Used if a virtual base is needed (the typical case)
std::string getUniqueVROOTname()
Generate a unique string, used in memort-only HDF5 file trees.
Definition: fs_backend.cpp:100

◆ Database_impl() [2/2]

icedb::Databases::Database_impl::Database_impl ( size_t  virtualMemSizeInBytes)

Definition at line 59 of file databases.cpp.

59  : hFileImage(fs::impl::getUniqueVROOTname(), virtualMemSizeInBytes)
60  { }
file_image hFileImage
Used if a virtual base is needed (the typical case)
std::string getUniqueVROOTname()
Generate a unique string, used in memort-only HDF5 file trees.
Definition: fs_backend.cpp:100

◆ ~Database_impl()

icedb::Databases::Database_impl::~Database_impl ( )
virtual

Definition at line 62 of file databases.cpp.

62 {}

Member Function Documentation

◆ createGroup()

Groups::Group::Group_ptr icedb::Databases::Database_impl::createGroup ( const std::string &  path)
overridevirtual

Implements icedb::Databases::Database.

Definition at line 48 of file databases.cpp.

References icedb::Groups::Group::createGroup(), and icedb::Databases::file_image::hFile.

48  {
49  return Groups::Group::createGroup(path, hFile.get());
50  }
virtual Group_ptr createGroup(const std::string &groupName)=0
Create a group.
std::shared_ptr< H5::H5File > hFile
Here is the call graph for this function:

◆ createGroupStructure() [1/2]

Groups::Group::Group_ptr icedb::Databases::Database_impl::createGroupStructure ( const std::string &  groupName)
overridevirtual

Implements icedb::Databases::Database.

Definition at line 193 of file databases.cpp.

References icedb::fs::hdf5::createGroupStructure(), hFile, and icedb::Groups::Group::openGroup().

194  {
195  H5::Group grp = icedb::fs::hdf5::createGroupStructure(groupName, *(hFile.get()));
196  std::shared_ptr<H5::Group> ngrp = std::make_shared<H5::Group>(grp);
197  return Groups::Group::openGroup(ngrp);
198  }
H5::Group createGroupStructure(const std::string &groupName, ICEDB_H5_GROUP_OWNER &base)
virtual Group_ptr openGroup(const std::string &groupName) const =0
Opens a group.
std::shared_ptr< H5::H5File > hFile
Here is the call graph for this function:

◆ createGroupStructure() [2/2]

Groups::Group::Group_ptr icedb::Databases::Database_impl::createGroupStructure ( const std::vector< std::string > &  groupNames)
overridevirtual

Implements icedb::Databases::Database.

Definition at line 199 of file databases.cpp.

References icedb::fs::hdf5::createGroupStructure(), hFile, and icedb::Groups::Group::openGroup().

200  {
201  H5::Group grp = icedb::fs::hdf5::createGroupStructure(groupNames, *(hFile.get()));
202  std::shared_ptr<H5::Group> ngrp = std::make_shared<H5::Group>(grp);
203  return Groups::Group::openGroup(ngrp);
204  }
H5::Group createGroupStructure(const std::string &groupName, ICEDB_H5_GROUP_OWNER &base)
virtual Group_ptr openGroup(const std::string &groupName) const =0
Opens a group.
std::shared_ptr< H5::H5File > hFile
Here is the call graph for this function:

◆ makeDatabaseFileStandard()

std::shared_ptr< H5::H5File > icedb::Databases::Database_impl::makeDatabaseFileStandard ( const std::string &  p)
staticprivate

Definition at line 34 of file databases.cpp.

References basegrp, icedb::fs::hdf5::getHDF5IOflags(), and icedb::fs::TRUNCATE.

Referenced by icedb::Databases::Database::createSampleDatabase(), icedb::Databases::Database::createSingleFileDatabase(), and icedb::Databases::Database::indexDatabase().

34  {
35  auto res = std::make_shared<H5::H5File>(p,
37  H5P_DEFAULT);
38  constexpr uint64_t dbverno = 1;
39  auto basegrp = res->openGroup("."); //->getHDF5Group();
40  icedb::fs::hdf5::addAttr<uint64_t, H5::Group>(&basegrp, "Version", dbverno);
41  icedb::fs::hdf5::addAttr<std::string, H5::Group>(&basegrp, "Software", "libicedb");
42 
43  //icedb::fs::hdf5::addAttr<uint64_t, H5::H5File>(res.get(), "Version", dbverno);
44  //icedb::fs::hdf5::addAttr<std::string, H5::H5File>(res.get(), "Software", "libicedb");
45  return res;
46  }
icedb::Groups::Group::Group_ptr basegrp
Shapes get written to this location in the output database.
Definition: shapes-main.cpp:79
unsigned int getHDF5IOflags(fs::IOopenFlags flags)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openGroup()

Groups::Group::Group_ptr icedb::Databases::Database_impl::openGroup ( const std::string &  path)
overridevirtual

Implements icedb::Databases::Database.

Definition at line 52 of file databases.cpp.

References icedb::Databases::file_image::hFile, and icedb::Groups::Group::openGroup().

52  {
53  return Groups::Group::openGroup(path, hFile.get());
54  }
virtual Group_ptr openGroup(const std::string &groupName) const =0
Opens a group.
std::shared_ptr< H5::H5File > hFile
Here is the call graph for this function:

Friends And Related Function Documentation

◆ Database

friend class Database
friend

Definition at line 20 of file Database_impl.hpp.

Member Data Documentation

◆ hFile

std::shared_ptr<H5::H5File> icedb::Databases::Database_impl::hFile
private

Definition at line 21 of file Database_impl.hpp.

Referenced by createGroupStructure().

◆ hFileImage

file_image icedb::Databases::Database_impl::hFileImage
private

Used if a virtual base is needed (the typical case)

Definition at line 22 of file Database_impl.hpp.


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