File indexing completed on 2026-09-15 09:17:21
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 {
0027 friend class Storage_BucketIterator;
0028 friend class Storage_Schema;
0029 friend class Storage_BucketOfPersistent;
0030
0031 Standard_Persistent** mySpace;
0032 int mySpaceSize;
0033 int myCurrentSpace;
0034
0035 void Append(Standard_Persistent*);
0036
0037 Standard_Persistent* Value(const int theIndex) const;
0038
0039 public:
0040 Storage_Bucket()
0041 : mySpace(nullptr),
0042 mySpaceSize(200000),
0043 myCurrentSpace(-1)
0044 {
0045 mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
0046 }
0047
0048 Storage_Bucket(const int theSpaceSize)
0049 : mySpace(nullptr),
0050 mySpaceSize(theSpaceSize),
0051 myCurrentSpace(-1)
0052 {
0053 mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
0054 }
0055
0056 void Clear();
0057
0058 ~Storage_Bucket();
0059 };
0060
0061 class Storage_BucketOfPersistent
0062 {
0063 friend class Storage_BucketIterator;
0064 Storage_Bucket** myBuckets;
0065 int myNumberOfBucket;
0066 int myNumberOfBucketAllocated;
0067 Storage_Bucket* myCurrentBucket;
0068 int myCurrentBucketNumber;
0069 int myLength;
0070 int myBucketSize;
0071
0072 public:
0073 Storage_BucketOfPersistent(const int theBucketSize = 300000, const int theBucketNumber = 100);
0074
0075 int Length() const { return myLength; }
0076
0077 void Append(const occ::handle<Standard_Persistent>& sp);
0078
0079 Standard_Persistent* Value(const int theIndex);
0080
0081 void Clear();
0082
0083 ~Storage_BucketOfPersistent();
0084 };
0085
0086 class Storage_BucketIterator
0087 {
0088 Storage_BucketOfPersistent* myBucket;
0089 Storage_Bucket* myCurrentBucket;
0090 int myCurrentBucketIndex;
0091 int myCurrentIndex;
0092 int myBucketNumber;
0093 bool myMoreObject;
0094
0095 public:
0096 Storage_BucketIterator(Storage_BucketOfPersistent*);
0097 void Init(Storage_BucketOfPersistent*);
0098 void Reset();
0099
0100 Standard_Persistent* Value() const
0101 {
0102 if (myCurrentBucket)
0103 {
0104 return myCurrentBucket->mySpace[myCurrentIndex];
0105 }
0106 else
0107 return nullptr;
0108 }
0109
0110 bool More() const { return myMoreObject; }
0111
0112 void Next();
0113 };
0114
0115 #endif