Loading...
Searching...
No Matches
LinTree::LinTree Class Reference

`#include <lintree.h>`

## Public Member Functions

| LinTree ()
| LinTree (const LinTree &other)
| ~LinTree ()
| LinTree (std::string &source)
LinTree & | operator= (const LinTree &other)
void | rewind ()
void | clear ()
void | mark_error (const char *s)
int | has_error ()
const char * | error_msg ()
template<typename T>
T | get ()
template<typename T>
T | get_prev ()
template<typename T>
void | put (T data)
template<typename T>
void | skip ()
int | get_int ()
size_t | get_size ()
void | put_int (int code)
void | skip_int ()
const char * | get_bytes (size_t n)
const char * | get_addr ()
void | put_bytes (char *p, size_t n)
char * | reserve_bytes (size_t n)
void | put_cstring (char *p)
const char * | get_cstring ()
void | skip_cstring ()
void | skip_bytes (size_t n)
std::string & | to_string ()
void | set_last_ring (void *r)
int | has_last_ring ()
void * | get_last_ring ()

## Private Attributes

std::string & | memory
size_t | cursor
const char * | error
void * | last_ring

## Detailed Description

Definition at line 24 of file lintree.h.

## Constructor & Destructor Documentation

## LinTree() [1/3]

LinTree::LinTree::LinTree | ( |  | ) |

Definition at line 882 of file lintree.cc.

: cursor(0), memory(*new string()), error(NULL), last_ring(NULL) {
}
LinTree::LinTree::last_ring
void * last_ring
Definition lintree.h:29
LinTree::LinTree::error
const char * error
Definition lintree.h:28
LinTree::LinTree::memory
std::string & memory
Definition lintree.h:26
LinTree::LinTree::cursor
size_t cursor
Definition lintree.h:27
NULL
#define NULL
Definition omList.c:12

## LinTree() [2/3]

LinTree::LinTree::LinTree | ( | const LinTree & | other | ) |

Definition at line 885 of file lintree.cc.

: cursor(0), memory(*new string(other.memory)), error(NULL), last_ring(NULL) {
}

## ~LinTree()

LinTree::LinTree::~LinTree | ( |  | ) |

Definition at line 907 of file lintree.cc.

{
if (last_ring)
rKill((ring) last_ring);
}
rKill
void rKill(ring r)
Definition ipshell.cc:6181

## LinTree() [3/3]

LinTree::LinTree::LinTree | ( | std::string & | source | ) |

Definition at line 896 of file lintree.cc.

:
cursor(0), memory(*new string(source)), error(NULL), last_ring(NULL) {
}

## Member Function Documentation

## clear()

void LinTree::LinTree::clear | ( |  | ) |

inline

Definition at line 37 of file lintree.h.

{ memory.clear(); cursor = 0; error = NULL; last_ring = NULL; }

## error_msg()

const char * LinTree::LinTree::error_msg | ( |  | ) |

inline

Definition at line 44 of file lintree.h.

{
return error;
}

## get()

template<typename T>

T LinTree::LinTree::get | ( |  | ) |

inline

Definition at line 48 of file lintree.h.

{
T result;
memcpy(&result, memory.c_str() + cursor, sizeof(T));
cursor += sizeof(T);
return result;
}
result
return result
Definition facAbsBiFact.cc:76
T
STATIC_VAR jList * T
Definition janet.cc:30

## get_addr()

const char * LinTree::LinTree::get_addr | ( |  | ) |

inline

Definition at line 85 of file lintree.h.

{
return memory.c_str() + cursor;
}

## get_bytes()

const char * LinTree::LinTree::get_bytes | ( | size_t | n | ) |

inline

Definition at line 80 of file lintree.h.

{
const char *result = memory.c_str() + cursor;
cursor += n;
return result;
}

## get_cstring()

const char * LinTree::LinTree::get_cstring | ( |  | ) |

inline

Definition at line 104 of file lintree.h.

{
size_t n = get_size();
const char *result = memory.c_str() + cursor;
cursor += n + 1;
return result;
}
LinTree::LinTree::get_size
size_t get_size()
Definition lintree.h:71

## get_int()

int LinTree::LinTree::get_int | ( |  | ) |

inline

Definition at line 68 of file lintree.h.

{
return get<int>();
}
LinTree::LinTree::get
T get()
Definition lintree.h:48

## get_last_ring()

void * LinTree::LinTree::get_last_ring | ( |  | ) |

inline

Definition at line 124 of file lintree.h.

{
return last_ring;
}

## get_prev()

template<typename T>

T LinTree::LinTree::get_prev | ( |  | ) |

inline

Definition at line 55 of file lintree.h.

{
T result;
memcpy(&result, memory.c_str() + cursor - sizeof(T), sizeof(T));
return result;
}

## get_size()

size_t LinTree::LinTree::get_size | ( |  | ) |

inline

Definition at line 71 of file lintree.h.

{
return get<size_t>();
}

## has_error()

int LinTree::LinTree::has_error | ( |  | ) |

inline

Definition at line 41 of file lintree.h.

{
return error != NULL;
}

## has_last_ring()

int LinTree::LinTree::has_last_ring | ( |  | ) |

inline

Definition at line 121 of file lintree.h.

{
return last_ring != NULL;
}

## mark_error()

void LinTree::LinTree::mark_error | ( | const char * | s | ) |

inline

Definition at line 38 of file lintree.h.

{
error = s;
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51

## operator=()

LinTree & LinTree::LinTree::operator= | ( | const LinTree & | other | ) |

Definition at line 888 of file lintree.cc.

{
cursor = other.cursor;
memory = *new string(other.memory);
error = NULL;
last_ring = NULL;
return *this;
}
string
#define string
Definition libparse.cc:1252

## put()

template<typename T>

void LinTree::LinTree::put | ( | T | data | ) |

inline

Definition at line 61 of file lintree.h.

{
memory.append((const char *) &data, sizeof(T));
}

## put_bytes()

void LinTree::LinTree::put_bytes | ( | char * | p,
|  | size_t | n )

inline

Definition at line 88 of file lintree.h.

{
memory.append(p, n);
}
p
int p
Definition cfModGcd.cc:4086

## put_cstring()

void LinTree::LinTree::put_cstring | ( | char * | p | ) |

inline

Definition at line 99 of file lintree.h.

{
size_t n = strlen(p);
put(n);
put_bytes(p, n+1);
}
LinTree::LinTree::put_bytes
void put_bytes(char *p, size_t n)
Definition lintree.h:88
LinTree::LinTree::put
void put(T data)
Definition lintree.h:61

## put_int()

void LinTree::LinTree::put_int | ( | int | code | ) |

inline

Definition at line 74 of file lintree.h.

{
put(code);
}

## reserve_bytes()

char * LinTree::LinTree::reserve_bytes | ( | size_t | n | ) |

inline

Definition at line 91 of file lintree.h.

{
size_t pos = memory.size();
memory.reserve(n);
for (size_t i = 0; i < n; i++) {
memory += '\0';
}
return (char *)(memory.c_str() + pos);
}
i
int i
Definition cfEzgcd.cc:132

## rewind()

void LinTree::LinTree::rewind | ( |  | ) |

inline

Definition at line 36 of file lintree.h.

{ cursor = 0; }

## set_last_ring()

void LinTree::LinTree::set_last_ring | ( | void * | r | ) |

Definition at line 900 of file lintree.cc.

{
if (last_ring)
rKill((ring) last_ring);
last_ring = r;
if (r) rIncRefCnt((ring) r);
}
rIncRefCnt
static ring rIncRefCnt(ring r)
Definition ring.h:849

## skip()

template<typename T>

void LinTree::LinTree::skip | ( |  | ) |

inline

Definition at line 65 of file lintree.h.

{
cursor += sizeof(T);
}

## skip_bytes()

void LinTree::LinTree::skip_bytes | ( | size_t | n | ) |

inline

Definition at line 114 of file lintree.h.

{
cursor += n;
}

## skip_cstring()

void LinTree::LinTree::skip_cstring | ( |  | ) |

inline

Definition at line 110 of file lintree.h.

{
size_t n = get_size();
cursor += n + 1;
}

## skip_int()

void LinTree::LinTree::skip_int | ( |  | ) |

inline

Definition at line 77 of file lintree.h.

{
skip<int>();
}
LinTree::LinTree::skip
void skip()
Definition lintree.h:65

## to_string()

std::string & LinTree::LinTree::to_string | ( |  | ) |

inline

Definition at line 117 of file lintree.h.

{
return memory;
}

## Field Documentation

## cursor

size_t LinTree::LinTree::cursor

private

Definition at line 27 of file lintree.h.

## error

const char* LinTree::LinTree::error

private

Definition at line 28 of file lintree.h.

## last_ring

void* LinTree::LinTree::last_ring

private

Definition at line 29 of file lintree.h.

## memory

std::string& LinTree::LinTree::memory

private

Definition at line 26 of file lintree.h.

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

- Singular/dyn_modules/systhreads/lintree.h
- Singular/dyn_modules/systhreads/lintree.cc