NGen
Loading...
Searching...
No Matches
ngen::hydrofabric::anonymous_namespace{HydrofabricReaderFactory.cpp} Namespace Reference

Classes

struct  Identified
 The result of identifying a hydrofabric: which one it is, and any database opened to find out. More...
 

Functions

bool is_sqlite_file (const std::string &path)
 Whether path holds a SQLite database, which for a hydrofabric means a GeoPackage.
 
Identified identify (const std::string &catchment_path, const std::string &nexus_path)
 Identify the hydrofabric catchment_path and nexus_path name.
 

Variables

const char SQLITE_MAGIC [] = "SQLite format 3"
 Every SQLite database begins with this, trailing NUL included.
 

Function Documentation

◆ identify()

Identified ngen::hydrofabric::anonymous_namespace{HydrofabricReaderFactory.cpp}::identify ( const std::string & catchment_path,
const std::string & nexus_path )

Identify the hydrofabric catchment_path and nexus_path name.

Parameters
[in]catchment_pathPath to the file holding the divides
[in]nexus_pathPath to the file holding the nexuses; may be the same file
Returns
Identified The release identified, plus any GeoPackages opened to identify it
Exceptions
std::runtime_errorif the paths name different formats, if a GeoPackage cannot be opened or matches no known release, or if the paths name GeoPackages and GeoPackage support was not built in

References ngen::geopackage::GeoPackageReader::db(), ngen::hydrofabric::detect_hydrofabric(), identify(), is_sqlite_file(), ngen::geopackage::make_reader(), ngen::hydrofabric::V1_GEOJSON, and ngen::hydrofabric::anonymous_namespace{HydrofabricReaderFactory.cpp}::Identified::version.

Referenced by identify().

◆ is_sqlite_file()

bool ngen::hydrofabric::anonymous_namespace{HydrofabricReaderFactory.cpp}::is_sqlite_file ( const std::string & path)

Whether path holds a SQLite database, which for a hydrofabric means a GeoPackage.

Detect whether this is a SQLite database file by reading the beginning of the file, rather than simply reading the file name. This probably means, if we assume it is a hydrofabric, that it is a GeoPackage hydrofabric (versus something else like a GeoJson hydrofabric), though specific validity checks of that nature are the responsibility of something else.

Parameters
[in]pathHydrofabric data path
Returns
true if the file begins with the SQLite header
Exceptions
std::runtime_errorif the file cannot be opened for reading

References is_sqlite_file(), and SQLITE_MAGIC.

Referenced by identify(), and is_sqlite_file().

Variable Documentation

◆ SQLITE_MAGIC

const char ngen::hydrofabric::anonymous_namespace{HydrofabricReaderFactory.cpp}::SQLITE_MAGIC[] = "SQLite format 3"

Every SQLite database begins with this, trailing NUL included.

Referenced by is_sqlite_file().