LSSTApplications  17.0+103,17.0+11,17.0+61,18.0.0+13,18.0.0+25,18.0.0+5,18.0.0+52,18.0.0-4-g68ffd23,18.1.0-1-g0001055+8,18.1.0-1-g03d53ef+1,18.1.0-1-g1349e88+28,18.1.0-1-g2505f39+22,18.1.0-1-g380d4d4+27,18.1.0-1-g5315e5e+1,18.1.0-1-g5e4b7ea+10,18.1.0-1-g7e8fceb+1,18.1.0-1-g85f8cd4+23,18.1.0-1-g9a6769a+13,18.1.0-1-ga1a4c1a+22,18.1.0-1-gd55f500+17,18.1.0-12-g42eabe8e+10,18.1.0-14-gd04256d+15,18.1.0-16-g430f6a53+1,18.1.0-17-gd2166b6e4,18.1.0-18-gb5d19ff+1,18.1.0-2-gfbf3545+7,18.1.0-2-gfefb8b5+16,18.1.0-3-g52aa583+13,18.1.0-3-g62b5e86+14,18.1.0-3-g8f4a2b1+17,18.1.0-3-g9bc06b8+7,18.1.0-3-gb69f684+9,18.1.0-4-g1ee41a7+1,18.1.0-5-g6dbcb01+13,18.1.0-5-gc286bb7+3,18.1.0-6-g48bdcd3+2,18.1.0-6-gd05e160+9,18.1.0-7-gc4d902b+2,18.1.0-7-gebc0338+8,18.1.0-9-gae7190a+10,w.2019.38
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst::meas::extensions::astrometryNet::detail::IndexManager Struct Reference

RAII manager for astrometry.net indices. More...

#include <utils.h>

Public Member Functions

 IndexManager (index_t *ind)
 
 ~IndexManager ()
 
void _close (FILE *&fid)
 
void _close (void *io)
 

Public Attributes

index_t * index
 

Detailed Description

RAII manager for astrometry.net indices.

Ensures index files are closed when done, to prevent "Too many open files" errors. See also #2292, #2879.

Definition at line 32 of file utils.h.

Constructor & Destructor Documentation

◆ IndexManager()

lsst::meas::extensions::astrometryNet::detail::IndexManager::IndexManager ( index_t *  ind)
inline

Definition at line 34 of file utils.h.

◆ ~IndexManager()

lsst::meas::extensions::astrometryNet::detail::IndexManager::~IndexManager ( )
inline

Definition at line 35 of file utils.h.

35  {
36  // Change once astrometry.net-0.40+ is in...
37  /*
38  if (index_close_fds(ind)) {
39  throw LSST_EXCEPT(lsst::pex::exceptions::IoError,
40  "Failed to index_close_fds() an astrometry_net_data file");
41  }
42  */
43  if (index->quads && index->quads->fb && index->quads->fb->fid) {
44  _close(index->quads->fb->fid);
45  }
46  if (index->codekd && index->codekd->tree && index->codekd->tree->io) {
47  _close(index->codekd->tree->io);
48  }
49  if (index->starkd && index->starkd->tree && index->starkd->tree->io) {
50  _close(index->starkd->tree->io);
51  }
52  }

Member Function Documentation

◆ _close() [1/2]

void lsst::meas::extensions::astrometryNet::detail::IndexManager::_close ( FILE *&  fid)
inline

Definition at line 53 of file utils.h.

53  {
54  if (fid) {
55  if (fclose(fid)) {
56  std::cerr << "Error closing an astrometry_net_data quadfile" << std::endl;
57  }
58  fid = NULL;
59  }
60  }
T endl(T... args)
T fclose(T... args)

◆ _close() [2/2]

void lsst::meas::extensions::astrometryNet::detail::IndexManager::_close ( void *  io)
inline

Definition at line 61 of file utils.h.

61  {
62  _close(reinterpret_cast<kdtree_fits_t*>(io)->fid);
63  }

Member Data Documentation

◆ index

index_t* lsst::meas::extensions::astrometryNet::detail::IndexManager::index

Definition at line 33 of file utils.h.


The documentation for this struct was generated from the following file: