Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* VariableCompound.h
*
* Created on: Feb 20, 2017
* Author: wfg
*/
#ifndef VARIABLECOMPOUND_H_
#define VARIABLECOMPOUND_H_
#include "core/VariableBase.h"
namespace adios
{
struct CompoundElement
{
const std::string m_Name;
const std::size_t m_Offset;
const std::string m_Type;
};
/**
* @param Base (parent) class for template derived (child) class CVariable. Required to put CVariable objects in STL containers.
*/
class VariableCompound : public VariableBase
{
public:
const void* m_AppValue = nullptr;
VariableCompound( const std::string name, const std::size_t sizeOfStruct, const Dims dimensions,
const Dims globalDimensions, const Dims globalOffsets, const bool debugMode ):
VariableBase( name, "compound", sizeOfStruct, dimensions, globalDimensions, globalOffsets, debugMode )
{ }
template< class U >
void InsertMember( const std::string name, const std::size_t offset )
{
m_Elements.push_back( CompoundElement{ name, offset, GetType<U>() } );
}
void Monitor( std::ostream& logInfo ) const noexcept
{
logInfo << "Variable Compound: " << m_Name << "\n";
logInfo << "Type: " << m_Type << "\n";
logInfo << "Size: " << TotalSize() << " elements\n";
logInfo << "Payload: " << PayLoadSize() << " bytes\n";
}
private:
std::vector<CompoundElement> m_Elements; ///< vector of element types
};
} //end namespace
#endif /* VARIABLECOMPOUND_H_ */