Variable.h 1.46 KB
Newer Older
1
/*
2
3
4
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
5
 * Variable.h : template class for self-describing primitive variables
6
7
 *
 *  Created on: Oct 6, 2016
8
 *      Author: William F Godoy
9
10
 */

11
12
#ifndef ADIOS2_CORE_VARIABLE_H_
#define ADIOS2_CORE_VARIABLE_H_
13
14

/// \cond EXCLUDE_FROM_DOXYGEN
wfg's avatar
wfg committed
15
16
#include <map>
#include <ostream> //std::ostream in MonitorGroups
17
18
#include <string>
#include <vector>
19
20
/// \endcond

William F Godoy's avatar
William F Godoy committed
21
#include "adios2/ADIOSTypes.h"
22
#include "adios2/core/VariableBase.h"
23

wgodoy's avatar
wgodoy committed
24
namespace adios2
25
{
26

27
/**
28
 * @param Base (parent) class for template derived (child) class Variable.
29
 */
30
31
template <class T>
class Variable : public VariableBase
32
{
wfg's avatar
wfg committed
33

34
public:
William F Godoy's avatar
William F Godoy committed
35
36
37
38
    typename TypeInfo<T>::ValueType m_Min;
    typename TypeInfo<T>::ValueType m_Max;
    typename TypeInfo<T>::ValueType m_Value;

39
    Variable<T>(const std::string &name, const Dims &shape, const Dims &start,
40
                const Dims &count, const bool constantShape, T *data,
41
                const bool debugMode);
42

43
    ~Variable<T>() = default;
44

45
    /** Gets current data pointer for this Variable object */
46
47
    T *GetData() const noexcept;

48
    /** Sets current data pointer for this Variable object */
49
50
51
52
53
54
    void SetData(const T *) noexcept;

private:
    /** TODO: used for allocating memory from ADIOS2 */
    std::vector<T> m_AllocatedData;

William F Godoy's avatar
William F Godoy committed
55
    /** reference to data */
56
    T *m_Data = nullptr;
57
58
};

59
} // end namespace adios2
60

61
#endif /* ADIOS2_CORE_VARIABLE_H_ */