My Project
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions
SBucketFactory Class Reference

sBucket Factory More...

#include <syzextra.h>

Public Types

typedef Base::value_type Bucket
 

Public Member Functions

 SBucketFactory (const ring r)
 
 ~SBucketFactory ()
 
Bucket getBucket (const ring r, const bool remove=true)
 
void putBucket (const Bucket &bt, const bool replace=false)
 

Private Types

typedef std::stack< sBucket_ptBase
 

Private Member Functions

 SBucketFactory ()
 
 SBucketFactory (const SBucketFactory &)
 
void operator= (const SBucketFactory &)
 

Static Private Member Functions

static Bucket _CreateBucket (const ring r)
 inital allocation for new buckets More...
 
static void _DestroyBucket (Bucket &bt)
 we only expect empty buckets to be left at the end for destructor bt will be set to NULL More...
 

Detailed Description

sBucket Factory

Cleate/store/reuse buckets

Definition at line 56 of file syzextra.h.

Member Typedef Documentation

◆ Base

typedef std::stack<sBucket_pt> SBucketFactory::Base
private

Definition at line 59 of file syzextra.h.

◆ Bucket

typedef Base::value_type SBucketFactory::Bucket

Definition at line 62 of file syzextra.h.

Constructor & Destructor Documentation

◆ SBucketFactory() [1/3]

SBucketFactory::SBucketFactory ( const ring  r)
inline

Definition at line 64 of file syzextra.h.

65 {
66 push ( _CreateBucket(r) ); // start with at least one sBucket...?
67 assume( top() != NULL );
68 };
static Bucket _CreateBucket(const ring r)
inital allocation for new buckets
#define assume(x)
Definition: mod2.h:389
#define NULL
Definition: omList.c:12

◆ ~SBucketFactory()

SBucketFactory::~SBucketFactory ( )
inline

Definition at line 70 of file syzextra.h.

71 {
72 while( !empty() )
73 {
74 _DestroyBucket( top() );
75 pop();
76 }
77 }
static void _DestroyBucket(Bucket &bt)
we only expect empty buckets to be left at the end for destructor bt will be set to NULL

◆ SBucketFactory() [2/3]

SBucketFactory::SBucketFactory ( )
private

◆ SBucketFactory() [3/3]

SBucketFactory::SBucketFactory ( const SBucketFactory )
private

Member Function Documentation

◆ _CreateBucket()

static Bucket SBucketFactory::_CreateBucket ( const ring  r)
staticprivate

inital allocation for new buckets

◆ _DestroyBucket()

static void SBucketFactory::_DestroyBucket ( Bucket bt)
staticprivate

we only expect empty buckets to be left at the end for destructor bt will be set to NULL

◆ getBucket()

Bucket SBucketFactory::getBucket ( const ring  r,
const bool  remove = true 
)
inline

Definition at line 79 of file syzextra.h.

80 {
81 Bucket bt = NULL;
82
83 if( !empty() )
84 {
85 bt = top();
86
87 if( remove )
88 pop();
89 }
90 else
91 {
92 bt = _CreateBucket(r);
93
94 if( !remove )
95 {
96 push(bt);
97 assume( bt == top() );
98 }
99 }
100
101 assume( bt != NULL );
102
103 return bt;
104 }
Base::value_type Bucket
Definition: syzextra.h:62

◆ operator=()

void SBucketFactory::operator= ( const SBucketFactory )
private

◆ putBucket()

void SBucketFactory::putBucket ( const Bucket bt,
const bool  replace = false 
)
inline

Definition at line 107 of file syzextra.h.

108 {
109 assume( bt != NULL );
110
111 if( empty() )
112 push( bt );
113 else
114 {
115 if( replace )
116 top() = bt;
117 else
118 {
119 if( bt != top() )
120 push( bt );
121 }
122 }
123
124 assume( bt == top() );
125 }

The documentation for this class was generated from the following file: