lsst.afw  13.0-102-g6486c126f
IdFactory.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef AFW_TABLE_IdFactory_h_INCLUDED
3 #define AFW_TABLE_IdFactory_h_INCLUDED
4 
5 #include <memory>
6 
7 #include "lsst/base.h"
8 #include "lsst/afw/table/misc.h"
9 
10 namespace lsst {
11 namespace afw {
12 namespace table {
13 
21 class IdFactory {
22 public:
24  virtual RecordId operator()() = 0;
25 
27  virtual void notify(RecordId id) = 0;
28 
30  virtual std::shared_ptr<IdFactory> clone() const = 0;
31 
37  static std::shared_ptr<IdFactory> makeSimple();
38 
49  static std::shared_ptr<IdFactory> makeSource(RecordId expId, int reserved);
50 
51  virtual ~IdFactory() {}
52 
53 private:
54  // Protected to prevent slicing.
55  void operator=(IdFactory const& other) {}
56 };
57 }
58 }
59 } // namespace lsst::afw::table
60 
61 #endif // !AFW_TABLE_IdFactory_h_INCLUDED
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:22
static std::shared_ptr< IdFactory > makeSource(RecordId expId, int reserved)
Return an IdFactory that includes another, fixed ID in the higher-order bits.
virtual RecordId operator()()=0
Return a new unique RecordId.
A base class for image defects.
Definition: cameraGeom.dox:3
static std::shared_ptr< IdFactory > makeSimple()
Return a simple IdFactory that simply counts from 1.
A polymorphic functor base class for generating record IDs for a table.
Definition: IdFactory.h:21
virtual void notify(RecordId id)=0
Notify the IdFactory that the given ID has been used and must not be returned by operator().
virtual std::shared_ptr< IdFactory > clone() const =0
Deep-copy the IdFactory.