VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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"
16 
17 #include <boost/function.hpp>
18 #include <mutex>
19 
20 typedef boost::function<bool(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
21  const std::map<std::string, std::string>& attributes)>
23 
28 {
29 public:
30  typedef std::map<std::string, DtRollUpFunction> RollUpRules;
31 
33  virtual ~DtTrueAggregateRollUpHelper();
34 
36  virtual void installCustomRules();
37 
40  virtual void addRollUpFunction(const std::string&, DtRollUpFunction);
41  const RollUpRules& rollUpRules() const { return myRollUpRules; }
42 
43  RollUpRules& rollUpRules() { return myRollUpRules; }
44 
45  virtual bool sumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
46  const std::map<std::string, std::string>&);
47  virtual bool minimumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
48  const std::map<std::string, std::string>&);
49  virtual bool maximumFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
50  const std::map<std::string, std::string>&);
51  virtual bool averageFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
52  const std::map<std::string, std::string>&);
53  virtual bool moppLevelFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path,
54  const std::map<std::string, std::string>&);
55  virtual bool stringFunction(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path);
56 
58 
60  virtual void rollUp(const std::vector<const DtRwProperties*>&, DtRwProperties& result,
61  const std::set<DtString>& ignore = std::set<DtString>()) const;
62 
64  virtual void setRollUpRules(const DtAssembliesReaderWriter::RwRootNode&);
65 
67  virtual bool loadRollUpRules(const DtFilename&);
68 
69  virtual void updateAverages(DtRwProperties&, int totalContributors) const;
70 
73  virtual void restore();
74 
76  virtual bool rollUpValues(const DtReaderWriter* source, DtReaderWriter* destination, const DtMergePath& path);
77 
78  virtual double averageContributionFrom(
79  const DtReaderWriter* item, const DtMergePath& path, const std::map<std::string, std::string>& atr) const;
80 
81 
82 protected:
86 
87 private:
88  static std::recursive_mutex theRollUpRuleMutex;
89  std::unique_lock<std::recursive_mutex> myRollUpRuleLock;
90  bool myRestored;
91 
92 protected:
93 
94  struct AverageItem
95  {
97  : total(0) {};
98  AverageItem(double t, const DtString& w)
99  : total(t)
100  , weight(w) {};
102  : total(orig.total)
103  , weight(orig.weight) {};
104 
105  double total;
107  };
108 
109  typedef std::map<std::string, AverageItem> AverageItems;
110 
112  mutable std::set<DtString> myAverageTotals;
113 
115 };
DtAssembliesReaderWriter myAssemblyReaderWriter
Definition: trueAggregateRollUpHelper.h:114
std::unique_lock< std::recursive_mutex > myRollUpRuleLock
Definition: trueAggregateRollUpHelper.h:89
const RollUpRules & rollUpRules() const
Roll up rule functions.
Definition: trueAggregateRollUpHelper.h:41
Definition: trueAggregateRollUpHelper.h:94
boost::function< bool(const DtReaderWriter *source, DtReaderWriter *destination, const DtMergePath &path)> DtPropertyRollUpFunction
Definition: readerWriterFactory.h:184
RollUpRules & rollUpRules()
Roll up rule functions.
Definition: trueAggregateRollUpHelper.h:43
Definition: readerWriter.h:85
Definition: assembliesReaderWriter.h:31
This class contains helper-only functions and methods that can be used to roll up property data based...
Definition: trueAggregateRollUpHelper.h:27
DtPropertyRollUpFunction myOriginalDefaultRule
Definition: trueAggregateRollUpHelper.h:84
AverageItem(const AverageItem &orig)
Definition: trueAggregateRollUpHelper.h:101
std::set< DtString > myAverageTotals
Definition: trueAggregateRollUpHelper.h:112
RollUpRules myRollUpRules
Definition: trueAggregateRollUpHelper.h:83
DtString weight
Definition: trueAggregateRollUpHelper.h:106
static std::recursive_mutex theRollUpRuleMutex
Definition: trueAggregateRollUpHelper.h:88
bool myRestored
Definition: trueAggregateRollUpHelper.h:90
std::vector< DtMergePathStruct > DtMergePath
Definition: readerWriterFactory.h:181
const char * source
Definition: lz4.h:442
AverageItem()
Definition: trueAggregateRollUpHelper.h:96
std::map< DtString, DtPropertyRollUpFunction > RollUpRules
Definition: readerWriterFactory.h:190
AverageItems myAverageItems
Definition: trueAggregateRollUpHelper.h:111
std::map< std::string, DtRollUpFunction > RollUpRules
Definition: trueAggregateRollUpHelper.h:30
boost::function< bool(const DtReaderWriter *source, DtReaderWriter *destination, const DtMergePath &path, const std::map< std::string, std::string > &attributes)> DtRollUpFunction
Contains makVrf::DtGuiAggregateRollUpManager class.
Definition: guiAggregateRollUpManager.h:23
AverageItem(double t, const DtString &w)
Definition: trueAggregateRollUpHelper.h:98
std::map< std::string, AverageItem > AverageItems
Definition: trueAggregateRollUpHelper.h:109
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
This class will read ammunition, entity, weapons and assemblies and provide information about them...
Definition: assembliesReaderWriter.h:24
DtReaderWriterPropertyFactory::RollUpRules myOriginalRollUpRules
Definition: trueAggregateRollUpHelper.h:85

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)