AttributeDescription.hpp
1 #ifndef OPALS_ATTRIBUTE_DESCRIPTION_HPP_INCLUDED
2 #define OPALS_ATTRIBUTE_DESCRIPTION_HPP_INCLUDED
3 
4 #pragma once
5 
6 #include "opals/config.hpp"
7 #include "opals/String.hpp"
8 
9 namespace opals
10 {
11  /// \brief AttributeDescription provides generic information about a single attribute (used by DataSetStats).
12  ///
13  /// Beside the name, type, storage size (in bytes) and a nodata indicator of the attribute the
14  /// class provides basic statistic information such as min, max, mean and the standard deviation.
15  /// If a specific information is really set, can be retrieved by the corresponding isSet function.
16  /// Depending on the data type a specific no data value is used to indicate unset values.
17  ///
18  /// \author JO
19  /// \date 24.05.2012
20  class OPALS_API AttributeDescription
21  {
22  public:
24  virtual ~AttributeDescription();
25 
26  bool isSetName() const;
27  bool isSetType() const;
28  bool isSetStorageSize() const;
29  bool isSetCount() const;
30  bool isSetMin() const;
31  bool isSetMax() const;
32  bool isSetMean() const;
33  bool isSetStd() const;
34  bool isSetNoDataIndicator() const;
35 
36  String getName() const; ///< get attribute name
37  String getType() const; ///< get attribute type
38  unsigned getStorageSize() const; ///< storage size of attribute in bytes
39  long long getCount() const; ///< number of elements
40  double getMin() const; ///< minimum attribute value
41  double getMax() const; ///< maximum attribute value
42  double getMean() const; ///< mean attribute value
43  double getStd() const; ///< standard deviation
44  double getNoDataIndicator() const; ///< no value indicator
45 
46  void reset();
47  void setAttributeDescription(const String& Name,const String& Type,const unsigned& StorageSize,const long long& Count,
48  const double& Min,const double& Max,const double& Mean,const double& Std, const double& NoData);
49  void setName(const String& Name);
50  void setType(const String& Type);
51  void setStorageSize(const unsigned& StorageSize);
52  void setCount(const long long& Count);
53  void setMin(const double& Min);
54  void setMax(const double& Max);
55  void setMean(const double& Mean);
56  void setStd(const double& Std);
57  void setNoDataIndicator(const double& NoData);
58 
59  // output functions
60  String logAttributeDescription() const; ///< for xml output
61  String printAttributeDescription() const; ///< for log output (in more readable format)
62  static String printAttributeHeader(); ///< for log the header line
63 
64  private:
65  String name;
66  String type;
67  unsigned storageSize;
68  long long count;
69  double min;
70  double max;
71  double mean;
72  double std;
73  double nodataIndicator;
74  };
75 }
76 
77 
78 
79 #endif //OPALS_ATTRIBUTE_DESCRIPTION_HPP_INCLUDED