source: icXML/icXML-devel/src/xercesc/util/BitSet.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 3.7 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: BitSet.hpp 676911 2008-07-15 13:27:32Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_BITSET_HPP)
23#define XERCESC_INCLUDE_GUARD_BITSET_HPP
24
25#include <xercesc/util/XMemory.hpp>
26#include <icxercesc/util/PlatformUtils.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30class XMLUTIL_EXPORT BitSet : public XMemory
31{
32public:
33    // -----------------------------------------------------------------------
34    //  Constructors and Destructor
35    // -----------------------------------------------------------------------
36    BitSet( const XMLSize_t size
37          , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
38    BitSet(const BitSet& toCopy);
39    ~BitSet();
40
41
42    // -----------------------------------------------------------------------
43    //  Equality methods
44    // -----------------------------------------------------------------------
45    bool equals(const BitSet& other) const;
46
47
48    // -----------------------------------------------------------------------
49    //  Getter methods
50    // -----------------------------------------------------------------------
51    bool allAreCleared() const;
52    bool allAreSet() const;
53    XMLSize_t size() const;
54    bool get(const XMLSize_t index) const;
55
56
57    // -----------------------------------------------------------------------
58    //  Setter methods
59    // -----------------------------------------------------------------------
60    void clear(const XMLSize_t index);
61    void clearAll();
62    void set(const XMLSize_t index);
63
64
65    // -----------------------------------------------------------------------
66    //  Bitwise logical operations
67    // -----------------------------------------------------------------------
68    void andWith(const BitSet& other);
69    void orWith(const BitSet& other);
70    void xorWith(const BitSet& other);
71
72
73    // -----------------------------------------------------------------------
74    //  Miscellaneous
75    // -----------------------------------------------------------------------
76    XMLSize_t hash(const XMLSize_t hashModulus) const;
77
78
79private :
80    // -----------------------------------------------------------------------
81    //  Unimplemented constructors
82    // -----------------------------------------------------------------------
83    BitSet();   
84    BitSet& operator=(const BitSet&);
85    // -----------------------------------------------------------------------
86    //  Private methods
87    // -----------------------------------------------------------------------
88    void ensureCapacity(const XMLSize_t bits);
89
90
91    // -----------------------------------------------------------------------
92    //  Data members
93    //
94    //  fBits
95    //      The array of unsigned longs used to store the bits.
96    //
97    //  fUnitLen
98    //      The length of the storage array, in storage units not bits.
99    // -----------------------------------------------------------------------
100    MemoryManager*  fMemoryManager;
101    unsigned long*  fBits;
102    XMLSize_t       fUnitLen;
103};
104
105XERCES_CPP_NAMESPACE_END
106
107#endif
Note: See TracBrowser for help on using the repository browser.