📄 mm_size_0.cc
字号:
// file: mm_size_0.cc//// isip include files//#include "memory_manager.h"#include "memory_manager_constants.h"#include <trace.h>#include <lex_node.h>#include <lattice_node.h>#include <lattice_path.h>#include <ngram_node.h>#include <hash_cell.h>#include <history.h>// method: size_cc//// arguments: none//// return: an int_4 with number of bytes used by this object//// this method counts the size of the current object in bytes//int_4 Memory_manager::size_cc() { // set the size variable // int_4 size = (int_4)0; // add the size of each constituent data // size += sizeof(int_4); // node_count_d size += sizeof(int_4); // trace_count_d size += sizeof(int_4); // lex_count_d size += sizeof(int_4); // lat_count_d size += sizeof(int_4); // lpath_count_d size += sizeof(int_4); // ngram_count_d size += sizeof(int_4); // hash_count_d size += sizeof(int_4); // hist_count_d size += sizeof(int_4); // instance_count_d size += sizeof(int_4); // num_node_d size += sizeof(int_4); // num_trace_d size += sizeof(int_4); // num_lex_d size += sizeof(int_4); // num_lat_d size += sizeof(int_4); // num_lpath_d size += sizeof(int_4); // num_ngram_d size += sizeof(int_4); // num_hash_d size += sizeof(int_4); // num_hist_d size += sizeof(int_4); // num_instance_d size += sizeof(int_4); // node_grow_size_d size += sizeof(int_4); // trace_grow_size_d size += sizeof(int_4); // lex_grow_size_d size += sizeof(int_4); // lat_grow_size_d size += sizeof(int_4); // lpath_grow_size_d size += sizeof(int_4); // ngram_grow_size_d size += sizeof(int_4); // hash_grow_size_d size += sizeof(int_4); // hist_grow_size_d size += sizeof(int_4); // instance_grow_size_d // add the sizes of the free links // Link_node* node = node_list_d; if (node_count_d > (int_4)0) { size += node_count_d * node->size_cc(); } // add the sizes of the free traces // node = trace_list_d; if (trace_count_d > (int_4)0) { Trace* tr = (Trace*)(node->get_item_cc()); size += trace_count_d * node->size_cc(); size += trace_count_d * tr->size_cc(); } // add the sizes of the free lexical nodes // node = lex_list_d; if (lex_count_d > (int_4)0) { Lex_node* lxn = (Lex_node*)(node->get_item_cc()); size += lex_count_d * node->size_cc(); size += lex_count_d * lxn->size_cc(); } // add the sizes of the free lattice nodes // node = lat_list_d; if (lat_count_d > (int_4)0) { Lattice_node* ltn = (Lattice_node*)(node->get_item_cc()); size += lat_count_d * node->size_cc(); size += lat_count_d * ltn->size_cc(); } // add the sizes of the free path lattice nodes // node = lpath_list_d; if (lpath_count_d > (int_4)0) { Lattice_path* lpth = (Lattice_path*)(node->get_item_cc()); size += lpath_count_d * node->size_cc(); size += lpath_count_d * lpth->size_cc(); } // add the sizes of the free ngram nodes // node = ngram_list_d; if (ngram_count_d > (int_4)0) { Ngram_node* ngn = (Ngram_node*)(node->get_item_cc()); size += ngram_count_d * node->size_cc(); size += ngram_count_d * ngn->size_cc(); } // add the sizes of the free hash table cells // node = hash_list_d; if (hash_count_d > (int_4)0) { Hash_cell* hcell = (Hash_cell*)(node->get_item_cc()); size += hash_count_d * node->size_cc(); size += hash_count_d * hcell->size_cc(); } // add the sizes of the free history nodes // node = hist_list_d; if (hist_count_d > (int_4)0) { History* hist = (History*)(node->get_item_cc()); size += hist_count_d * node->size_cc(); size += hist_count_d * hist->size_cc(); } // add the sizes of the free instance nodes // node = instance_list_d; if (instance_count_d > (int_4)0) { Instance* inst = (Instance*)(node->get_item_cc()); size += instance_count_d * node->size_cc(); size += instance_count_d * inst->size_cc(); } // exit gracefully // return size;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -