My Project  debian-1:4.1.1-p2+ds-4
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions
SBucketFactory Class Reference

#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 69 of file syzextra.h.

Member Typedef Documentation

◆ Base

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

Definition at line 72 of file syzextra.h.

◆ Bucket

typedef Base::value_type SBucketFactory::Bucket

Definition at line 75 of file syzextra.h.

Constructor & Destructor Documentation

◆ SBucketFactory() [1/3]

SBucketFactory::SBucketFactory ( const ring  r)
inline

Definition at line 77 of file syzextra.h.

78  {
79  push ( _CreateBucket(r) ); // start with at least one sBucket...?
80  assume( top() != NULL );
81  };

◆ ~SBucketFactory()

SBucketFactory::~SBucketFactory ( )
inline

Definition at line 83 of file syzextra.h.

84  {
85  while( !empty() )
86  {
87  _DestroyBucket( top() );
88  pop();
89  }
90  }

◆ SBucketFactory() [2/3]

SBucketFactory::SBucketFactory ( )
private

◆ SBucketFactory() [3/3]

SBucketFactory::SBucketFactory ( const SBucketFactory )
private

Member Function Documentation

◆ _CreateBucket()

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

inital allocation for new buckets

Definition at line 64 of file syzextra.cc.

65 {
66  const Bucket bt = sBucketCreate(r);
67 
68  assume( bt != NULL );
69  return bt;
70 }

◆ _DestroyBucket()

void SBucketFactory::_DestroyBucket ( SBucketFactory::Bucket bt)
staticprivate

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

Definition at line 72 of file syzextra.cc.

73 {
74  if( bt != NULL )
75  {
76  sBucketDestroy( &bt );
77  bt = NULL;
78  }
79 }

◆ getBucket()

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

Definition at line 92 of file syzextra.h.

93  {
94  Bucket bt = NULL;
95 
96  if( !empty() )
97  {
98  bt = top();
99 
100  if( remove )
101  pop();
102  }
103  else
104  {
105  bt = _CreateBucket(r);
106 
107  if( !remove )
108  {
109  push(bt);
110  assume( bt == top() );
111  }
112  }
113 
114  assume( bt != NULL );
115 
116  return bt;
117  }

◆ operator=()

void SBucketFactory::operator= ( const SBucketFactory )
private

◆ putBucket()

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

Definition at line 120 of file syzextra.h.

121  {
122  assume( bt != NULL );
123 
124  if( empty() )
125  push( bt );
126  else
127  {
128  if( replace )
129  top() = bt;
130  else
131  {
132  if( bt != top() )
133  push( bt );
134  }
135  }
136 
137  assume( bt == top() );
138  }

The documentation for this class was generated from the following files:
sBucketCreate
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:97
SBucketFactory::_DestroyBucket
static void _DestroyBucket(Bucket &bt)
we only expect empty buckets to be left at the end for destructor bt will be set to NULL
Definition: syzextra.cc:72
assume
#define assume(x)
Definition: mod2.h:384
NULL
#define NULL
Definition: omList.c:9
SBucketFactory::Bucket
Base::value_type Bucket
Definition: syzextra.h:75
sBucketDestroy
void sBucketDestroy(sBucket_pt *bucket)
Definition: sbuckets.cc:104
SBucketFactory::_CreateBucket
static Bucket _CreateBucket(const ring r)
inital allocation for new buckets
Definition: syzextra.cc:64