Luiza  v03-01
GloriaDataContainer.h
1 // -*- mode: c++; mode: auto-fill; mode: flyspell-prog; -*-
2 
3 
4 #ifndef GloriaDataContainer_h
5 #define GloriaDataContainer_h 1
6 
7 
8 /*
9  * This source code is part of the LUIZA software package for GLORIA.
10  * You are free to use this source files for your own development as
11  * long as it stays in a public research context. You are not
12  * allowed to use it for commercial purpose. You must put this
13  * header with author names in all development based on this file.
14  *
15  */
16 
17 #include "GloriaFitsImage.h"
18 #include "GloriaFitsTable.h"
19 
21 
29 namespace gloria{
30 
31  typedef std::vector< GloriaFitsImage > ImageVec;
32 
33  typedef std::vector< GloriaFitsTable > TableVec;
34 
36 
46  { UndefinedCollection = 0,
47  ImageCollection,
48  TableCollection };
49 
50 
51  static const char* GloriaCollectionTypeName[] = { "Undefined", "Image", "Table" };
52 
53 
55 
83 
84 
85  public:
86 
88 
91 
94 
96  inline int GetImageCollectionNumber() { return _nImageCollections;} ;
97 
99  inline int GetTableCollectionNumber() { return _nTableCollections;} ;
100 
102  inline std::string& GetImageCollectionName(int icl) { return _imageCollectionNames.at(icl);} ;
103 
105  inline std::string& GetTableCollectionName(int icl) { return _tableCollectionNames.at(icl);} ;
106 
108  ImageVec& CreateImageCollection(std::string name, bool isPermanent = false );
109 
111  bool ImageCollectionExists(std::string name);
112 
114  bool ImageCollectionPermanent(std::string name);
115 
117  void SetImageCollectionPermanent(std::string name, bool isPermanent = true );
118 
120  ImageVec& GetImageCollection(std::string name);
121 
123  void RemoveImageCollection(std::string name);
124 
126  TableVec& CreateTableCollection(std::string name, bool isPermanent = false );
127 
129  bool TableCollectionExists(std::string name);
130 
132  bool TableCollectionPermanent(std::string name);
133 
135  void SetTableCollectionPermanent(std::string name, bool isPermanent = true );
136 
138  TableVec& GetTableCollection(std::string name);
139 
141  void RemoveTableCollection(std::string name);
142 
145 
148 
150  GloriaCollectionType GetCollectionType(std::string name);
151 
153  std::string GetCollectionTypeName(std::string name);
154 
155 private:
156 
157  std::map< std::string, ImageVec > _imageCollectionMap;
158 
159  std::map< std::string, TableVec > _tableCollectionMap;
160 
161  std::vector< std::string > _imageCollectionNames;
162 
163  std::vector< std::string > _tableCollectionNames;
164 
165  std::map< std::string, bool > _imageCollectionPermanent;
166 
167  std::map< std::string, bool > _tableCollectionPermanent;
168 
169  int _nImageCollections;
170 
171  int _nTableCollections;
172 
173  };
174 
175 
176 }
177 
178 #endif
179 
180 
181 
std::string & GetImageCollectionName(int icl)
Return image collection name.
Definition: GloriaDataContainer.h:102
bool TableCollectionPermanent(std::string name)
Check if table collection is permanent.
Definition: GloriaDataContainer.cc:152
void SetImageCollectionPermanent(std::string name, bool isPermanent=true)
Flag table collection as permanent.
Definition: GloriaDataContainer.cc:53
std::string & GetTableCollectionName(int icl)
Return table collection name.
Definition: GloriaDataContainer.h:105
~GloriaDataContainer()
Destructor.
Definition: GloriaDataContainer.cc:36
GloriaCollectionType GetCollectionType(std::string name)
Return type of given collection.
Definition: GloriaDataContainer.cc:321
namespace for data storing and exchange formats
Definition: GloriaAstrometry.h:15
ImageVec & CreateImageCollection(std::string name, bool isPermanent=false)
Create new (empty) image collection.
Definition: GloriaDataContainer.cc:63
Class for storing all data processed in Luiza.
Definition: GloriaDataContainer.h:82
bool TableCollectionExists(std::string name)
Check if table collection exists.
Definition: GloriaDataContainer.cc:147
void RemoveTemporaryCollections()
Remove all collections not declared as permanent.
Definition: GloriaDataContainer.cc:257
ImageVec & GetImageCollection(std::string name)
Get stored image collection.
Definition: GloriaDataContainer.cc:100
void SetTableCollectionPermanent(std::string name, bool isPermanent=true)
Flag table collection as permanent.
Definition: GloriaDataContainer.cc:160
GloriaDataContainer()
Default constructor.
Definition: GloriaDataContainer.cc:27
void RemoveTableCollection(std::string name)
Remove stored table collection.
Definition: GloriaDataContainer.cc:228
bool ImageCollectionPermanent(std::string name)
Check if image collection is permanent.
Definition: GloriaDataContainer.cc:45
TableVec & GetTableCollection(std::string name)
Get stored table collection.
Definition: GloriaDataContainer.cc:207
int GetTableCollectionNumber()
Number of table collections.
Definition: GloriaDataContainer.h:99
bool ImageCollectionExists(std::string name)
Check if image collection exists.
Definition: GloriaDataContainer.cc:40
int GetImageCollectionNumber()
Number of image collections.
Definition: GloriaDataContainer.h:96
GloriaCollectionType
Enumerator for allowed collection types.
Definition: GloriaDataContainer.h:45
TableVec & CreateTableCollection(std::string name, bool isPermanent=false)
Create new (empty) table collection.
Definition: GloriaDataContainer.cc:170
void ClearTemporaryCollections()
Clear all collections not declared as permanent.
Definition: GloriaDataContainer.cc:295
void RemoveImageCollection(std::string name)
Remove stored image collection.
Definition: GloriaDataContainer.cc:121
std::string GetCollectionTypeName(std::string name)
Return string describing type of given collection.
Definition: GloriaDataContainer.cc:333