Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:11

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_BITSET_HPP)
0023 #define XERCESC_INCLUDE_GUARD_BITSET_HPP
0024 
0025 #include <xercesc/util/XMemory.hpp>
0026 #include <xercesc/util/PlatformUtils.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class XMLUTIL_EXPORT BitSet : public XMemory
0031 {
0032 public:
0033     // -----------------------------------------------------------------------
0034     //  Constructors and Destructor
0035     // -----------------------------------------------------------------------
0036     BitSet( const XMLSize_t size
0037           , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0038     BitSet(const BitSet& toCopy);
0039     ~BitSet();
0040 
0041 
0042     // -----------------------------------------------------------------------
0043     //  Equality methods
0044     // -----------------------------------------------------------------------
0045     bool equals(const BitSet& other) const;
0046 
0047 
0048     // -----------------------------------------------------------------------
0049     //  Getter methods
0050     // -----------------------------------------------------------------------
0051     bool allAreCleared() const;
0052     bool allAreSet() const;
0053     XMLSize_t size() const;
0054     bool get(const XMLSize_t index) const;
0055 
0056 
0057     // -----------------------------------------------------------------------
0058     //  Setter methods
0059     // -----------------------------------------------------------------------
0060     void clear(const XMLSize_t index);
0061     void clearAll();
0062     void set(const XMLSize_t index);
0063 
0064 
0065     // -----------------------------------------------------------------------
0066     //  Bitwise logical operations
0067     // -----------------------------------------------------------------------
0068     void andWith(const BitSet& other);
0069     void orWith(const BitSet& other);
0070     void xorWith(const BitSet& other);
0071 
0072 
0073     // -----------------------------------------------------------------------
0074     //  Miscellaneous
0075     // -----------------------------------------------------------------------
0076     XMLSize_t hash(const XMLSize_t hashModulus) const;
0077 
0078 
0079 private :
0080     // -----------------------------------------------------------------------
0081     //  Unimplemented constructors
0082     // -----------------------------------------------------------------------
0083     BitSet();    
0084     BitSet& operator=(const BitSet&);
0085     // -----------------------------------------------------------------------
0086     //  Private methods
0087     // -----------------------------------------------------------------------
0088     void ensureCapacity(const XMLSize_t bits);
0089 
0090 
0091     // -----------------------------------------------------------------------
0092     //  Data members
0093     //
0094     //  fBits
0095     //      The array of unsigned longs used to store the bits.
0096     //
0097     //  fUnitLen
0098     //      The length of the storage array, in storage units not bits.
0099     // -----------------------------------------------------------------------
0100     MemoryManager*  fMemoryManager;
0101     unsigned long*  fBits;
0102     XMLSize_t       fUnitLen;
0103 };
0104 
0105 XERCES_CPP_NAMESPACE_END
0106 
0107 #endif