SST  6.1.0
StructuralSimulationToolkit
statoutputtxtgz.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_TXT_GZ
13 #define _H_SST_CORE_STATISTICS_OUTPUT_TXT_GZ
14 
15 #include "sst/core/sst_types.h"
16 
17 #include <sst/core/statapi/statoutput.h>
18 
19 #ifdef HAVE_LIBZ
20 
21 #include <zlib.h>
22 
23 namespace SST {
24 namespace Statistics {
25 
26 /**
27  \class StatisticOutputCompressedTxt
28 
29  The class for statistics output to a text file.
30 */
31 class StatisticOutputCompressedTxt : public StatisticOutput
32 {
33 public:
34  /** Construct a StatOutputTxt
35  * @param outputParameters - Parameters used for this Statistic Output
36  */
37  StatisticOutputCompressedTxt(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  StatisticOutputCompressedTxt() {;} // For serialization
88 
89 private:
90  gzFile m_hFile;
91  std::string m_outputBuffer;
92  std::string m_FilePath;
93  bool m_outputTopHeader;
94  bool m_outputInlineHeader;
95  bool m_outputSimTime;
96  bool m_outputRank;
97 
98 };
99 
100 } //namespace Statistics
101 } //namespace SST
102 
103 #endif
104 #endif
Definition: action.cc:17