VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSampleAggregator.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvUtil/vrvUtil.h>
13 
14 #include <string>
15 #include <fstream>
16 
17 namespace makVrv
18 {
25  {
26  public:
29  static std::size_t calculateNumberOfSamples(float estimatedFrequency, float estimatedRunTimeSeconds);
30 
34  DtSampleAggregator(std::size_t numOfSamples, std::size_t numOfFields, const std::string& fileName, bool rowNumInOutput=true);
35 
38 
40  std::size_t numSamples() const;
41 
42  std::size_t currentSample() const;
43 
45  std::size_t numFields() const;
46 
48  void addSample(std::size_t field, double sample);
49 
51  void incrementSample();
52 
54  void reset();
55 
57  double* samples(std::size_t field);
58 
61  bool dumped(void) const;
62 
64  void dump();
65 
66 
67  void addToDumpFile(const std::string& str);
68 
71  bool valid() const;
72 
73  private:
74  // Unimplemented default CTOR
76 
77  protected:
78  std::string myFileName;
79 
80  const std::size_t myNumSamples;
81  const std::size_t myNumFields;
82  std::size_t myCurrentSample;
83  double** myData; // This is an array of pointers to doubles - each points to the start of an array of doubles of size numSamples
84 
85  bool isValid;
86  std::ofstream myDumpFile;
87  bool myDumped;
89  };
90 }
91 
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
bool myRowNumInOutput
Definition: DtSampleAggregator.h:88
std::ofstream myDumpFile
Definition: DtSampleAggregator.h:86
The DtSampleAggregator allows users to collect up to a fixed number of rows of N columns of doubles...
Definition: DtSampleAggregator.h:24
double ** myData
Definition: DtSampleAggregator.h:83
std::string myFileName
Definition: DtSampleAggregator.h:78
Contains DLL export macros.
bool isValid
Definition: DtSampleAggregator.h:85
std::size_t myCurrentSample
Definition: DtSampleAggregator.h:82
const std::size_t myNumSamples
Definition: DtSampleAggregator.h:80
bool myDumped
Definition: DtSampleAggregator.h:87
const std::size_t myNumFields
Definition: DtSampleAggregator.h:81

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)