MPQC
3.0.0-alpha
rnglock.h
1
//
2
// rnglock.h
3
//
4
// Copyright (C) 1996 Limit Point Systems, Inc.
5
//
6
// Author: Curtis Janssen <cljanss@limitpt.com>
7
// Maintainer: LPS
8
//
9
// This file is part of the SC Toolkit.
10
//
11
// The SC Toolkit is free software; you can redistribute it and/or modify
12
// it under the terms of the GNU Library General Public License as published by
13
// the Free Software Foundation; either version 2, or (at your option)
14
// any later version.
15
//
16
// The SC Toolkit is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU Library General Public License for more details.
20
//
21
// You should have received a copy of the GNU Library General Public License
22
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
//
25
// The U.S. Government is granted a limited license as per AL 91-7.
26
//
27
28
#ifndef _util_group_rnglock_h
29
#define _util_group_rnglock_h
30
31
#include <iostream>
32
33
#include <util/misc/exenv.h>
34
35
namespace
sc
{
36
37
class
Pool;
38
39
class
RangeLockItem
{
40
public
:
41
RangeLockItem
*prev;
42
RangeLockItem
*next;
43
int
start;
44
int
fence;
45
int
value;
46
RangeLockItem
(
RangeLockItem
*p,
RangeLockItem
*n,
int
s,
int
f,
int
v):
47
prev(p), next(n), start(s), fence(f), value(v) {}
48
~
RangeLockItem
() {};
49
50
static
void
*
operator
new
(size_t,
Pool
*);
51
static
void
operator
delete
(
void
*,
Pool
*);
52
};
53
54
class
RangeLockValOp;
55
class
RangeLock
{
56
private
:
57
RangeLockItem
*root_;
58
Pool
*pool_;
59
60
void
split_ranges(
int
start,
int
fence);
61
void
do_valop(RangeLockValOp&,
int
start,
int
fence);
62
public
:
63
RangeLock
(
Pool
*pool = 0);
64
~
RangeLock
();
65
66
void
increment(
int
start,
int
fence);
67
void
decrement(
int
start,
int
fence);
68
void
set(
int
start,
int
fence,
int
value);
69
void
sum(
int
start,
int
fence,
int
delta);
70
71
// check for anything within a range to be equal to a value
72
int
checkeq(
int
start,
int
fence,
int
value);
73
// check for anything within a range to be greater than a value
74
int
checkgr(
int
start,
int
fence,
int
value);
75
76
void
check();
77
void
print(std::ostream &o =
ExEnv::out0
())
const
;
78
79
int
lockvalue(
int
i);
80
};
81
82
}
83
84
#endif
85
86
// Local Variables:
87
// mode: c++
88
// c-file-style: "CLJ"
89
// End:
sc::RangeLock
Definition:
rnglock.h:55
sc::Pool
Definition:
pool.h:262
sc::RangeLockItem
Definition:
rnglock.h:39
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc
Contains all MPQC code up to version 3.
Definition:
mpqcin.h:14
Generated at Sun Jan 26 2020 23:24:01 for
MPQC
3.0.0-alpha using the documentation package
Doxygen
1.8.16.