本网站可以出售:只需60000元直接拥有。QQ:939804642
您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ LEMUR_THROW函数代码示例

51自学网 2021-06-01 21:50:19
  C++
这篇教程C++ LEMUR_THROW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中LEMUR_THROW函数的典型用法代码示例。如果您正苦于以下问题:C++ LEMUR_THROW函数的具体用法?C++ LEMUR_THROW怎么用?C++ LEMUR_THROW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: sd

void indri::file::Path::remove( const std::string& path ) {  std::stack<indri::file::DirectoryIterator*> iterators;  indri::utility::StackDeleter<indri::file::DirectoryIterator> sd( iterators );  iterators.push( new indri::file::DirectoryIterator( path ) );  while( iterators.size() ) {    indri::file::DirectoryIterator* top = iterators.top();        // all done, so go up a level    if( (*top) == indri::file::DirectoryIterator::end() ) {      // release any search handles that may point      // to this directory      top->close();      int result = rmdir( top->base().c_str() );      if( result != 0 )        LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove directory '" + top->base() + "'." );      delete top;      iterators.pop();      continue;    }    std::string path = **top;    (*top)++;    if( indri::file::Path::isFile( path ) ) {      int result = lemur_compat::remove( path.c_str() );      if( result != 0 )        LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove file '" + path + "'." );    } else {      iterators.push( new indri::file::DirectoryIterator( path ) );    }  }}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:35,


示例2: LEMUR_THROW

void indri::file::Path::rename( const std::string& oldName, const std::string& newName ) {#ifndef WIN32  int result = ::rename( oldName.c_str(), newName.c_str() );  if( result != 0 ) {    if( errno == EEXIST ) {      LEMUR_THROW( LEMUR_IO_ERROR, "The destination file already exists: " + oldName );    } else if( errno == EACCES || errno == EPERM ) {      LEMUR_THROW( LEMUR_IO_ERROR, "Insufficient permissions to rename: '" + oldName + "' to '" + newName + "'." );    } else {      LEMUR_THROW( LEMUR_IO_ERROR, "Unable to rename: '" + oldName + "' to '" + newName + "'." );    }  }#else  BOOL result;  if( Path::exists( newName ) ) {    result = ReplaceFile( newName.c_str(), oldName.c_str(), NULL, REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL );  } else {    result = MoveFile( oldName.c_str(), newName.c_str() );  }  if( !result ) {    LEMUR_THROW( LEMUR_IO_ERROR, "Unable to rename: '" + oldName + "' to '" + newName + "'." );  }#endif}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:27,


示例3: listen

      bool listen( unsigned int port ) {        int result;         lemur_compat::initializeNetwork();        _socket = ::socket( AF_INET, SOCK_STREAM, 0 );        sockaddr_in sa;        sa.sin_addr.s_addr = INADDR_ANY;        sa.sin_port = htons(port);        sa.sin_family = AF_INET;        memset( &sa.sin_zero, 0, sizeof sa.sin_zero );        result = ::bind( _socket, (const sockaddr*) &sa, sizeof sa );        if( result ) {          close();          LEMUR_THROW( LEMUR_IO_ERROR, "Wasn't able to bind port " + i64_to_string(port) );        }          result = ::listen( _socket, 8 );        if( result ) {          close();          LEMUR_THROW( LEMUR_IO_ERROR, "Wasn't able to listen on port " + i64_to_string(port) );        }        return true;      }
开发者ID:blaze3j,项目名称:DocHunt,代码行数:27,


示例4: _tryFindBeginTag

void indri::xml::XMLReader::_read( indri::xml::XMLNode** parent, const char* buffer, int start, int end ) {  int tagType;  for( int current = _tryFindBeginTag( buffer, start, end );       current >= 0;       current = _tryFindBeginTag( buffer, current, end ) ) {    indri::xml::XMLNode* node;    std::string tagName;    std::map<std::string, std::string> attributes;    bool tagsBetween;    int endLevel;    int endTag = _readTag( buffer, current, end, &tagName, &attributes, &tagType );    if( tagType == TAG_CLOSE_TYPE )      LEMUR_THROW( LEMUR_GENERIC_ERROR, "Found a close tag for '" + tagName + "' while looking for an open tag." );    if( tagType == TAG_OPEN_TYPE ) {      int closingTag = _findClosingTag( buffer, endTag, end, tagName, &tagsBetween );      if( closingTag == -1 )        LEMUR_THROW( LEMUR_GENERIC_ERROR, "Could not find a close tag for '" + tagName + "'");      if( tagsBetween ) {        node = new indri::xml::XMLNode( tagName, attributes );        _read( &node, buffer, endTag, closingTag );      } else {        std::string nodeValue;        nodeValue.assign( &buffer[endTag], &buffer[closingTag] );         std::string::size_type dataStart = nodeValue.find("<!CDATA[");        while (dataStart != std::string::npos) {                    // munch any CDATA tags in the element's value.          nodeValue.erase(dataStart, 8);          std::string::size_type dataEnd = nodeValue.find("]]>");          if (dataEnd != std::string::npos)             nodeValue.erase(dataEnd, 3);          // else bad things here, should throw.          dataStart = nodeValue.find("<!CDATA[");        }        node = new indri::xml::XMLNode( tagName, attributes, nodeValue );      }      endLevel = _findEndTag( buffer, closingTag, end )+1;    } else {      assert( tagType == TAG_OPEN_CLOSE_TYPE );      node = new indri::xml::XMLNode( tagName, attributes );      endLevel = endTag;    }    if( *parent ) {      (*parent)->addChild( node );    } else {      *parent = node;      break;    }    current = endLevel;  }}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:58,


示例5: LEMUR_THROW

int indri::xml::XMLReader::_findNotName( const char* buffer, int start, int finish ) {  int i;  for( i=start; i<finish; i++ ) {    // this isn't unicode-safe, but it should be good for now#ifndef WIN32    if( !isalpha(buffer[i]) &&         !isdigit(buffer[i]) &&#else    if( (buffer[i] >= 0 && !isalpha(buffer[i])) &&         (buffer[i] >= 0 && !isdigit(buffer[i])) &&#endif        buffer[i] != '-' &&        buffer[i] != '_' &&        buffer[i] != ':' &&        buffer[i] != '.' ) {      break;    }  }  if( i==finish )    LEMUR_THROW( LEMUR_PARSE_ERROR, "Was looking for the end of a tag name, but couldn't find it." );  return i;}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:25,


示例6: _tryFindText

int indri::xml::XMLReader::_findText( const char* buffer, int start, int finish ) {  int result = _tryFindText( buffer, start, finish );  if( result==finish )    LEMUR_THROW( LEMUR_GENERIC_ERROR, "Was looking for text, but couldn't find any" );  return result;}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:7,


示例7: zlib_deflate

static void zlib_deflate( z_stream_s& stream, indri::file::SequentialWriteBuffer* outfile ) {  if( stream.avail_in == 0 ) {    // nothing to do...    return;  }    if( stream.avail_out == 0 ) {    stream.next_out = (Bytef*) outfile->write( OUTPUT_BUFFER_SIZE );    stream.avail_out = OUTPUT_BUFFER_SIZE;  }  int result = deflate( &stream, 0 );  // if we're fine, then just return (common case)  while( result != Z_OK || stream.avail_in != 0 ) {    // either we need more space, or an error happened    if( result != Z_OK ) {      LEMUR_THROW( LEMUR_IO_ERROR, "Tried to add a document to the collection, but zlib returned an error" );    }    // get more space    stream.next_out = (Bytef*) outfile->write( OUTPUT_BUFFER_SIZE );    stream.avail_out = OUTPUT_BUFFER_SIZE;      result = deflate( &stream, 0 );  }}
开发者ID:busjaeger,项目名称:cs410sp12,代码行数:27,


示例8: _getParsingContext

lemur::api::DOCID_T indri::api::IndexEnvironment::addString( const std::string& documentString, const std::string& fileClass, const std::vector<indri::parse::MetadataPair>& metadata ) {  indri::parse::UnparsedDocument document;  indri::parse::Parser* parser;  indri::parse::Tokenizer* tokenizer;  indri::parse::DocumentIterator* iterator;  indri::parse::Conflater* conflater;  std::string nothing;  _documentsSeen++;  document.text = documentString.c_str();  document.textLength = documentString.length() + 1; // for the null  document.metadata = metadata;  document.content = document.text;  document.contentLength = document.textLength - 1;    _getParsingContext( &parser, &tokenizer, &iterator, &conflater, fileClass );  if( parser == 0 ) {    LEMUR_THROW( LEMUR_RUNTIME_ERROR, "File class '" + fileClass + "' wasn't recognized." );  }  indri::parse::TokenizedDocument* tokenized = tokenizer->tokenize( &document );  ParsedDocument* parsed = parser->parse( tokenized );  lemur::api::DOCID_T documentID =_repository.addDocument( parsed );  _documentsIndexed++;  if( _callback ) (*_callback)( indri::api::IndexStatus::DocumentCount, nothing, _error, _documentsIndexed, _documentsSeen );  return documentID;}
开发者ID:fedorn,项目名称:lemur,代码行数:31,


示例9: LEMUR_THROW

void indri::api::Parameters::loadFile( const std::string& filename ) {  std::ifstream input;  indri::xml::XMLReader reader;    input.open( filename.c_str(), std::ifstream::in );  if( input.rdstate() & std::ios::failbit )    LEMUR_THROW( LEMUR_IO_ERROR, "Couldn't open parameter file '" + filename + "' for reading." );  input.seekg( 0, std::ios::end );  size_t length = input.tellg();  input.seekg( 0, std::ios::beg );  // null terminate it to make a string in the XML reader for comment strip  char* buffer = new char[length + 1];  buffer[length] = '/0';  try {    input.read( buffer, length );    std::auto_ptr<indri::xml::XMLNode> result( reader.read( buffer, length ) );    _loadXML( result.get() );  } catch( lemur::api::Exception& e ) {    LEMUR_RETHROW( e, "Had trouble parsing parameter file '" + filename + "'" );  }  delete[] buffer;  input.close();}
开发者ID:Peilin-Yang,项目名称:MinRunQuery,代码行数:28,


示例10: LEMUR_THROW

int indri::collection::Repository::addDocument(indri::api::ParsedDocument* document, bool inCollection) {  if (_readOnly)    LEMUR_THROW(LEMUR_RUNTIME_ERROR, "addDocument: Cannot add documents to a repository that is opened for read-only access.");   while (_thrashing) {    indri::thread::Thread::sleep(100);  }  indri::thread::ScopedLock lock(_addLock);  for(size_t i=0; i<_transformations.size(); i++) {    document = _transformations[i]->transform(document);  }  index_state state;  {     // get a copy of current index state    indri::thread::ScopedLock stateLock(_stateLock);    state = _active;  }  int documentID = dynamic_cast<indri::index::MemoryIndex*>(state->back())->addDocument(*document);  if (inCollection) _collection->addDocument(documentID, document);  _countDocumentAdd();  return documentID;}
开发者ID:wangxuemin,项目名称:coding,代码行数:28,


示例11: LEMUR_THROW

void indri::infnet::InferenceNetwork::_indexChanged( indri::index::Index& index ) {  _closeIterators.clear();  _closeIteratorBound = -1;  // doc iterators  for( size_t i=0; i<_termNames.size(); i++ ) {    indri::index::DocListIterator* iterator = index.docListIterator( _termNames[i] );    if( iterator )      iterator->startIteration();    _docIterators.push_back( iterator );  }  // field iterators  for( size_t i=0; i<_fieldNames.size(); i++ ) {    indri::index::DocExtentListIterator* iterator = index.fieldListIterator( _fieldNames[i] );    if( iterator )      iterator->startIteration();    _fieldIterators.push_back( iterator );  }    // prior iterators  for( size_t i=0; i<_priorNames.size(); i++ ) {    // TODO: this is wasteful, since the prior is associated with the whole collection,    // there's no need to fetch it for each index.  but, it's just easier to code it like this for now    indri::collection::PriorListIterator* iterator = _repository.priorListIterator( _priorNames[i] );    if( iterator )      iterator->startIteration();    else {      // if the named prior doesn't exist in the Repository, throw an Exception      LEMUR_THROW( LEMUR_RUNTIME_ERROR, "named prior: " + _priorNames[i] + " not found in Repository. Unable to process query." );    }    _priorIterators.push_back( iterator );  }  // extent iterator nodes  std::vector<ListIteratorNode*>::iterator diter;  for( diter = _listIteratorNodes.begin(); diter != _listIteratorNodes.end(); diter++ ) {    (*diter)->indexChanged( index );  }  // belief nodes  std::vector<BeliefNode*>::iterator biter;  for( biter = _beliefNodes.begin(); biter != _beliefNodes.end(); biter++ ) {    (*biter)->indexChanged( index );  }  // evaluator nodes  std::vector<indri::infnet::EvaluatorNode*>::iterator eiter;  for( eiter = _evaluators.begin(); eiter != _evaluators.end(); eiter++ ) {    (*eiter)->indexChanged( index );  }  // document structure  if (_documentStructureHolderNode != 0) {    _documentStructureHolderNode->indexChanged( index );  }}
开发者ID:fedorn,项目名称:lemur,代码行数:60,


示例12: preferredName

indri::parse::DocumentIterator* indri::parse::DocumentIteratorFactory::get( const std::string& type, const char* startDocTag, const char* endDocTag, const char* startMetadataTag ) {  std::string preferred = preferredName( type );  indri::parse::DocumentIterator* result = 0;  if( preferred == TYPE_TAGGED ) {    indri::parse::TaggedDocumentIterator* iter = new indri::parse::TaggedDocumentIterator();    iter->setTags( startDocTag, endDocTag, startMetadataTag );    result = iter;  } else if( preferred == TYPE_WARC ) {    result = new indri::parse::WARCDocumentIterator();  } else if( preferred == TYPE_PDF ) {    result = new indri::parse::PDFDocumentExtractor();  } else if( preferred == TYPE_TEXT ) {    result = new indri::parse::TextDocumentExtractor();  } else if( preferred == TYPE_MBOX ) {    result = new indri::parse::MboxDocumentIterator();  }#ifdef WIN32  else if( preferred == TYPE_WORD ) {    result = new indri::parse::WordDocumentExtractor();  } else if( preferred == TYPE_PPT ) {    result = new indri::parse::PowerPointDocumentExtractor();  }#endif  if( !result )    LEMUR_THROW( LEMUR_RUNTIME_ERROR, type + " is an unknown DocumentIterator type." );  return result;}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:30,


示例13: gzopen

void indri::parse::TextDocumentExtractor::open( const std::string& filename ) {  _in = gzopen( filename.c_str(), "rb" );  _filename = filename;  if( !_in )    LEMUR_THROW( LEMUR_IO_ERROR, "Couldn't open file " + filename + "." );}
开发者ID:brianolsen87,项目名称:SearchProjects,代码行数:7,


示例14: zlib_read_document

static void zlib_read_document( z_stream_s& stream, indri::file::File& infile, UINT64 offset, indri::utility::Buffer& outputBuffer ) {  // read in data from the file until the stream ends  // split up the data as necessary  // decompress positional info  // read some data  char inputBuffer[INPUT_BUFFER_SIZE];  outputBuffer.grow( INPUT_BUFFER_SIZE );  outputBuffer.write( sizeof(indri::api::ParsedDocument) );  stream.avail_in = 0;  stream.avail_out = 0;    while(true) {    if( !stream.avail_in ) {      UINT64 readSize = infile.read( inputBuffer, offset, sizeof inputBuffer );      offset += readSize;             stream.avail_in = readSize;      stream.next_in = (Bytef*) inputBuffer;    }    stream.avail_out = outputBuffer.size() - outputBuffer.position();    stream.next_out = (Bytef*) outputBuffer.write( outputBuffer.size() - outputBuffer.position() );    int result = inflate( &stream, Z_NO_FLUSH );    outputBuffer.unwrite( stream.avail_out );    if( result == Z_STREAM_END ) {      result = inflate( &stream, Z_FINISH );            if( result < 0 )        LEMUR_THROW( result, "Something bad happened while trying to finish decompressing a document." );      inflateEnd( &stream );      break;    }    if( result < 0 ) {      LEMUR_THROW( result, "Something bad happened while trying to decompress a document." );    }    if( stream.avail_out == 0 ) {      outputBuffer.grow();    }  }}
开发者ID:busjaeger,项目名称:cs410sp12,代码行数:47,


示例15: LEMUR_THROW

void indri::parse::MboxDocumentIterator::open( const std::string& filename ) {  _in.clear();  _in.open( filename.c_str() );  _filename = filename;  if( !_in.good() )    LEMUR_THROW( LEMUR_IO_ERROR, "Couldn't open file " + filename + "." );}
开发者ID:wangxuemin,项目名称:coding,代码行数:8,


示例16: while

void indri::net::XMLReplyReceiver::wait( indri::net::NetworkMessageStream* stream ) {  while( !done() && stream->alive() && !_exception.size() ) {    stream->read(*this);  }    if( _exception.size() )    LEMUR_THROW( LEMUR_NETWORK_ERROR, _exception );}
开发者ID:wangxuemin,项目名称:coding,代码行数:8,


示例17: _tryFindChar

int indri::xml::XMLReader::_findChar( char ch, const char* buffer, int start, int finish ) {  int result = _tryFindChar( ch, buffer, start, finish );  if( result == -1 )    LEMUR_THROW( LEMUR_PARSE_ERROR, "Was looking for '" + ch + "', but couldn't find it." );  return result;}
开发者ID:cjaneyes,项目名称:cjaneyes.github.io,代码行数:8,


示例18: getResults

      indri::infnet::InferenceNetwork::MAllResults& getResults() {        while( !_done && _stream->alive() && !_exception.length() )          _stream->read(*this);        if( _exception.length() )          LEMUR_THROW( LEMUR_RUNTIME_ERROR, _exception );            return _results;      }
开发者ID:jsc,项目名称:indri-5.9,代码行数:9,


示例19: _buildHandle

void lemur::file::Keyfile::create( const char* filename, int cacheSize ) {  _buildHandle( cacheSize );    int error = create_key( _handle, const_cast<char*>(filename),                           _handleSize );  if( error )    LEMUR_THROW(LEMUR_KEYFILE_IO_ERROR, "Unable to create '" + filename + "'");}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:9,


示例20: assert

void lemur::file::Keyfile::remove( const char* key ) {  assert( key && "key cannot be null" );  assert( _handle && "call open() or create() first" );  int len = strlen(key); // fix for UTF-8  int error = delete_rec( _handle, const_cast<char*>(key), len );  if( error )    LEMUR_THROW( LEMUR_KEYFILE_IO_ERROR, "Unable to delete record for key: " + key );}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:9,


示例21: assert

indri::api::Parameters indri::api::Parameters::get( const std::string& name ) {  assert( exists(name) );  if( ! exists(name) )    LEMUR_THROW( LEMUR_IO_ERROR, "Required parameter '" + name + "' was not specified." );  parameter_value* root = _getRoot();  parameter_value* current = _getPath(name, root);  return indri::api::Parameters( current );}
开发者ID:Peilin-Yang,项目名称:MinRunQuery,代码行数:10,


示例22: gzopen

void indri::parse::WARCDocumentIterator::open( const std::string& filename ) {    _gzin = gzopen(filename.c_str(), "rb");  if( !_gzin)    LEMUR_THROW( LEMUR_IO_ERROR, "Couldn't open file " + filename + "." );  _record = new WARCRecord(_gzin, _buffer);  // Consume the first WARC record (type warcinfo)  // verify the WARC-Type is warcinfo  // if not, it's a partial file or broken... bleah.  bool read = _record->readRecord();  if ( ! read ) {    LEMUR_THROW(LEMUR_IO_ERROR, "Bad WARC file." );  }  std::string warcType = _record->getWarcType();  if ( warcType != "warcinfo" ) {    LEMUR_THROW(LEMUR_IO_ERROR, "Bad WARC file." );  }  _warcUUID = _record->getUUID();  // file pointer is now positioned to read the first response record.}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:19,


示例23: fopen

void lemur::file::SortMergeTextFiles::_doSingleFileMergesort(std::string &inputFile, std::string &outputFile, std::vector<std::string> &chunkList, int chunkRecordSize) {  // our in-memory chunks  std::vector<std::string> inMemoryChunk;  inMemoryChunk.reserve(chunkRecordSize);  int currentChunkRecord=0;  // clear the input buffer  _inputBuffer.clear();  FILE* _in;  _in = fopen( inputFile.c_str(), "rb" );  if( !_in ) {    LEMUR_THROW( LEMUR_IO_ERROR, "Couldn't open file " + inputFile + "." );  }  // reset the buffer size  //  setvbuf(_in, NULL, _IOFBF, 65536);  setvbuf(_in, NULL, _IOFBF, 5*1024*1024);  std::vector<std::string> outputChunks;  int countInputRecords=0;  char* thisLine;  size_t lineLength;  while (_readLine(_in,  thisLine, lineLength, _inputBuffer)) {    if (currentChunkRecord==chunkRecordSize) {      chunkList.push_back(_flushChunks(outputFile, &inMemoryChunk, chunkList.size()));      inMemoryChunk.clear();      currentChunkRecord=0;    }    // straight fill-up the buffer    if ((lineLength > 0) && (thisLine)) {      inMemoryChunk.push_back(std::string(thisLine));      // increment our counters      ++currentChunkRecord;      ++countInputRecords;    }  }  if (currentChunkRecord > 0) {    chunkList.push_back(_flushChunks(outputFile, &inMemoryChunk, chunkList.size()));  }  // close the input file, we're done with it  fclose(_in);  // now, merge sort the chunks  // _doFinalMergesortFiles(outputChunks, outputFile);}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:54,


示例24: LEMUR_THROW

void indri::index::DeletedDocumentList::read( const std::string& filename ) {  indri::file::File file;  if( !file.openRead( filename ) )    LEMUR_THROW( LEMUR_IO_ERROR, "Unable to open file: " + filename );  UINT64 fileSize = file.size();  _bitmap.clear();  file.read( _bitmap.write( fileSize ), 0, fileSize );  file.close();}
开发者ID:busjaeger,项目名称:cs410sp12,代码行数:11,



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


C++ LEN函数代码示例
C++ LEGACY_FLOPPY_OPTIONS_NAME函数代码示例
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1