1 #ifndef CONNECT___NCBI_FILE_CONNECTOR__H 2 #define CONNECT___NCBI_FILE_CONNECTOR__H 3 4 /* $Id: ncbi_file_connector.h 350425 2012-01-20 14:54:01Z lavr $ 5 * =========================================================================== 6 * 7 * PUBLIC DOMAIN NOTICE 8 * National Center for Biotechnology Information 9 * 10 * This software/database is a "United States Government Work" under the 11 * terms of the United States Copyright Act. It was written as part of 12 * the author's official duties as a United States Government employee and 13 * thus cannot be copyrighted. This software/database is freely available 14 * to the public for use. The National Library of Medicine and the U.S. 15 * Government have not placed any restriction on its use or reproduction. 16 * 17 * Although all reasonable efforts have been taken to ensure the accuracy 18 * and reliability of the software and data, the NLM and the U.S. 19 * Government do not and cannot warrant the performance or results that 20 * may be obtained by using this software or data. The NLM and the U.S. 21 * Government disclaim all warranties, express or implied, including 22 * warranties of performance, merchantability or fitness for any particular 23 * purpose. 24 * 25 * Please cite the author in any work or product based on this material. 26 * 27 * =========================================================================== 28 * 29 * Authors: Vladimir Alekseyev, Denis Vakatov 30 * 31 * File Description: 32 * Implement CONNECTOR for a FILE stream 33 * 34 * See in "connectr.h" for the detailed specification of the underlying 35 * connector("CONNECTOR", "SConnectorTag") methods and structures. 36 * 37 */ 38 39 #include <connect/ncbi_connector.h> 40 41 42 /** @addtogroup Connectors 43 * 44 * @{ 45 */ 46 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 53 /* Create new CONNECTOR structure to handle a data transfer between two files 54 * (equivalent to FILE_CreateConnectorEx(.,.,NULL)). 55 * Can have either ifname or ofname (not both!) as NULL or empty causing 56 * either no input or no output available, respectively. 57 * Return NULL on error. 58 */ 59 extern NCBI_XCONNECT_EXPORT CONNECTOR FILE_CreateConnector 60 (const char* ifname, /* to read data from */ 61 const char* ofname /* to write the read data to */ 62 ); 63 64 65 /* Open mode for the output data file 66 */ 67 typedef enum { 68 eFCM_Truncate, /* create new or replace existing file */ 69 eFCM_Append, /* add at the end of file */ 70 eFCM_Seek /* seek to specified position before doing first I/O */ 71 } EFILE_ConnMode; 72 73 74 /* Extended file connector attributes 75 */ 76 typedef struct { 77 EFILE_ConnMode w_mode; /* how to open output file */ 78 TNCBI_BigCount w_pos; /* eFCM_Seek only: begin to write at "w_pos" */ 79 TNCBI_BigCount r_pos; /* file position to start reading at */ 80 } SFILE_ConnAttr; 81 82 83 /* An extended version of FILE_CreateConnector(). 84 */ 85 extern NCBI_XCONNECT_EXPORT CONNECTOR FILE_CreateConnectorEx 86 (const char* ifname, 87 const char* ofname, 88 const SFILE_ConnAttr* attr 89 ); 90 91 92 #ifdef __cplusplus 93 } /* extern "C" */ 94 #endif 95 96 97 /* @} */ 98 99 #endif /* CONNECT___NCBI_FILE_CONNECTOR__H */ 100