My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
amp::mpfr_reference Class Reference

#include <amp.h>

Public Member Functions

 mpfr_reference ()
 
 mpfr_reference (const mpfr_reference &r)
 
mpfr_referenceoperator= (const mpfr_reference &r)
 
 ~mpfr_reference ()
 
void initialize (int Precision)
 
void free ()
 
mpfr_srcptr getReadPtr () const
 
mpfr_ptr getWritePtr ()
 
 mpfr_reference ()
 
 mpfr_reference (const mpfr_reference &r)
 
mpfr_referenceoperator= (const mpfr_reference &r)
 
 ~mpfr_reference ()
 
void initialize (int Precision)
 
void free ()
 
mpfr_srcptr getReadPtr () const
 
mpfr_ptr getWritePtr ()
 

Private Attributes

mpfr_recordref
 

Detailed Description

Definition at line 60 of file amp.h.

Constructor & Destructor Documentation

◆ mpfr_reference() [1/4]

amp::mpfr_reference::mpfr_reference ( )

Definition at line 82 of file amp.cpp.

83{
84 ref = NULL;
85}
mpfr_record * ref
Definition: amp.h:74
#define NULL
Definition: omList.c:12

◆ mpfr_reference() [2/4]

amp::mpfr_reference::mpfr_reference ( const mpfr_reference r)

Definition at line 87 of file amp.cpp.

88{
89 ref = r.ref;
90 if( ref!=NULL )
91 ref->refCount++;
92}
unsigned int refCount
Definition: amp.h:35

◆ ~mpfr_reference() [1/2]

amp::mpfr_reference::~mpfr_reference ( )

Definition at line 109 of file amp.cpp.

110{
111 if( ref!=NULL )
112 free();
113}

◆ mpfr_reference() [3/4]

amp::mpfr_reference::mpfr_reference ( )

◆ mpfr_reference() [4/4]

amp::mpfr_reference::mpfr_reference ( const mpfr_reference r)

◆ ~mpfr_reference() [2/2]

amp::mpfr_reference::~mpfr_reference ( )

Member Function Documentation

◆ free() [1/2]

void amp::mpfr_reference::free ( )

Definition at line 123 of file amp.cpp.

124{
125 if( ref==NULL )
126 //throw amp::internalError();
127 {WerrorS("internalError");return;}
128 ref->refCount--;
129 if( ref->refCount==0 )
131 ref = NULL;
132}
static void deleteMpfr(mpfr_record *ref)
Definition: amp.cpp:30
void WerrorS(const char *s)
Definition: feFopen.cc:24

◆ free() [2/2]

void amp::mpfr_reference::free ( )

◆ getReadPtr() [1/2]

mpfr_srcptr amp::mpfr_reference::getReadPtr ( ) const

Definition at line 134 of file amp.cpp.

135{
136 if( ref==NULL )
137 //throw amp::internalError();
138 {WerrorS("internalError");return NULL;}
139 return ref->value;
140}
mpfr_t value
Definition: amp.h:37

◆ getReadPtr() [2/2]

mpfr_srcptr amp::mpfr_reference::getReadPtr ( ) const

◆ getWritePtr() [1/2]

mpfr_ptr amp::mpfr_reference::getWritePtr ( )

Definition at line 142 of file amp.cpp.

143{
144 if( ref==NULL )
145 //throw amp::internalError();
146 {WerrorS("internalError");return NULL;}
147 if( ref->refCount==1 )
148 return ref->value;
149
151 mpfr_set(newref->value, ref->value, GMP_RNDN);
152
153 free();
154 ref = newref;
155 return ref->value;
156}
static mpfr_record * newMpfr(unsigned int Precision)
Definition: amp.cpp:11
unsigned int Precision
Definition: amp.h:36

◆ getWritePtr() [2/2]

mpfr_ptr amp::mpfr_reference::getWritePtr ( )

◆ initialize() [1/2]

void amp::mpfr_reference::initialize ( int  Precision)

Definition at line 115 of file amp.cpp.

116{
117 if( ref!=NULL )
118 free();
119 ref = amp::mpfr_storage::newMpfr(Precision);
120 ref->refCount = 1;
121}

◆ initialize() [2/2]

void amp::mpfr_reference::initialize ( int  Precision)

◆ operator=() [1/2]

amp::mpfr_reference & amp::mpfr_reference::operator= ( const mpfr_reference r)

Definition at line 94 of file amp.cpp.

96{
97 if ( &r==this )
98 return *this;
99 if ( ref==r.ref )
100 return *this;
101 if( ref!=NULL )
102 free();
103 ref = r.ref;
104 if( ref!=NULL )
105 ref->refCount++;
106 return *this;
107}

◆ operator=() [2/2]

mpfr_reference & amp::mpfr_reference::operator= ( const mpfr_reference r)

Field Documentation

◆ ref

mpfr_record * amp::mpfr_reference::ref
private

Definition at line 74 of file amp.h.


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