SST  6.0.0
StructuralSimulationToolkit
statoutputcsvgz.h
1 // Copyright 2009-2016 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2016, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef _H_SST_CORE_STATISTICS_OUTPUT_CSV_GZ
13 #define _H_SST_CORE_STATISTICS_OUTPUT_CSV_GZ
14 
15 #include "sst/core/sst_types.h"
16 
17 #include <sst/core/statapi/statoutput.h>
18 
19 #include <zlib.h>
20 
21 #ifdef HAVE_LIBZ
22 
23 namespace SST {
24 namespace Statistics {
25 
26 /**
27  \class StatisticOutputCompressedCSV
28 
29  The class for statistics output to a comma separated file with compression.
30 */
31 class StatisticOutputCompressedCSV : public StatisticOutput
32 {
33 public:
34  /** Construct a StatisticOutputCompressedCSV
35  * @param outputParameters - Parameters used for this Statistic Output
36  */
37  StatisticOutputCompressedCSV(Params& outputParameters);
38 
39 protected:
40  /** Perform a check of provided parameters
41  * @return True if all required parameters and options are acceptable
42  */
43  bool checkOutputParameters();
44 
45  /** Print out usage for this Statistic Output */
46  void printUsage();
47 
48  /** Indicate to Statistic Output that simulation started.
49  * Statistic output may perform any startup code here as necessary.
50  */
51  void startOfSimulation();
52 
53  /** Indicate to Statistic Output that simulation ended.
54  * Statistic output may perform any shutdown code here as necessary.
55  */
56  void endOfSimulation();
57 
58  /** Implementation function for the start of output.
59  * This will be called by the Statistic Processing Engine to indicate that
60  * a Statistic is about to send data to the Statistic Output for processing.
61  * @param statistic - Pointer to the statistic object than the output can
62  * retrieve data from.
63  */
64  void implStartOutputEntries(StatisticBase* statistic);
65 
66  /** Implementation function for the end of output.
67  * This will be called by the Statistic Processing Engine to indicate that
68  * a Statistic is finished sendind data to the Statistic Output for processing.
69  * The Statisic Output can perform any output related functions here.
70  */
71  void implStopOutputEntries();
72 
73  /** Implementation functions for output.
74  * These will be called by the statistic to provide Statistic defined
75  * data to be output.
76  * @param fieldHandle - The handle to the registered statistic field.
77  * @param data - The data related to the registered field to be output.
78  */
79  void implOutputField(fieldHandle_t fieldHandle, int32_t data);
80  void implOutputField(fieldHandle_t fieldHandle, uint32_t data);
81  void implOutputField(fieldHandle_t fieldHandle, int64_t data);
82  void implOutputField(fieldHandle_t fieldHandle, uint64_t data);
83  void implOutputField(fieldHandle_t fieldHandle, float data);
84  void implOutputField(fieldHandle_t fieldHandle, double data);
85 
86 protected:
87  StatisticOutputCompressedCSV() {;} // For serialization
88 
89 private:
90  gzFile m_hFile;
91  std::vector<std::string> m_OutputBufferArray;
92  std::string m_Separator;
93  std::string m_FilePath;
94  std::string m_currentComponentName;
95  std::string m_currentStatisticName;
96  std::string m_currentStatisticSubId;
97  std::string m_currentStatisticType;
98  bool m_outputTopHeader;
99  bool m_outputSimTime;
100  bool m_outputRank;
101 
102 };
103 
104 } //namespace Statistics
105 } //namespace SST
106 
107 #endif
108 #endif
Definition: action.cc:17