VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
trueAggregateRollUpHelper.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include "vrfutil/vrfutilDefines.h"
14 #include <vrfutil/rwProperties.h>
16 
17 #include <boost/function.hpp>
18 
19 typedef boost::function<bool (const DtReaderWriter* source, DtReaderWriter* destination,
20  const DtMergePath& path, const std::map<std::string, std::string>& attributes)> DtRollUpFunction;
21 
25 {
26 public:
27  typedef std::map<std::string, DtRollUpFunction> RollUpRules;
28 
30  virtual ~DtTrueAggregateRollUpHelper();
31 
33  virtual void installCustomRules();
34 
37  virtual void addRollUpFunction(const std::string&, DtRollUpFunction);
38  const RollUpRules& rollUpRules() const
39  {
40  return myRollUpRules;
41  }
42 
43  RollUpRules& rollUpRules()
44  {
45  return myRollUpRules;
46  }
47 
48  virtual bool sumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
49  const std::map<std::string, std::string>&);
50  virtual bool minimumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
51  const std::map<std::string, std::string>&);
52  virtual bool maximumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
53  const std::map<std::string, std::string>&);
54  virtual bool averageFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
55  const std::map<std::string, std::string>&);
56  virtual bool moppLevelFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
57  const std::map<std::string, std::string>&);
58  virtual bool stringFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path);
59 
61 
63  virtual DtRwProperties rollUp(const std::vector<DtRwProperties>&, const std::set<DtString>& ignore = std::set<DtString>()) const;
64 
66  virtual void setRollUpRules(const DtAssembliesReaderWriter::RwRootNode&);
67 
69  virtual bool loadRollUpRules(const DtFilename&);
70 
71  virtual void updateAverages(DtRwProperties&, int totalContributors) const;
72 
75  virtual void restore();
76 
77 protected:
78 
80  virtual bool rollUpValues(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path);
81 
82  virtual double averageContributionFrom(const DtReaderWriter* item, const DtMergePath& path,
83  const std::map<std::string, std::string>& atr) const;
84 
85 protected:
89 
90  struct AverageItem
91  {
92  AverageItem() : total(0) {};
93  AverageItem(double t, const DtString& w) : total(t), weight(w) {};
94  AverageItem(const AverageItem& orig) : total(orig.total), weight(orig.weight) {};
95 
96  double total;
98  };
99 
100  typedef std::map<std::string, AverageItem> AverageItems;
101 
103  mutable std::set<DtString> myAverageTotals;
104 
106 };

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)