Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Friends
memorizer Class Reference

#include <memorizer.hpp>

Collaboration diagram for memorizer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 memorizer ()
 memorizer (const memorizer &mem)
 memorizer (memorizer_rep *rep)
 ~memorizer ()
memorizeroperator= (memorizer mem)
memorizer_repoperator-> ()

Public Attributes

memorizer_reprep

Friends

bool is_memorized (const memorizer &mem)
bool operator== (memorizer o1, memorizer o2)
bool operator!= (memorizer o1, memorizer o2)
int hash (memorizer o1)
tm_ostreamoperator<< (tm_ostream &out, memorizer mem)

Detailed Description

Definition at line 54 of file memorizer.hpp.


Constructor & Destructor Documentation

memorizer::memorizer ( ) [inline]

Definition at line 58 of file memorizer.hpp.

: rep (NULL) {}
memorizer::memorizer ( const memorizer mem) [inline]

Definition at line 59 of file memorizer.hpp.

                                         : rep (mem.rep) {
    if (rep != NULL) {
      //cout << "copy " << rep << LF;
      rep->ref_count++; } }

Definition at line 288 of file memorizer.cpp.

                                        {
  rep= bigmem_insert (ptr);
  //cout << "construct " << ptr << " -> " << rep << LF;
  if (rep != ptr) tm_delete (ptr);
  //cout << "  set " << mem_pos[mem_cur] << ": " << rep << LF;
  memorizer_rep*& old_rep (mem_stack[mem_pos[mem_cur]++].rep);
  if (rep == old_rep) rep->ref_count++;
  else {
    if (old_rep != NULL) {
      old_rep->ref_count--;
      if (old_rep->ref_count == 0) tm_delete (old_rep);
    }
    old_rep= rep;
    rep->ref_count += 2;
  }
  if (mem_pos[mem_cur] == mem_max_stack)
    double_size (mem_stack, mem_max_stack);
}

Here is the call graph for this function:

Definition at line 307 of file memorizer.cpp.

                       {
  if (rep != NULL) {
    rep->ref_count--;
    //cout << "destroy " << rep << ", " << rep->ref_count << LF;
    if (rep->ref_count == 0) {
      bigmem_remove (rep);
      tm_delete (rep);
    }
  }
}

Here is the call graph for this function:


Member Function Documentation

memorizer_rep* memorizer::operator-> ( void  ) [inline]

Definition at line 66 of file memorizer.hpp.

{ return rep; }
memorizer & memorizer::operator= ( memorizer  mem)

Definition at line 319 of file memorizer.cpp.

                                    {
  //cout << "assign " << rep << ", " << mem.rep << LF;
  if (rep == mem.rep) return *this;
  if (rep != NULL) {
    rep->ref_count--;
    //cout << "refcount " << rep << ", " << rep->ref_count << "\n";
    if (rep->ref_count == 0) {
      bigmem_remove (rep);
      tm_delete (rep);
    }
  }
  rep= mem.rep;
  if (rep != NULL) rep->ref_count++;
  return *this;
}

Here is the call graph for this function:


Friends And Related Function Documentation

int hash ( memorizer  o1) [friend]

Definition at line 73 of file memorizer.hpp.

                                        {
    return o1.rep->hash (); }
bool is_memorized ( const memorizer mem) [friend]

Definition at line 67 of file memorizer.hpp.

                                                         {
    return mem.rep->ref_count >= 3; }
bool operator!= ( memorizer  o1,
memorizer  o2 
) [friend]

Definition at line 71 of file memorizer.hpp.

                                                              {
    return o1.rep->type () != o2.rep->type () || !o1.rep->equal (o2.rep); }
tm_ostream& operator<< ( tm_ostream out,
memorizer  mem 
) [friend]

Definition at line 75 of file memorizer.hpp.

                                                                         {
    mem->print (out); return out; }
bool operator== ( memorizer  o1,
memorizer  o2 
) [friend]

Definition at line 69 of file memorizer.hpp.

                                                              {
    return o1.rep->type () == o2.rep->type () && o1.rep->equal (o2.rep); }

Member Data Documentation

Definition at line 56 of file memorizer.hpp.


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