RcppBind_datasets_hdf5

C++ Function Reference

1 Signature

void BigDataStatMeth::RcppBind_datasets_hdf5(std::string filename, std::string group, Rcpp::StringVector datasets, std::string outgroup, std::string outdataset, std::string func, bool binternal, Rcpp::Nullable< bool > overwrite=false)

2 Description

High-level interface for binding HDF5 datasets.

3 Parameters

  • filename (std::string): HDF5 file path
  • group (std::string): Source group containing input datasets
  • datasets (Rcpp::StringVector): Vector of dataset names to bind
  • outgroup (std::string): Output group path
  • outdataset (std::string): Output dataset name
  • func (std::string): Binding function type:“bindCols”: Combine datasets by columns”bindRows”: Combine datasets by rows”bindRowsbyIndex”: Combine datasets by rows using an index
  • binternal (bool): Internal processing flag
  • overwrite (Rcpp::Nullable< bool >): Optional flag to overwrite existing output dataset

4 Details

filenameHDF5 file path groupSource group containing input datasets datasetsVector of dataset names to bind outgroupOutput group path outdatasetOutput dataset name funcBinding function type:“bindCols”: Combine datasets by columns”bindRows”: Combine datasets by rows”bindRowsbyIndex”: Combine datasets by rows using an index binternalInternal processing flag overwriteOptional flag to overwrite existing output datasetstd::range_errorif func is not one of the allowed values H5::FileIExceptionon file access errors H5::GroupIExceptionon group operation errors H5::DataSetIExceptionon dataset operation errors std::exceptionon general errorsRcppBind_datasets_hdf5(std::string, std::string, Rcpp::StringVector, BigDataStatMeth::hdf5Dataset*, int, bool) for the lower-level implementation Example: RcppBind_datasets_hdf5(“data.h5”,“/input”,{“ds1”,“ds2”},“/output”,“combined”,“bindRows”,false,true);

5 Call Graph

Function dependencies

6 Source Code

File: inst/include/hdf5Utilities/hdf5BindDatasets.hppLines 213-268

inline void RcppBind_datasets_hdf5( std::string filename, std::string group, Rcpp::StringVector datasets, 
                               std::string outgroup, std::string outdataset, std::string func, 
                               bool binternal, Rcpp::Nullable<bool> overwrite = false )
    {
        
        BigDataStatMeth::hdf5Dataset* dsOut = nullptr;
        
        try
        {
            
            Rcpp::NumericVector oper = {0, 1, 2};
            oper.names() = Rcpp::CharacterVector({ "bindCols", "bindRows", "bindRowsbyIndex"});
            
            bool boverwrite;
            
            if( overwrite.isNull()) { boverwrite = false; } 
            else {   boverwrite = Rcpp::as<bool>(overwrite); }
            
            if (func.compare("bindCols") != 0 && func.compare("bindRows") != 0  && func.compare("bindRowsbyIndex") != 0 ) {
                throw std::range_error( "Function to apply must be \"bindRows\", \"bindCols\" or \"bindRowsbyIndex\" other values are not allowed" );
                return void();
            }
            
            int bindFunction = oper.findName( func );
            
            dsOut = new BigDataStatMeth::hdf5Dataset(filename, outgroup, outdataset, boverwrite);
            
            RcppBind_datasets_hdf5( filename, group, datasets, dsOut, bindFunction, binternal);
            
            delete dsOut; dsOut = nullptr;
            
        } catch( H5::FileIException& error ) { 
            checkClose_file(dsOut);
            Rcpp::Rcerr<<"c++ exception RcppBind_datasets_hdf5_ (File IException)";
            return void();
        } catch( H5::GroupIException & error ) { 
            checkClose_file(dsOut);
            Rcpp::Rcerr <<"c++ exception RcppBind_datasets_hdf5_ (Group IException)";
            return void();
        } catch( H5::DataSetIException& error ) { 
            checkClose_file(dsOut);
            Rcpp::Rcerr <<"c++ exception RcppBind_datasets_hdf5_ (DataSet IException)";
            return void();
        } catch(std::exception& ex) {
            checkClose_file(dsOut);
            Rcpp::Rcerr <<"c++ exception RcppBind_datasets_hdf5_" << ex.what();
            return void();
        } catch (...) {
            checkClose_file(dsOut);
            Rcpp::Rcerr<<"C++ exception RcppBind_datasets_hdf5_ (unknown reason)";
            return void();
        }
        
        return void();
        
    }

7 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = RcppBind_datasets_hdf5(...);