Go to the documentation of this file.00001
00002 #ifndef OTAGO__image_database_INCLUDED_
00003 #define OTAGO__image_database_INCLUDED_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <vcl_sys/types.h>
00026 #include <vcl_cstring.h>
00027 #include <vcl_map.h>
00028 #include <vcl_utility.h>
00029 #include <vil1/vil1_memory_image.h>
00030
00031 class ImageDatabase
00032 {
00033
00034 public:
00035 struct ltstr
00036 {
00037 bool operator()(const char* s1, const char* s2) const;
00038 };
00039
00040 private:
00041
00042 vcl_multimap<const char*, vil1_memory_image *, ltstr> image_db;
00043
00044 public:
00045
00046 typedef vcl_multimap<const char*, vil1_memory_image *, ltstr>::iterator iterator;
00047 typedef vcl_multimap<const char*, vil1_memory_image *, ltstr>::const_iterator const_iterator;
00048 typedef vcl_pair<const char *, vil1_memory_image *> value_type;
00049
00050 ImageDatabase(){}
00051 ~ImageDatabase();
00052 inline iterator insert(const char *label, vil1_memory_image *image)
00053 {char *new_label=new char[200]; vcl_strcpy(new_label, label);
00054 value_type ins(new_label, image); return image_db.insert(ins);}
00055 inline iterator begin(){return image_db.begin();}
00056 inline iterator end(){return image_db.end();}
00057 inline const_iterator begin() const {return image_db.begin();}
00058 inline const_iterator end() const {return image_db.end();}
00059 inline vcl_pair<iterator, iterator> equal_range(const char *&label)
00060 {return image_db.equal_range(label);}
00061 inline vcl_pair<const_iterator, const_iterator> equal_range(const char *&label)
00062 const {return image_db.equal_range(label);}
00063 inline bool label_exists(const char *label) const
00064 {return image_db.count(label)>0;}
00065 void clear();
00066
00067 bool save(const char *name, const char *imagetype);
00068 bool load(const char *name);
00069 };
00070
00071 #endif // OTAGO__image_database_INCLUDED_