/** \file Zone base class \author Tom Paul \version $Id$ \date 31 Jul 2004 */ #ifndef _atm_VZone_h_ #define _atm_VZone_h_ static const char CVSId_atm_VZone[] = "$Id$"; #include #include #include #include #include namespace atm { /** \class VZone \brief Base class for Aerosol, Molecula, Overall Quality and Lidar atmosphere zones Factors out northing, easting and some of the database keys. Provides common code for caching zone slice configurations. \author Tom Paul \version $Id$ \date 31 Jul 2004 \ingroup atm */ class VZone { public: /// Northing for the zone double GetNorthing() const { return fNorthing; } /// Easting for the zone double GetEasting() const { return fEasting; } /// Zone name const std::string& GetName() const { return fName; } protected: VZone(const std::string& zoneId, const std::string& fName, const double fNorthing, const double fEasting); virtual ~VZone() { } double fNorthing; double fEasting; std::string fName; std::string fZoneIdString; // Cache the slices in this zone (fills data on zone slice boundaries and // template void CacheSlices(std::vector*& sliceVector, // vector of zone slices to be filled in by this method const std::string& headerDBName, // eg. aerosol, molecular, lidar const std::string& sliceTableName, // eg. attenuation, phase_func, molecular, VAOD from lidar const std::string& zoneIdString, // id for the aerosol, molecular, lidar zone for which slices are wanted const det::VManager& manager) // specify which manager (or manager register) to use const { if (sliceVector) return; sliceVector = new std::vector; std::vector sliceIdStrings; det::VManager::IndexMap indexMap; std::string zoneIdColumn = headerDBName + "_zone_id"; indexMap[zoneIdColumn] = zoneIdString; std::string sliceTableNameId = sliceTableName + "_id"; const det::VManager::Status stat = manager.GetData(sliceIdStrings, sliceTableName, sliceTableNameId, indexMap); if (stat == det::VManager::eNotFound) { std::ostringstream err; err << "Did not find requested data, " "header table: " << headerDBName << ", " "slice table name: " << sliceTableName << ", " "zoneId: " << zoneIdString; ERROR(err); exit(EXIT_FAILURE); } for (std::vector::iterator it = sliceIdStrings.begin(); it != sliceIdStrings.end(); ++it) { det::VManager::IndexMap idMap; idMap[sliceTableNameId] = *it; std::string zoneSliceIdString; manager.GetData(zoneSliceIdString, sliceTableName, "zone_slices_id", idMap); det::VManager::IndexMap zsMap; zsMap["zone_slices_id"] = zoneSliceIdString; double minHeight; manager.GetData(minHeight,"zone_slices","min_height",zsMap); double maxHeight; manager.GetData(maxHeight,"zone_slices","max_height",zsMap); T* const slice = new T(headerDBName, zoneSliceIdString, zoneIdString, minHeight, maxHeight); sliceVector->push_back(slice); } } }; } // atm #endif // _atm_VZone_h_ // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: