bes
Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
Odometer.cc
1
// -*- mode: c++; c-basic-offset:4 -*-
2
3
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
4
// Access Protocol.
5
6
// Copyright (c) 2015 OPeNDAP, Inc.
7
// Author: James Gallagher <jgallagher@opendap.org>
8
//
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
13
//
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
18
//
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
//
23
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25
#include "config.h"
26
27
#include <vector>
28
29
#include <libdap/Error.h>
30
31
#include "Odometer.h"
32
33
using namespace
std;
34
using namespace
libdap
;
35
36
namespace
functions {
37
38
// documentation in the header file
39
unsigned
int
Odometer::next_safe()
40
{
41
if
(d_offset ==
end
())
throw
Error(
"Attempt to move beyond the end of an array in the indexing software."
);
42
43
// About 3.3 seconds for 10^9 elements
44
vector<unsigned int>::reverse_iterator si = d_shape.rbegin();
45
for
(vector<unsigned int>::reverse_iterator i = d_indices.rbegin(), e = d_indices.rend(); i != e; ++i, ++si) {
46
if
(++(*i) == *si) {
47
*i = 0;
48
}
49
else
{
50
break
;
51
}
52
}
53
54
return
++d_offset;
55
}
56
57
}
// namespace function
functions::Odometer::end
unsigned int end()
Definition
Odometer.h:194
libdap
Definition
coverity_models.cpp:31
modules
functions
Odometer.cc
Generated by
1.13.2