📄 tr_mm_size_0.cc
字号:
// file: tr_mm_size_0.cc//// isip include files//#include "train_memory_manager.h"#include "train_memory_manager_constants.h"#include <train_trace.h>#include <train_lex_node.h>#include <train_lattice_node.h>#include <train_hash_cell.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 Train_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); // hash_count_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); // hash_grow_size_d // add the sizes of the free links // Train_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) { Train_Trace* tr = (Train_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) { Train_Lex_node* lxn = (Train_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) { Train_Lattice_node* ltn = (Train_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 hash table cells // node = hash_list_d; if (hash_count_d > (int_4)0) { Train_Hash_cell* hcell = (Train_Hash_cell*)(node->get_item_cc()); size += hash_count_d * node->size_cc(); size += hash_count_d * hcell->size_cc(); } // exit gracefully // return size;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -