-
Notifications
You must be signed in to change notification settings - Fork 0
/
CartesianDataBlockIODescriptorIterator.h
63 lines (51 loc) · 1.63 KB
/
CartesianDataBlockIODescriptorIterator.h
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
/*
____ _ __ ____ __ ____
/ __/___(_) / ___ ____/ __ \__ _____ ___ / /_ / _/__ ____
_\ \/ __/ / _ \/ -_) __/ /_/ / // / -_|_-</ __/ _/ // _ \/ __/
/___/\__/_/_.__/\__/_/ \___\_\_,_/\__/___/\__/ /___/_//_/\__(_)
Copyright 2012 SciberQuest Inc.
*/
#ifndef __CartesianDataBlockIODescriptorIterator_h
#define __CartesianDataBlockIODescriptorIterator_h
#include "CartesianDataBlockIODescriptor.h"
/// Iterator for CartesianDataBlockIODescriptor views
class CartesianDataBlockIODescriptorIterator
{
public:
CartesianDataBlockIODescriptorIterator(const CartesianDataBlockIODescriptor *desc)
:
Descriptor(desc),
At(0),
Of(desc->Size())
{}
/**
Perpare for traversal.
*/
void Initialize(){ this->At=0; }
/**
Advance to next view pair.
*/
void Next(){ ++this->At; }
/**
Evaluates true during traversal.
*/
int Ok() const { return this->At<this->Of; }
/**
Access to the views.
*/
MPI_Datatype GetMemView() const { return this->Descriptor->MemViews[this->At]; }
MPI_Datatype GetFileView() const { return this->Descriptor->FileViews[this->At]; }
private:
/// \Section NotImplemented \@{
CartesianDataBlockIODescriptorIterator();
CartesianDataBlockIODescriptorIterator(const CartesianDataBlockIODescriptorIterator &);
void operator=(const CartesianDataBlockIODescriptorIterator &);
/// \@}
friend ostream &operator<<(ostream &os, const CartesianDataBlockIODescriptorIterator &it);
private:
const CartesianDataBlockIODescriptor *Descriptor;
int At;
int Of;
};
ostream &operator<<(ostream &os, const CartesianDataBlockIODescriptorIterator &it);
#endif