COMBINATORIAL_BLAS
1.3
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
OptBuf.h
Go to the documentation of this file.
1
#ifndef _OPT_BUF_H
2
#define _OPT_BUF_H
3
#include "
BitMap.h
"
4
11
template
<
class
IT,
class
NT>
12
class
OptBuf
13
{
14
public
:
15
OptBuf
():
isthere
(NULL),
p_c
(0),
totmax
(0),
localm
(0) {};
16
void
MarkEmpty
()
17
{
18
if
(
totmax
> 0)
19
{
20
// fill(isthere, isthere+localm, false);
21
isthere
->
reset
();
22
}
23
}
24
25
void
Set
(
const
vector<int> & maxsizes,
int
mA)
26
{
27
p_c
= maxsizes.size();
28
totmax
= accumulate(maxsizes.begin(), maxsizes.end(), 0);
29
inds
=
new
IT[
totmax
];
30
fill_n(inds,
totmax
, -1);
31
nums
=
new
NT[
totmax
];
32
dspls
=
new
int
[
p_c
]();
33
partial_sum(maxsizes.begin(), maxsizes.end()-1,
dspls
+1);
34
localm
= mA;
35
//isthere = new bool[localm];
36
//fill(isthere, isthere+localm, false);
37
isthere
=
new
BitMap
(localm);
38
};
39
~OptBuf
()
40
{
if
(
localm
> 0)
41
{
42
//delete [] isthere;
43
delete
isthere
;
44
}
45
46
if
(
totmax
> 0)
47
{
48
delete
[]
inds
;
49
delete
[]
nums
;
50
}
51
if
(
p_c
> 0)
52
delete
[]
dspls
;
53
}
54
OptBuf
(
const
OptBuf<IT,NT>
& rhs)
55
{
56
p_c
= rhs.
p_c
;
57
totmax
= rhs.
totmax
;
58
localm
= rhs.
localm
;
59
inds
=
new
IT[
totmax
];
60
nums
=
new
NT[
totmax
];
61
dspls
=
new
int
[
p_c
]();
62
//isthere = new bool[localm];
63
//fill(isthere, isthere+localm, false);
64
isthere
=
new
BitMap
(
localm
);
65
}
66
OptBuf<IT,NT>
&
operator=
(
const
OptBuf<IT,NT>
& rhs)
67
{
68
if
(
this
!= &rhs)
69
{
70
if
(
localm
> 0)
71
{
72
//delete [] isthere;
73
delete
isthere
;
74
}
75
if
(
totmax
> 0)
76
{
77
delete
[]
inds
;
78
delete
[]
nums
;
79
}
80
if
(
p_c
> 0)
81
delete
[]
dspls
;
82
83
p_c
= rhs.
p_c
;
84
totmax
= rhs.
totmax
;
85
localm
= rhs.
localm
;
86
inds
=
new
IT[
totmax
];
87
nums
=
new
NT[
totmax
];
88
dspls
=
new
int
[
p_c
]();
89
isthere
=
new
BitMap
(*(rhs.
isthere
));
90
}
91
return
*
this
;
92
}
93
94
IT *
inds
;
95
NT *
nums
;
96
int
*
dspls
;
97
//bool * isthere;
98
BitMap
*
isthere
;
99
int
p_c
;
100
int
totmax
;
101
int
localm
;
102
};
103
104
#endif
105
Generated on Wed Feb 6 2013 01:36:32 for COMBINATORIAL_BLAS by
1.8.1.1