Loading...
Searching...
No Matches
CountedRefData Class Reference

This class stores a reference counter as well as a Singular interpreter object. More...

## Public Types

typedef CountedRefWeakPtr< self * > | back_ptr
Public Types inherited from RefCounter
typedef short | count_type
| Name numerical type for enumbering.

## Private Types

typedef CountedRefData | self
typedef RefCounter | base

## Private Member Functions

| CountedRefData (leftv wrapid, back_ptr back)
| Generate object linked to other reference (e.g. for subscripts).

## Disallow copying to avoid inconsistence

typedef LeftvDeep::copy_tag | copy_tag
| Fix smart pointer type to referenced data.
typedef back_ptr::ptr_type | ptr_type
| Fix smart pointer type to referenced data.
typedef CountedRefPtr< ring, true > | ring_ptr
| Fix smart pointer type to ring.
LeftvDeep | m_data
| Singular object.
ring_ptr | m_ring
| Store namespace for ring-dependent objects.
back_ptr | m_back
| Reference to actual object for wrap structures.
self & | operator= (const self &)
| Fix smart pointer type to referenced data.
| CountedRefData (const self &)
| Fix smart pointer type to referenced data.
BOOLEAN | complain (const char *text) const
| Raise error message and return `TRUE`.
| CountedRefData ()
| Construct shared memory empty Singular object.
| CountedRefData (leftv data)
| Reference Singular object.
| CountedRefData (leftv data, copy_tag do_copy)
| Construct reference for Singular object.
| ~CountedRefData ()
| Destruct.
ptr_type | wrapid ()
| Generate object for indexing.
back_ptr | weakref ()
| Gerenate weak (but managed) reference to `*this`.
self & | operator= (leftv rhs)
| Replace with other Singular data.
BOOLEAN | put (leftv res)
| Write (shallow) copy to given handle.
LeftvShallow | operator* ()
| Extract (shallow) copy of stored data.
BOOLEAN | rering ()
| Determine active ring when ring dependency changes.
idhdl * | root ()
| Get the current context.
BOOLEAN | broken () const
| Check whether identifier became invalid.
BOOLEAN | assign (leftv result, leftv arg)
| Reassign actual object.
BOOLEAN | retrieve (leftv res)
| Recover additional information (e.g. subexpression) from likewise object.
BOOLEAN | unassigned () const
| Check whether data is all-zero.
static ring | parent (leftv rhs)
| Store ring for ring-dependent objects.

## Additional Inherited Members

Public Member Functions inherited from RefCounter
| RefCounter (...)
| Any Constructor resets the counter.
| ~RefCounter ()
| Destructor.

## Detailed Description

This class stores a reference counter as well as a Singular interpreter object.

It also take care of the context, e.g. the current ring, wrap object, etc.

Definition at line 41 of file countedref.cc.

## Member Typedef Documentation

## back_ptr

typedef CountedRefWeakPtr<self*> CountedRefData::back_ptr

Definition at line 45 of file countedref.cc.

## base

typedef RefCounter CountedRefData::base

private

Definition at line 47 of file countedref.cc.

## copy_tag

typedef LeftvDeep::copy_tag CountedRefData::copy_tag

Fix smart pointer type to referenced data.

Definition at line 61 of file countedref.cc.

## ptr_type

typedef back_ptr::ptr_type CountedRefData::ptr_type

Fix smart pointer type to referenced data.

Definition at line 64 of file countedref.cc.

## ring_ptr

typedef CountedRefPtr<ring, true> CountedRefData::ring_ptr

Fix smart pointer type to ring.

Definition at line 67 of file countedref.cc.

## self

typedef CountedRefData CountedRefData::self

private

Definition at line 43 of file countedref.cc.

## Constructor & Destructor Documentation

## CountedRefData() [1/5]

CountedRefData::CountedRefData | ( | leftv | wrapid,
|  | back_ptr | back )

inline private

Generate object linked to other reference (e.g. for subscripts).

Definition at line 50 of file countedref.cc.

:
base(), m_data(wrapid), m_ring(back->m_ring), m_back(back) {
}
CountedRefData::m_ring
ring_ptr m_ring
Store namespace for ring-dependent objects.
Definition countedref.cc:175
CountedRefData::m_data
LeftvDeep m_data
Singular object.
Definition countedref.cc:172
CountedRefData::base
RefCounter base
Definition countedref.cc:47
CountedRefData::m_back
back_ptr m_back
Reference to actual object for wrap structures.
Definition countedref.cc:178
CountedRefData::wrapid
ptr_type wrapid()
Generate object for indexing.
Definition countedref.cc:92

## CountedRefData() [2/5]

CountedRefData::CountedRefData | ( | const self & |  | ) |

private

Fix smart pointer type to referenced data.

## CountedRefData() [3/5]

CountedRefData::CountedRefData | ( |  | ) |

inline explicit

Construct shared memory empty Singular object.

Definition at line 70 of file countedref.cc.

:
base(), m_data(), m_ring(), m_back() { }

## CountedRefData() [4/5]

CountedRefData::CountedRefData | ( | leftv | data | ) |

inline explicit

Reference Singular object.

Definition at line 74 of file countedref.cc.

:
base(), m_data(data), m_ring(parent(data)), m_back() { }
CountedRefData::parent
static ring parent(leftv rhs)
Store ring for ring-dependent objects.
Definition countedref.cc:165

## CountedRefData() [5/5]

CountedRefData::CountedRefData | ( | leftv | data,
|  | copy_tag | do_copy )

inline

Construct reference for Singular object.

Definition at line 78 of file countedref.cc.

:
base(), m_data(data, do_copy), m_ring(parent(data)), m_back() { }

## ~CountedRefData()

CountedRefData::~CountedRefData | ( |  | ) |

inline

Destruct.

Definition at line 82 of file countedref.cc.

{
if (!m_back.unassigned()) {
if (m_back == this)
m_back.invalidate();
else
m_data.clearid(root());
}
}
CountedRefData::root
idhdl * root()
Get the current context.
Definition countedref.cc:120

## Member Function Documentation

## assign()

BOOLEAN CountedRefData::assign | ( | leftv | result,
|  | leftv | arg )

inline

Reassign actual object.

Definition at line 142 of file countedref.cc.

{
if (!m_data.isid()) {
(*this) = arg;
return FALSE;
}
return put(result) || iiAssign(result, arg) || rering();
}
FALSE
#define FALSE
Definition auxiliary.h:97
CountedRefData::rering
BOOLEAN rering()
Determine active ring when ring dependency changes.
Definition countedref.cc:114
CountedRefData::put
BOOLEAN put(leftv res)
Write (shallow) copy to given handle.
Definition countedref.cc:108
result
return result
Definition facAbsBiFact.cc:76
iiAssign
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2099

## broken()

BOOLEAN CountedRefData::broken | ( |  | ) | const

inline

Check whether identifier became invalid.

Definition at line 123 of file countedref.cc.

{
if (!m_back.unassigned() && !m_back)
return complain("Back-reference broken");
if (m_ring) {
if (m_ring != currRing)
return complain("Referenced identifier not from current ring");
return m_data.isid() && m_data.brokenid(currRing->idroot) &&
complain("Referenced identifier not available in ring anymore");
}
if (!m_data.isid()) return FALSE;
return m_data.brokenid(IDROOT) &&
((currPack == basePack) || m_data.brokenid(basePack->idroot)) &&
complain("Referenced identifier not available in current context");
}
CountedRefData::complain
BOOLEAN complain(const char *text) const
Raise error message and return TRUE.
Definition countedref.cc:158
basePack
VAR package basePack
Definition ipid.cc:56
currPack
VAR package currPack
Definition ipid.cc:55
IDROOT
#define IDROOT
Definition ipid.h:19
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## complain()

BOOLEAN CountedRefData::complain | ( | const char * | text | ) | const

inline private

Raise error message and return `TRUE`.

Definition at line 158 of file countedref.cc.

{
WerrorS(text);
return TRUE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24

## operator*()

LeftvShallow CountedRefData::operator* | ( |  | ) |

inline

Extract (shallow) copy of stored data.

Definition at line 111 of file countedref.cc.

{ return (broken()? LeftvShallow(): LeftvShallow(m_data)); }
CountedRefData::broken
BOOLEAN broken() const
Check whether identifier became invalid.
Definition countedref.cc:123

## operator=() [1/2]

self & CountedRefData::operator= | ( | const self & |  | ) |

private

Fix smart pointer type to referenced data.

## operator=() [2/2]

self & CountedRefData::operator= | ( | leftv | rhs | ) |

inline

Replace with other Singular data.

Definition at line 101 of file countedref.cc.

{
m_data = rhs;
m_ring = parent(rhs);
return *this;
}

## parent()

ring CountedRefData::parent | ( | leftv | rhs | ) |

inline static private

Store ring for ring-dependent objects.

Definition at line 165 of file countedref.cc.

{
return (rhs->RingDependend()? currRing: NULL);
}
sleftv::RingDependend
BOOLEAN RingDependend()
Definition subexpr.cc:421
NULL
#define NULL
Definition omList.c:12

## put()

BOOLEAN CountedRefData::put | ( | leftv | res | ) |

inline

Write (shallow) copy to given handle.

Definition at line 108 of file countedref.cc.

{ return broken() || m_data.put(res); }
res
CanonicalForm res
Definition facAbsFact.cc:60

## rering()

BOOLEAN CountedRefData::rering | ( |  | ) |

inline

Determine active ring when ring dependency changes.

Definition at line 114 of file countedref.cc.

{
if (m_ring ^ m_data.ringed()) m_ring = (m_ring? NULL: currRing);
return (m_back && (m_back != this) && m_back->rering());
}

## retrieve()

BOOLEAN CountedRefData::retrieve | ( | leftv | res | ) |

inline

Recover additional information (e.g. subexpression) from likewise object.

Definition at line 151 of file countedref.cc.

{ return m_data.retrieve(res); }

## root()

idhdl * CountedRefData::root | ( |  | ) |

inline

Get the current context.

Definition at line 120 of file countedref.cc.

{ return (m_ring? &m_ring->idroot: &IDROOT); }

## unassigned()

BOOLEAN CountedRefData::unassigned | ( |  | ) | const

inline

Check whether data is all-zero.

Definition at line 154 of file countedref.cc.

{ return m_data.unassigned(); }

## weakref()

back_ptr CountedRefData::weakref | ( |  | ) |

inline

Gerenate weak (but managed) reference to `*this`.

Definition at line 95 of file countedref.cc.

{
if (m_back.unassigned())
m_back = this;
return m_back;
}

## wrapid()

ptr_type CountedRefData::wrapid | ( |  | ) |

inline

Generate object for indexing.

Definition at line 92 of file countedref.cc.

{ return new self(m_data.idify(root()), weakref()); }
CountedRefData::self
CountedRefData self
Definition countedref.cc:43
CountedRefData::weakref
back_ptr weakref()
Gerenate weak (but managed) reference to *this.
Definition countedref.cc:95

## Field Documentation

## m_back

back_ptr CountedRefData::m_back

protected

Reference to actual object for wrap structures.

Definition at line 178 of file countedref.cc.

## m_data

LeftvDeep CountedRefData::m_data

protected

Singular object.

Definition at line 172 of file countedref.cc.

## m_ring

ring_ptr CountedRefData::m_ring

protected

Store namespace for ring-dependent objects.

Definition at line 175 of file countedref.cc.

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

- Singular/countedref.cc