#include "NewDayDetector.h" void NewDay::onWakeup(int msgId) { if (!_tosData->getValid()) _lastState = lsUnknown; else if (_tosData->getLast().high == 0) _lastState = lsPreMarket; else { //if (_lastState == lsPreMarket) // Ideally we would not send out a message when we transition from // invalid to valid. But that's causing some problems with the DTN // proxy. In some cases the DTN proxy is not transitioning from invalid // to valid as soon as we'd like. Since none of the proxies do a good // job of reporting invalid when they should, it seems that the best // policy is to ignore it all together. if (_lastState != lsNotPreMarket) notifyListeners(); _lastState = lsNotPreMarket; } } NewDay::NewDay(DataNodeArgument const &args) : _lastState(lsUnknown) { addAutoLink(GenericTosDataNode::find(this, 0, _tosData, args.getStringValue())); onWakeup(0); } DataNodeLink *NewDay::find(DataNodeListener *listener, int msgId, NewDay *&node, std::string const &symbol) { return findHelper(listener, msgId, node, symbol); } DataNodeLink *NewDay::find(DataNodeListener *listener, int msgId, std::string const &symbol) { NewDay *unused; return find(listener, msgId, unused, symbol); }