示例#1
0
std::string
Avro2PBReader::read_next()
{
  if(!get_is_valid()){
    return "";
  }
  if(!avro_reader_){
    avro_reader_ = new t_avro_reader
      (avro_filenames_[cur_file_].c_str(),
       IMP::npctransport::get_avro_data_file_schema());
  }
  IMP_npctransport::wrapper data;

  if( ! (avro_reader_->read(data)) ){ // no more data = go to next
    advance_current_reader();
    return read_next();
  }
  return std::string(data.value.begin(), data.value.end());
}
示例#2
0
文件: Object.cpp 项目: newtonjoo/imp
Object::~Object() {
  IMP_INTERNAL_CHECK(
      get_is_valid(),
      "Object " << this << " previously freed "
                << "but something is trying to delete it again. Make sure "
                << "that all C++ code uses IMP::Pointer objects to"
                << " store it.");
#if IMP_HAS_CHECKS >= IMP_USAGE
  // if there is no exception currently being handled warn if it was not owned
  if (!was_owned_ && !std::uncaught_exception()) {
    IMP_WARN(
        "Object \"" << get_name() << "\" was never used."
                    << " See the IMP::Object documentation for an explanation."
                    << std::endl);
  }
#endif
#if IMP_HAS_CHECKS >= IMP_INTERNAL
  remove_live_object(this);
#endif
  IMP_LOG_MEMORY("Destroying object \"" << get_name() << "\" (" << this << ")"
                                        << std::endl);
#if IMP_HAS_LOG > IMP_NONE && !IMP_BASE_HAS_LOG4CXX
  // cleanup
  if (log_level_ != DEFAULT) {
    IMP::base::set_log_level(log_level_);
  }
#endif

  IMP_INTERNAL_CHECK(get_ref_count() == 0,
                     "Deleting object which still has references");
#if IMP_HAS_CHECKS >= IMP_USAGE
  check_value_ = 666666666;
#endif
#if IMP_HAS_CHECKS >= IMP_INTERNAL
  --live_objects_;
#endif
}