Delete tc_fifo.h

This commit is contained in:
Douwanna 2020-06-02 18:58:18 +08:00 committed by GitHub
parent 07f9dfa404
commit 8cb392152e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

161
tc_fifo.h
View File

@ -1,161 +0,0 @@
/**
* Tencent is pleased to support the open source community by making Tars available.
*
* Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
#ifndef __TC_FIFO_H
#define __TC_FIFO_H
#include "util/tc_platform.h"
#if TARGET_PLATFORM_LINUX || TARGET_PLATFORM_IOS
#include <string>
namespace tars
{
/////////////////////////////////////////////////
/**
*@file tc_fifo.h
*@brief FIFO封装类.
*@brief FIFO encapsulation class
*/
/////////////////////////////////////////////////
/**
*@brief .
*@brief Pipeline operation.
*/
class TC_Fifo
{
public:
/**
* @brief .
* EM_WRITEEM_READ
* @brief Enumeration types for pipeline operations
* Defines the type of operation on the pipeline, EM_ Write: write pipe, EM_ Read: read pipe
*/
enum ENUM_RW_SET
{
EM_WRITE = 1,
EM_READ = 2
};
public:
/**
* @brief .
* @brief Constructor
*
* @param bOwener : ture
* @param bOwener : Whether the pipeline is owned, the default is ture
*/
TC_Fifo(bool bOwener = true);
/**
* @brief .
* @brief Constructor
*/
~TC_Fifo();
public:
/**
* @brief FIFO.
* @brief Open FIFO
*
* @param sPath FIFO文件的路径
* @param sPath the file path of the FIFO to open
* @param enRW
* @param enRN Pipe opration type
* @param mode FIFO文件的权限
* @param mode The permissions of this FIFO file are read-write by default
* @return 0-,-1-
* @return 0 - successfull, -1 - failed
*/
int open(const std::string & sPath, ENUM_RW_SET enRW, mode_t mode = 0777);
/**
* @brief fifo
* @brief Close FIFO
*/
void close();
/**
* @brief FIFO的文件描述符.
* @brief Get the file descriptor of FIFO
*
* @return FIFO的文件描述符
* @return the file descriptor of FIFO
*/
int fd() const { return _fd; }
/**
* @brief , 00
* @brief read data, when read successfully, return the actual number of bytes read, if the value returned is 0, the end of the file has been read; less than 0 indicates an error
* @param buffer
* @param buffer the content to be read
* @param max_size
* @param max_size size of the data to be read
* @return ,0
* @return the length of the read data , if it is less then 0, read failed
*/
int read(char * szBuff, const size_t sizeMax);
/**
* @brief .
* @brief Write data to the pipeline
*
* @param szBuff
* @param szBuff data to be wrote
* @param sizeBuffLen
* @param sizeBuffLen size of data
* @return 0
* 0
* @return geater than 0: Some or all of the data are shown and written
* less than 0: Error
*/
int write(const char * szBuff, const size_t sizeBuffLen);
private:
/**
* FIFO文件的路径
* file path of FIFO
*/
std::string _sPathName;
/**
* FIFO
* whether it have FIFO
*/
bool _bOwner;
/**
* FIFO的文件的操作类型
* file opration type of FIFO
*/
ENUM_RW_SET _enRW;
/**
* FIFO的文件描述符
* file descriptor of FIFO
*/
int _fd;
};
}
#endif
#endif