📄 dtn_question_0.cc
字号:
// file: dtn_question_0.cc//// system include files//#include <string.h>// isip include files//#include "dt_node.h"#include "dt_node_constants.h"// method: ask_question_cc//// arguments:// Question* question : (input) question to ask// int_4 staet_index : (input) global state index// Hash_table* answer : (input) Hash_table with all the answer// int_4** l_context : (input) left context list// int_4** r_context : (input) right context list// return: a logical_1 inidicating if the answer is yes or no//// this method asks a question for a state//logical_1 Dt_node::ask_question_cc(Question* question_a, int_4 state_index_a, Hash_table* answer_a, int_4** l_context_a, int_4** r_context_a) { // local variables // char_1* key_string = new char_1[ISIP_MAX_STRING_LENGTH]; logical_1 tag_left; int_4 num; char_1* attribute; int_4 phn; char_1* dire= new char_1[2]; num = question_a->get_num_cc(); attribute = question_a->get_attribute_cc(); tag_left = question_a->get_direction_cc(); if(tag_left==ISIP_TRUE) { phn = l_context_a[state_index_a][num]; strcpy((char*)dire, "L"); } else{ phn = r_context_a[state_index_a][num]; strcpy((char*)dire, "R"); } // create the key string // sprintf((char*)key_string, "%ld", phn); strcat((char*)key_string, " "); strcat((char*)key_string, (char*)dire); strcat((char*)key_string, " "); strcat((char*)key_string, (char*)attribute); // loop up the answer // if((answer_a->hash_lookup_cc(key_string))==(Hash_cell*)NULL) { // free memory // delete [] key_string; delete [] dire; // exit gracefully with the answer no // return ISIP_FALSE; } // free memory // delete [] key_string; delete [] dire; // exit gracefully with the answer yes // return ISIP_TRUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -