File indexing completed on 2025-01-18 10:05:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _Storage_BucketOfPersistent_HeaderFile
0016 #define _Storage_BucketOfPersistent_HeaderFile
0017
0018 #include <Standard_Integer.hxx>
0019 #include <Standard_Persistent.hxx>
0020
0021 class Storage_Schema;
0022 class Storage_BucketOfPersistent;
0023 class Storage_BucketIterator;
0024
0025 class Storage_Bucket {
0026 friend class Storage_BucketIterator;
0027 friend class Storage_Schema;
0028 friend class Storage_BucketOfPersistent;
0029
0030 Standard_Persistent** mySpace;
0031 Standard_Integer mySpaceSize;
0032 Standard_Integer myCurrentSpace;
0033
0034
0035 void Append(Standard_Persistent *);
0036
0037 Standard_Persistent* Value(const Standard_Integer theIndex) const;
0038
0039 public:
0040 Storage_Bucket() : mySpace(0L), mySpaceSize(200000), myCurrentSpace(-1)
0041 {
0042 mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
0043 }
0044
0045 Storage_Bucket(const Standard_Integer theSpaceSize) : mySpace(0L), mySpaceSize(theSpaceSize), myCurrentSpace(-1)
0046 {
0047 mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
0048 }
0049
0050 void Clear();
0051
0052 ~Storage_Bucket();
0053 };
0054
0055
0056 class Storage_BucketOfPersistent {
0057 friend class Storage_BucketIterator;
0058 Storage_Bucket** myBuckets;
0059 Standard_Integer myNumberOfBucket;
0060 Standard_Integer myNumberOfBucketAllocated;
0061 Storage_Bucket* myCurrentBucket;
0062 Standard_Integer myCurrentBucketNumber;
0063 Standard_Integer myLength;
0064 Standard_Integer myBucketSize;
0065
0066 public:
0067 Storage_BucketOfPersistent(const Standard_Integer theBucketSize = 300000, const Standard_Integer theBucketNumber = 100);
0068
0069 Standard_Integer Length() const
0070 {
0071 return myLength;
0072 }
0073
0074 void Append(const Handle(Standard_Persistent)& sp);
0075
0076 Standard_Persistent* Value(const Standard_Integer theIndex);
0077
0078 void Clear();
0079
0080 ~Storage_BucketOfPersistent() ;
0081
0082 };
0083
0084 class Storage_BucketIterator {
0085 Storage_BucketOfPersistent *myBucket;
0086 Storage_Bucket *myCurrentBucket;
0087 Standard_Integer myCurrentBucketIndex;
0088 Standard_Integer myCurrentIndex;
0089 Standard_Integer myBucketNumber;
0090 Standard_Boolean myMoreObject;
0091
0092 public:
0093 Storage_BucketIterator(Storage_BucketOfPersistent*);
0094 void Init(Storage_BucketOfPersistent*);
0095 void Reset();
0096
0097 Standard_Persistent* Value() const
0098 {
0099 if (myCurrentBucket) {
0100 return myCurrentBucket->mySpace[myCurrentIndex];
0101 }
0102 else return 0L;
0103 }
0104
0105 Standard_Boolean More() const
0106 {
0107 return myMoreObject;
0108 }
0109
0110 void Next();
0111 };
0112
0113 #endif