PVData C++
8.0.9
Toggle main menu visibility
Loading...
Searching...
No Matches
misc
pv
bitSet.h
1
/* bitSet.h */
2
/*
3
* Copyright information and license terms for this software can be
4
* found in the file LICENSE that is included with the distribution
5
*/
9
#ifndef BITSET_H
10
#define BITSET_H
11
12
#if __cplusplus>=201103L
13
# include <
initializer_list
>
14
#endif
15
16
#include <
vector
>
17
18
#include <pv/pvType.h>
19
#include <pv/serialize.h>
20
#include <
pv/sharedPtr.h
>
21
22
#include <shareLib.h>
23
24
namespace
epics
{
namespace
pvData
{
25
26
class
BitSet
;
27
typedef
std::tr1::shared_ptr<BitSet> BitSetPtr;
28
56
class
epicsShareClass
BitSet
:
public
Serializable
{
57
public
:
58
POINTER_DEFINITIONS(
BitSet
);
59
static
BitSetPtr create(
uint32
nbits);
63
BitSet
();
64
72
BitSet
(
uint32
nbits);
73
74
#if __cplusplus>=201103L
81
BitSet
(
std::initializer_list<uint32>
I);
82
#endif
83
87
virtual
~BitSet
();
88
95
BitSet
&
flip
(
uint32
bitIndex);
96
102
BitSet
&
set
(
uint32
bitIndex);
103
109
BitSet
&
clear
(
uint32
bitIndex);
110
117
void
set
(
uint32
bitIndex,
bool
value);
118
127
bool
get
(
uint32
bitIndex)
const
;
128
132
void
clear
();
133
151
int32
nextSetBit
(
uint32
fromIndex)
const
;
152
160
int32
nextClearBit
(
uint32
fromIndex)
const
;
161
168
bool
isEmpty
()
const
;
169
175
uint32
cardinality
()
const
;
176
184
uint32
size
()
const
;
185
187
bool
logical_and
(
const
BitSet
& other)
const
;
189
bool
logical_or
(
const
BitSet
& other)
const
;
190
200
BitSet
&
operator&=
(
const
BitSet
&
set
);
201
211
BitSet
&
operator|=
(
const
BitSet
&
set
);
212
227
BitSet
&
operator^=
(
const
BitSet
&
set
);
228
232
BitSet
&
operator=
(
const
BitSet
&
set
);
233
235
void
swap
(
BitSet
&
set
);
236
243
void
or_and
(
const
BitSet
& set1,
const
BitSet
& set2);
244
248
bool
operator==
(
const
BitSet
&
set
)
const
;
249
250
bool
operator!=(
const
BitSet
&
set
)
const
;
251
252
virtual
void
serialize
(
ByteBuffer
*buffer,
253
SerializableControl
*flusher)
const
;
254
virtual
void
deserialize
(
ByteBuffer
*buffer,
255
DeserializableControl
*flusher);
256
257
private
:
258
259
typedef
std::vector<uint64>
words_t;
261
words_t words;
262
263
private
:
269
void
recalculateWordsInUse();
270
275
void
ensureCapacity(
uint32
wordsRequired);
276
284
void
expandTo(
uint32
wordIndex);
285
298
static
uint32
numberOfTrailingZeros(
uint64
i);
299
308
static
uint32
bitCount(
uint64
i);
309
310
};
311
312
epicsShareExtern
std::ostream
& operator<<(
std::ostream
& o,
const
BitSet
& b);
313
314
}}
315
#endif
/* BITSET_H */
316
317
318
initializer_list
vector
std::ostream
basic_ostream< char > ostream
std::initializer_list
std::vector
epics::pvData::BitSet
A vector of bits.
Definition
bitSet.h:56
epics::pvData::BitSet::operator=
BitSet & operator=(const BitSet &set)
epics::pvData::BitSet::BitSet
BitSet()
epics::pvData::BitSet::serialize
virtual void serialize(ByteBuffer *buffer, SerializableControl *flusher) const
epics::pvData::BitSet::set
BitSet & set(uint32 bitIndex)
epics::pvData::BitSet::size
uint32 size() const
epics::pvData::BitSet::nextSetBit
int32 nextSetBit(uint32 fromIndex) const
epics::pvData::BitSet::isEmpty
bool isEmpty() const
epics::pvData::BitSet::operator|=
BitSet & operator|=(const BitSet &set)
epics::pvData::BitSet::get
bool get(uint32 bitIndex) const
epics::pvData::BitSet::set
void set(uint32 bitIndex, bool value)
epics::pvData::BitSet::logical_and
bool logical_and(const BitSet &other) const
Returns true if any bit is set in both *this and other.
epics::pvData::BitSet::operator&=
BitSet & operator&=(const BitSet &set)
epics::pvData::BitSet::or_and
void or_and(const BitSet &set1, const BitSet &set2)
epics::pvData::BitSet::~BitSet
virtual ~BitSet()
epics::pvData::BitSet::cardinality
uint32 cardinality() const
epics::pvData::BitSet::operator^=
BitSet & operator^=(const BitSet &set)
epics::pvData::BitSet::swap
void swap(BitSet &set)
Swap contents.
epics::pvData::BitSet::flip
BitSet & flip(uint32 bitIndex)
epics::pvData::BitSet::deserialize
virtual void deserialize(ByteBuffer *buffer, DeserializableControl *flusher)
epics::pvData::BitSet::nextClearBit
int32 nextClearBit(uint32 fromIndex) const
epics::pvData::BitSet::BitSet
BitSet(uint32 nbits)
epics::pvData::BitSet::operator==
bool operator==(const BitSet &set) const
epics::pvData::BitSet::logical_or
bool logical_or(const BitSet &other) const
Returns true if any bit is set in both *this or other.
epics::pvData::BitSet::clear
void clear()
epics::pvData::BitSet::clear
BitSet & clear(uint32 bitIndex)
epics::pvData::ByteBuffer
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
Definition
byteBuffer.h:237
epics::pvData::DeserializableControl
Callback class for deserialization.
Definition
serialize.h:93
epics::pvData::SerializableControl
Callback class for serialization.
Definition
serialize.h:42
epics::pvData::Serializable
Base class for serialization.
Definition
serialize.h:138
epics::pvData
pvData
Definition
convert.h:21
epics::pvData::uint32
uint32_t uint32
Definition
pvType.h:99
epics::pvData::int32
int32_t int32
Definition
pvType.h:83
epics::pvData::uint64
uint64_t uint64
Definition
pvType.h:103
epics
epics
Definition
convert.h:21
sharedPtr.h
Generated on
for PVData C++ by
1.17.0