#ifndef _fwk_SStationListManager_h_ #define _fwk_SStationListManager_h_ #include #include #include #include #include #include #include #include #include #include namespace sdet { using ::boost::multi_index_container; using ::boost::multi_index::index; using namespace ::boost::multi_index; /** \class SStationListManager SStationListManager.h "sdet/SStationListManager.h" \brief Common implementation of the station list manager This class is used by both, SStationListXMLManager and SStationListSQLManager. \author Darko Veberic \date 03 Nov 2008 \version $Id: SStationListManager.h 18232 2011-01-03 17:15:35Z dembinski $ \ingroup managers */ class SStationListManager { public: struct StationData { int fId; double fNorthing; double fEasting; double fAltitude; std::string fName; std::string fCommissionTime; std::string fDecommissionTime; std::vector fInGrid; int fGroupId; double fAxis1; double fAxis2; std::string fEllipsoid; int fZone; std::string fBand; private: utl::TimeRange fCommissionTimeRange; friend class SStationListManager; }; /** This will be specialized for "int", "double", "string", "vector", "vector >", and vector. The following queries are implemented: type and valid component properties: int: groupId, zone double: northing, easting, altitude, axis1, axis2 string: name, commission, decommission, band, ellipsoid vector: fullStationList, groupIds, group (groupId=?), stationGroup (stationId=?), crown vector >: fullStationGroups vector: inGrid */ template det::VManager::Status GetData(T& returnData, const std::string& componentProperty, const det::VManager::IndexMap& componentIndex) const; /// adds station record only if it does not already exist bool ConditionalAddStationData(StationData& station); bool HasStationData(const int id) const; bool DumpXML(std::ostream& output, const std::string& indent = "") const; private: static int GetStationId(const det::VManager::IndexMap& componentIndex) { return det::VManager::FindComponent("stationId", componentIndex); } void GetFullStationList(std::vector& returnList) const; void GetFullStationGroups(std::vector >& returnList) const; det::VManager::Status GetGroupIds(std::vector& returnData) const; det::VManager::Status GetGroup(std::vector& returnData, const int groupId) const; det::VManager::Status GetStationGroup(std::vector& returnData, const int id) const; det::VManager::Status GetStationCrown(std::vector& crown, const int id, const int nCrown, SDetectorConstants::GridIndex index = SDetectorConstants::eStandard) const; // index tags struct ByStationId { }; struct ByGroupId { }; struct ByAxes { }; typedef multi_index_container< StationData, indexed_by< ordered_unique< tag, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId) >, ordered_non_unique< tag, BOOST_MULTI_INDEX_MEMBER(StationData, int, fGroupId) >, ordered_non_unique< tag, composite_key< StationData, BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis1), BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis2) > > > > StationContainer; typedef index::type StationIdIndex; typedef index::type GroupIdIndex; typedef index::type AxesIndex; mutable StationContainer fStations; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // End: