⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constants.cc

📁 模拟器提供了一个简单易用的平台
💻 CC
字号:
static char rcsid [] = "$Id: constants.cc,v 1.1 2001/08/07 22:05:05 suman Exp suman $";/* * $Log: constants.cc,v $ * Revision 1.1  2001/08/07 22:05:05  suman * Initial revision * *//* * File: constants.cc * Author: Suman Banerjee <suman@cs.umd.edu> * Date: July 31, 2001 * Terms: GPL * * myns simulator *//*#include <string.h>#include <assert.h>*/#include <constants.h>int NamedConstant::const_id_gen = 0;LinkedList<NamedConstant*,int> NamedConstant::constant_list;/*LinkedList<void *, int> constant_list;int get_next_constant_id (void) {  int ret_val = const_id_gen++;  return ret_val;}void add_to_constant_list (void * const_ptr, int id) {  constant_list.Add(const_ptr,id);  return;}void delete_from_constant_list (int id) {  void * pos = constant_list.Locate(id);  assert (pos != NULL);  constant_list.RemoveAt(pos);}template<class ConstType>void Constant<ConstType>::setval(char * Cname, ConstType val) {  bool found = false;  for (void * pos = constant_list.GetHeadPosition();       pos != NULL;       constant_list.GetNext(pos) ) {    Constant<ConstType> * this_const = constant_list.GetAt(pos);    assert (this_const != NULL);    if (strcmp(this_const->cname,Cname) == 0) {      this_const->val = Val;      found = true;      break;    }  }  assert (found == true);  return;}void constant_setval(char * Cname, int ival, double dval, bool is_int) {  bool found = false;  for (void * pos = constant_list.GetHeadPosition();       pos != NULL;       constant_list.GetNext(pos) ) {    void* this_const = (void*)(constant_list.GetAt(pos));    assert (this_const != NULL);    if (strcmp(((Constant<int>*)this_const)->cname,Cname) == 0) {      if (is_int == true)        ((Constant<int>*)this_const)->val = ival;      else        ((Constant<double>*)this_const)->val = dval;      found = true;      break;    }  }  assert (found == true);  return;}*/

⌨️ 快捷键说明

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