Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
tmp
OS-2.10.2
Bcp
src
Member
BCP_vector_sanity.cpp
Go to the documentation of this file.
1
// Copyright (C) 2000, International Business Machines
2
// Corporation and others. All Rights Reserved.
3
#include "
BCP_error.hpp
"
4
#include "
BCP_vector.hpp
"
5
6
//#############################################################################
7
8
void
BCP_vec_sanity_check
(
BCP_vec<int>::const_iterator
firstpos,
9
BCP_vec<int>::const_iterator
lastpos,
10
const
int
maxsize)
11
{
12
if
(firstpos == lastpos)
13
return
;
14
if
(*firstpos < 0)
15
throw
BCP_fatal_error
(
"Negative entry in a BCP_vec_sanity_check.\n"
);
16
if
(*(lastpos - 1) >= maxsize)
17
throw
BCP_fatal_error
(
"Too big entry in a BCP_vec_sanity_check.\n"
);
18
int
prev = -1;
19
while
(firstpos != lastpos){
20
if
(*firstpos < prev)
21
throw
BCP_fatal_error
22
(
"Entry list is not ordered in BCP_vec_sanity_check.\n"
);
23
if
(*firstpos == prev)
24
throw
BCP_fatal_error
25
(
"Duplicate entry in BCP_vec_sanity_check.\n"
);
26
prev = *firstpos;
27
++firstpos;
28
}
29
}
30
BCP_vector.hpp
BCP_vec_sanity_check
void BCP_vec_sanity_check(BCP_vec< int >::const_iterator firstpos, BCP_vec< int >::const_iterator lastpos, const int maxsize)
A helper function to test whether a set positions is sane for a vector.
Definition:
BCP_vector_sanity.cpp:8
BCP_error.hpp
BCP_fatal_error
Currently there isn't any error handling in BCP.
Definition:
BCP_error.hpp:20
BCP_vec
The class BCP_vec serves the same purpose as the vector class in the standard template library...
Definition:
BCP_vector.hpp:24
Generated by
1.8.5