#ifndef __VolumeWeightedDataNodes_h_ #define __VolumeWeightedDataNodes_h_ #include "../misc_framework/DataNodes.h" #include "GenericTosData.h" #include "VolumeWeightedData.h" /* Currently these only accumulate blocks. They never discard blocks. * GetBlocks returns a list which is identical to the previous call, or it * contains all the previous data plus one or more new blocks on the right * hand side. * * Potentially one of these data nodes should have the ability to reset * themselves when better data is available. Although this may never happen, * we still have a contract for that, because if it ever happened, it could * effect a lot of code. * * The rule is that this data node can only do one of two things. It can * present an empty list, or it can present a list which is identical to the * previous list, with something optionally added to the right hand side. * * If one of these had 10 items, then it decided to reset itself, and the new * version has only 5 items, it must do this in two steps. First it signals * all listeners, and presents the empty list. Then it presents the new list * with 5 members. * * Changing existing data, although now allowed, is still very disruptive, and * should be avoided. */ class VolumeWeightedDataNode : public DataNode { private: VolumeBlockFactory _volumeBlockFactory; GenericTosDataNode *_tosData; void onWakeup(int msgId); static bool getHistoryValid(); VolumeWeightedDataNode(DataNodeArgument const &args); friend class DataNode; public: VolumeBlocks const &getBlocks() const { return _volumeBlockFactory.getBlocks(); } VolumeBlocks::size_type getBlockCount() const { return _volumeBlockFactory.getBlockCount(); } DataNode::Integer getGroupBy() const { return _volumeBlockFactory.getGroupBy(); } static DataNodeLink *find(DataNodeListener *listener, int msgId, VolumeWeightedDataNode *&node, std::string const &symbol, Integer groupBy); }; #endif