#ifndef __SymbolList_h_ #define __SymbolList_h_ #include #include "StockInfo.h" class SymbolList { private: std::map< std::string, StockInfo > _symbols; time_t _oldestPossible; int _hashCount; // Split the symbols into this many distinct partitions. int _hashFirst; // The first partition to use. Should be at least 0 and less than _hashCount. int _hashLast; // The last partition to use. Should be at least _hashFirst and less than _hashCount. public: SymbolList(); // Add a new record. Or merge into the existing record. void add(StockInfo const &toAdd); // This is used for a backup data source. For example, we prefer the info // from the data feed. We also check the database, to make sure we didn't // miss anything. If it's in both places, we prefer the info from the data // feed. If it's missing from the data feed, we use the value from the // database, and report a message to the log. void addIfNew(StockInfo const &toAdd, std::string const &source); // Add a whole list. void add(StockInfoList const &toAdd); void addIfNew(StockInfoList const &toAdd, std::string const &source); // How many partitions. void setHashCount(int value); // Which partition or partitions to use. void setHashPartition(int value); void setHashPartitions(int first, int last); // This is the default. void disableHashing(); typedef std::vector< std::string > Result; Result getValues() const; Result getValues(int maxCount) const; }; #endif