 |
My Project
debian-1:4.1.1-p2+ds-4build2
|
Go to the documentation of this file.
20 #ifndef SINGULAR_COUNTEDREF_H_
21 #define SINGULAR_COUNTEDREF_H_
41 template <
class PtrType,
bool Nondestructive =
false,
bool NeverNull =
false,
42 class CountType =
short>
86 operator bool()
const {
return NeverNull ||
m_ptr; }
133 template <
class PtrType>
136 template <
class PtrType>
150 template <
class PtrType>
153 template <
class PtrType>
218 res->data =(
void*) handle;
225 static unsigned int counter = 0;
227 sprintf(
name,
" :%u:%p:_shared_: ", ++counter,
head->data);
228 if ((*root) ==
NULL )
243 template <
class Type>
245 return (Type*)memcpy(
result, data,
sizeof(Type));
247 template <
class Type>
248 static Type*
cpy(Type* data) {
251 template <
class Type>
253 if (data ==
NULL)
return data;
258 template <
class Type>
263 template <
class Type>
267 template <
class Type>
269 if(current ==
NULL)
return;
391 return (context ==
NULL) ||
BOOLEAN ringed()
Test whether we reference to ring-dependent data.
bool operator==(ptr_type ptr) const
static Type * shallowcpy(Type *data)
self & operator=(ptr_type ptr)
Construct unassigned weak reference.
self & operator=(const self &rhs)
void release()
Store actual pointer.
BOOLEAN put(leftv result)
Put a shallow copy to given leftv.
bool like(const self &rhs) const
Determine whether we point to the same data.
LeftvDeep(leftv data, copy_tag)
Allocate all-zero object by default.
CountedRefPtr(ptr_type ptr)
Convert from pointer.
count_type count() const
Store actual pointer.
self & operator=(leftv rhs)
Assign shallow copy of the input.
CountedRefPtr()
Default constructor.
Construct even deeper copy: Skip identifier (if any) and take care of the data on our own.
self & operator=(const self &rhs)
Assign (shallow) copy of *this.
LeftvShallow(leftv data)
Shallow copy the input data.
LeftvShallow(const self &rhs)
Construct (shallow) copy of *this.
LeftvShallow()
Just allocate (all-zero) leftv.
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
BOOLEAN brokenid(idhdl context) const
Check a given context for our identifier.
self & operator=(const self &)
Allocate all-zero object by default.
CountedRefWeakPtr(const self &rhs)
Construct copy.
CountedRefIndirectPtr & operator=(PtrType ptr)
LeftvDeep(leftv data)
Store a deep copy of the data @ note Occupies the provided leftv and invalidates the latter.
PtrType ptr_type
Construct unassigned weak reference.
leftv m_data
The actual data pointer.
ptr_type m_ptr
Store actual pointer.
BOOLEAN isid() const
Check for being an identifier.
~CountedRefWeakPtr()
Unlink one reference (handled by CountedRefPtr)
void CountedRefPtr_kill(CountedRefIndirectPtr< PtrType > *pval)
void invalidate()
Mark weak reference as invalid.
CountedRefPtr(const self &rhs)
Construct refernce copy.
leftv operator->()
The actual data pointer.
BOOLEAN retrieve(leftv res)
Get additional data (e.g. subexpression data) from likewise instances.
Class used for (list of) interpreter objects.
self & operator=(ptr_type ptr)
static Type * shallowcpy(Type *result, Type *data)
CountedRefPtr< CountedRefIndirectPtr< ptr_type > * > ptrptr_type
Construct unassigned weak reference.
bool unassigned() const
Test whether reference was never used.
LeftvShallow operator*()
Store the actual data.
void countedref_shared_load()
LeftvDeep()
Allocate all-zero object by default.
short count_type
Name numerical type for enumbering.
leftv operator->() const
The actual data pointer.
static void clearid(idhdl handle, idhdl *root)
CountedRefWeakPtr(ptr_type ptr)
Convert from pointer.
void killhdl2(idhdl h, idhdl *ih, ring r)
~CountedRefPtr()
Unlink one reference.
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
bool operator==(ptr_type ptr) const
Construct unassigned weak reference.
ptr_type operator->()
Construct unassigned weak reference.
CountedRefWeakPtr()
Construct unassigned weak reference.
void CleanUp(ring r=currRing)
leftv idify(idhdl *root)
Wrap data by identifier, if not done yet.
~LeftvDeep()
Really clear data.
static Type * cpy(Type *result, Type *data)
static leftv idify(leftv head, idhdl *root)
BOOLEAN unassigned() const
Check whether (all-zero) initialized data was never assigned.
CountedRefIndirectPtr(PtrType ptr)
count_type ref
Number of references.
const ptr_type operator->() const
RefCounter(...)
Any Constructor resets the counter.
leftv m_data
Store the actual data.
void clearid(idhdl *root)
Erase identifier handles by *this.
void reclaim()
Store actual pointer.
self & operator=(const self &rhs)
Construct unassigned weak reference.
char name(const Variable &v)
static Type * recursivecpy(Type *data)
ptrptr_type m_indirect
Construct unassigned weak reference.
bool operator==(const self &rhs) const
Checking equality.
self & operator=(leftv rhs)
Reassign a new deep copy by occupieing another leftv.
static void recursivekill(Type *current)
bool operator!=(ptr_type rhs) const
Construct unassigned weak reference.
CountedRefPtr(const CountedRefPtr< ptr_type, !nondestructive, Never, count_type > &rhs)
Convert from compatible smart pointer.
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
const ptr_type operator->() const
Construct unassigned weak reference.
static Type * cpy(Type *data)
static idhdl newid(leftv head, idhdl *root)