NetCDF4 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NcFileReg.h
Go to the documentation of this file.
1 
14 #ifndef INC_netcdf_NcFileReg_h
15 #define INC_netcdf_NcFileReg_h
16 
17 #include "NcFile.h"
18 #include "Singleton.h"
19 #include <utility>
20 #include <map>
21 
22 namespace netcdf {
23 
24 
25 class NcFileReg
26 {
27  public:
28 
29  typedef int NcID;
30  typedef NcFile* const NcFilePtr;
31  typedef std::pair< NcID, NcFilePtr > RegPair;
32  typedef std::map< NcID, NcFilePtr > RegMap;
33  typedef RegMap::size_type size_type;
34  typedef RegMap::const_iterator const_iterator;
35 
36 
37  void Add ( NcFile const & ncFile );
38  NcFile & Get ( NcID const ncID );
39  void Remove ( NcID const ncID );
40 
41  size_type Size () const { return registry.size(); }
42  bool Empty () const { return registry.empty(); }
43 
44  const_iterator Begin () const { return registry.begin(); }
45  const_iterator End () const { return registry.end(); }
46 
47  private:
48 
49  RegMap registry;
50 
51 };
52 
53 typedef TEH::GL::Singleton<NcFileReg> NcFileRegSingleton;
54 
55 #define NcFileRegistry netcdf::NcFileRegSingleton::Instance
56 
57 
58 } // namespace netcdf
59 
60 #endif // INC_netcdf_NcFileReg_h
RegMap::size_type size_type
Definition: NcFileReg.h:33
TEH::GL::Singleton< NcFileReg > NcFileRegSingleton
Definition: NcFileReg.h:53
RegMap::const_iterator const_iterator
Definition: NcFileReg.h:34
const_iterator Begin() const
Definition: NcFileReg.h:44
NcFile *const NcFilePtr
Definition: NcFileReg.h:30
int NcID
Definition: NcFileReg.h:29
void Add(NcFile const &ncFile)
Definition: NcFileReg.cpp:21
void Remove(NcID const ncID)
Definition: NcFileReg.cpp:47
std::map< NcID, NcFilePtr > RegMap
Definition: NcFileReg.h:32
bool Empty() const
Definition: NcFileReg.h:42
Manages the opening, creating, and closing of netCDF files. Represents the netCDF root group...
Definition: NcFile.h:31
size_type Size() const
Definition: NcFileReg.h:41
NcFile & Get(NcID const ncID)
Definition: NcFileReg.cpp:35
const_iterator End() const
Definition: NcFileReg.h:45
std::pair< NcID, NcFilePtr > RegPair
Definition: NcFileReg.h:31
Manages a registry of NcFile objects.
Definition: NcFileReg.h:25