libassa
3.5.1
assa
Pipe.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// $Id: Pipe.h,v 1.3 2005/10/08 02:42:00 vlg Exp $
4
//------------------------------------------------------------------------------
5
// Pipe.h
6
//------------------------------------------------------------------------------
7
// Copyright (C) 1997-2002 Vladislav Grinchenko
8
//
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Library General Public
11
// License as published by the Free Software Foundation; either
12
// version 2 of the License, or (at your option) any later version.
13
//------------------------------------------------------------------------------
14
#ifndef PIPE_H
15
#define PIPE_H
16
17
#include <stdio.h>
18
#include <string>
19
20
#include "
assa/Logger.h
"
21
22
namespace
ASSA
{
23
28
class
Pipe
29
{
30
public
:
34
Pipe
();
35
39
~Pipe
();
40
56
FILE*
open
(
const
string
& cmd_,
const
string
& type_);
57
65
int
close
();
66
74
int
kill
();
75
77
pid_t
pid
()
const
;
78
80
FILE*
fp
()
const
;
81
83
int
fd
()
const
;
84
85
private
:
86
Pipe
(
const
Pipe
&);
87
Pipe
&
operator=
(
const
Pipe
&);
88
89
private
:
93
FILE*
m_fp
;
94
98
pid_t
m_child_pid
;
99
};
100
101
inline
pid_t
102
Pipe::pid
()
const
{
return
m_child_pid
; }
103
104
inline
int
105
Pipe::fd
()
const
{
return
fileno (
m_fp
); }
106
107
inline
FILE*
108
Pipe::fp
()
const
{
return
m_fp
; }
109
110
}
// end namespace ASSA
111
112
#endif // PIPE_H
113
ASSA::Pipe::m_fp
FILE * m_fp
A standard I/O stream descriptor.
Definition:
Pipe.h:93
ASSA::Pipe::kill
int kill()
Kill subprocess with SIGTERM.
Definition:
Pipe.cpp:118
ASSA::Pipe::~Pipe
~Pipe()
Destructor calls close () first in an attempt to close opened pipe.
Definition:
Pipe.cpp:43
ASSA::Pipe::operator=
Pipe & operator=(const Pipe &)
ASSA::Pipe
Definition:
Pipe.h:28
ASSA::Pipe::open
FILE * open(const string &cmd_, const string &type_)
Starts a subshell and feed it the string cmd_ to be executed.
Definition:
Pipe.cpp:51
ASSA::Pipe::close
int close()
Close the pipe.
Definition:
Pipe.cpp:136
Logger.h
ASSA::Pipe::fp
FILE * fp() const
Get pipe's standard I/O file pointer.
Definition:
Pipe.h:108
ASSA::Pipe::fd
int fd() const
Get pipe's file descriptor.
Definition:
Pipe.h:105
ASSA::Pipe::pid
pid_t pid() const
Get subprocess' PID.
Definition:
Pipe.h:102
ASSA::Pipe::Pipe
Pipe()
A no-op constructor.
Definition:
Pipe.cpp:34
ASSA::Pipe::m_child_pid
pid_t m_child_pid
Supbrocess' PID.
Definition:
Pipe.h:98
ASSA
Definition:
Acceptor.h:40
Generated by
1.8.17