当前位置: 首页>>代码示例>>C++>>正文


C++ Translator::set_callsite_mode方法代码示例

本文整理汇总了C++中Translator::set_callsite_mode方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::set_callsite_mode方法的具体用法?C++ Translator::set_callsite_mode怎么用?C++ Translator::set_callsite_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Translator的用法示例。


在下文中一共展示了Translator::set_callsite_mode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {
  if (argc < 2) {
    usage();
  }

  get_args(&argc, &argv);
  translator.set_callsite_mode(true);  // translate callsites, not raw addrs.

  for (int i=0; i < argc; i++) {
    ifstream comp_file(argv[i]);
    if (comp_file.fail()) {
      cerr << "Unable to open file: '" << argv[i] << "'" << endl;
      exit(1);
    }

    // try to find frame info database based on location of first effort file
    // fail if it's not found and we can't look up the symbols with SymtabAPI
    if (translate) {
      string dir(dirname(argv[i]));
      ostringstream path;
      path << dir << "/viewer-data/symtab";
      frames.reset(FrameDB::load_from_file(path.str()));
    }

    effort_key key;
    ezw_header header;

    effort_key::read_in(comp_file, key);    
    ezw_header::read_in(comp_file, header);

    if (stage == none) {      // no parameters
      write_metadata(cout, key, header);
      continue;
    }

    string metric;
    int type, number;
    if (!parse_filename(argv[i], &metric, &type, &number)) {
      cerr << "Invalid effort file: " << argv[i] << endl;
      exit(1);
    }
    
    ostringstream sufstr;
    sufstr << "-" << metric << "-" << type << "-" << number;
    string suffix = sufstr.str();

    if (stage & metadata) {      // output metadata to a file.
      ostringstream mdname;
      mdname <<  "md" << suffix;
      ofstream mdfile(mdname.str().c_str());
      write_metadata(mdfile, key, header);
    }

    if (stage < wt_coeff) return 0;
    // Do EZW decoding to get wavelet coefficients
    wavelet::wt_matrix reconstruction;
    ezw_decoder decoder;

    // Use the decode level in the header by default for both ezw and iwt.
    if (iwt_level < 0) iwt_level = header.level;

    if (reduce) {
      // if we're reducing the size of the output, we need to tell the decoder
      // to create a matrix to hold only the inverse-transformed levels.
      iwt_level = decoder.decode(comp_file, reconstruction, iwt_level, &header);

    } else {
      // if not, then we do a full ezw decode with the level of the forward transform
      // Don't set the IWT level, though.  The user may still want fewer inverse
      // transforms but full size data.
      decoder.decode(comp_file, reconstruction, header.level, &header);
    }


    if (stage & wt_coeff) {
      ostringstream matname;
      matname <<  "wt" << suffix;
      ofstream wtfile(matname.str().c_str());
      output(reconstruction, wtfile);
    }

    if (stage < reconstruct) return 0;

    // Do iwt for full reconstruction.
    wt_direct dwt;
    dwt.iwt_2d(reconstruction, iwt_level);
    
    if (stage & reconstruct) {
      ostringstream matname;
      matname <<  "recon" << suffix;
      ofstream reconfile(matname.str().c_str());
      output(reconstruction, reconfile);
    }
  }

  return 0;
}
开发者ID:cmcantalupo,项目名称:libra,代码行数:97,代码来源:ef.C


注:本文中的Translator::set_callsite_mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。