• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

include/FCam/F2/EF232LensDatabase.h

00001 #ifndef EF232LENSDATABASE_H
00002 #define EF232LENSDATABASE_H
00003 
00004 #include <set>
00005 #include <map>
00006 #include <string>
00007 #include <iostream>
00008 
00009 #define DEFAULT_DATABASE_FILE "EF232LensDatabase.txt"
00010 
00011 namespace FCam {
00012 
00013     // All lengths are in mm, apertures are in f-number*10
00014     struct EF232LensInfo {
00015         std::string name;
00016         unsigned int focalLengthMin;
00017         unsigned int focalLengthMax;
00018 
00019         unsigned int focusDistMin;
00020         unsigned int apertureMax;
00021 
00022         float focusSpeed;  // diopters/sec
00023 
00024         bool hasImageStabilization;
00025         bool hasFullTimeManual;
00026 
00027         typedef std::pair<unsigned int, unsigned int> apertureChange;
00028         typedef std::map<unsigned int, unsigned int>::iterator minApertureListIter;
00029         typedef std::map<unsigned int, unsigned int>::const_iterator minApertureListCIter;
00030         // Aperture minimum f-stop assumed to be a piecewise-constant function of
00031         // focal length
00032         std::map<unsigned int, unsigned int> minApertureList;
00033 
00034         unsigned int minApertureAt(unsigned int focusDistance) const;
00035         bool operator<(const EF232LensInfo &rhs) const;
00036 
00037         void print(std::ostream &out) const;
00038 
00039         EF232LensInfo();
00040     };
00041 
00042     class EF232LensDatabase {
00043     public:
00044         EF232LensDatabase(const std::string &srcFile=DEFAULT_DATABASE_FILE);
00045 
00046         const EF232LensInfo* find(unsigned int focalLengthMin, 
00047                                   unsigned int focalLengthMax);
00048 
00049         const EF232LensInfo* find(const EF232LensInfo &key);
00050 
00051         const EF232LensInfo* update(const EF232LensInfo &lensInfo);
00052 
00053         void save(const std::string &dstFile=DEFAULT_DATABASE_FILE) const;
00054     private:
00055     
00056         void load(const std::string &srcFile);
00057     
00058         static std::set<EF232LensInfo> *db;
00059     };
00060 
00061 
00062 
00063 }
00064 
00065 #endif

Generated on Fri Sep 24 2010 15:52:59 for FCam by  doxygen 1.7.1