section.cc

来自「由matlab开发的hybrid系统的描述语言」· CC 代码 · 共 109 行

CC
109
字号
#include "Section.h"#include "Item.h"#include "Symbol_table.h"#include "MLD_representation.h"#include "Globals.h"Section::Section(list < Item * > * l, string name, const Globals * glob) {	content = l;	globals = glob;	Section::name = name;}Section::~Section() {	for (content_iter iter = content->begin(); iter != content->end();		iter++)delete(* iter);	content->clear();}MLD_representation * Section::translate_MLD() const {	content_iter iter;	MLD_representation * res;	res = new MLD_representation(globals);	for (iter = content->begin(); iter != content->end(); iter++) {		res->merge((* iter)->translate_MLD());	}	return res;}/** really returns a Section*, and not a subclass. * If this is a problem, overwrite unroll in the subclass */Section * Section::unroll() {	content_iter iter;	list < Item * > * lst, extra_items;	Section * res;	lst = new list < Item * >;	for (iter = content->begin(); iter != content->end(); iter++) {		extra_items = (* iter)->unroll();		lst->insert(lst->end(), extra_items.begin(),			extra_items.end());		extra_items.clear(); // shallow	}	if (!lst->empty()) {		res = new Section(lst, unrolled_section_name(), globals);		res->propagate_section();		return res;	} else {		return NULL;	}}void Section::compute_minmaxeps() {	content_iter iter;	for (iter = content->begin(); iter != content->end(); iter++) {		(* iter)->compute_minmaxeps();	}}void Section::comp_group_numbers() {	content_iter iter;	for (iter = content->begin(); iter != content->end(); iter++) {		(* iter)->comp_group_numbers();	}}string Section::unrolled_section_name() const {	string res;	res += "unrolled from ";	res += name;	return res;}void Section::propagate_section() {	content_iter iter;	for (iter = content->begin(); iter != content->end(); iter++) {	  if (!(*iter)->section_set())		(* iter)->set_section(this);	}}void Section::semantic_checks() {	content_iter iter;	for (iter = content->begin(); iter != content->end(); iter++) {		(* iter)->semantic_checks();	}}string Section::arg_range_check_matlab() const {	string res;	content_iter iter;	for (iter = content->begin(); iter != content->end(); iter++) {		res += (* iter)->arg_range_check_matlab();	}	return res;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?