LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst::meas.astrom::detail::IndexManager Struct Reference

#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 31 of file utils.h.

Constructor & Destructor Documentation

lsst::meas.astrom::detail::IndexManager::IndexManager ( index_t *  ind)
inline

Definition at line 33 of file utils.h.

33 : index(ind) {}
lsst::meas.astrom::detail::IndexManager::~IndexManager ( )
inline

Definition at line 34 of file utils.h.

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

Member Function Documentation

void lsst::meas.astrom::detail::IndexManager::_close ( FILE *&  fid)
inline

Definition at line 52 of file utils.h.

52  {
53  if (fid) {
54  if (fclose(fid)) {
55  std::cerr << "Error closing an astrometry_net_data quadfile" << std::endl;
56  }
57  fid = NULL;
58  }
59  }
void lsst::meas.astrom::detail::IndexManager::_close ( void *  io)
inline

Definition at line 60 of file utils.h.

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

Member Data Documentation

index_t* lsst::meas.astrom::detail::IndexManager::index

Definition at line 32 of file utils.h.


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