1//
2// Pipe.cpp
3//
4// Library: Foundation
5// Package: Processes
6// Module: Pipe
7//
8// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// SPDX-License-Identifier: BSL-1.0
12//
13
14
15#include "Poco/Pipe.h"
16
17
18namespace Poco {
19
20
21Pipe::Pipe():
22 _pImpl(new PipeImpl)
23{
24}
25
26
27Pipe::Pipe(const Pipe& pipe):
28 _pImpl(pipe._pImpl)
29{
30 _pImpl->duplicate();
31}
32
33
34Pipe::~Pipe()
35{
36 _pImpl->release();
37}
38
39
40Pipe& Pipe::operator = (const Pipe& pipe)
41{
42 if (this != &pipe)
43 {
44 _pImpl->release();
45 _pImpl = pipe._pImpl;
46 _pImpl->duplicate();
47 }
48 return *this;
49}
50
51
52void Pipe::close(CloseMode mode)
53{
54 switch (mode)
55 {
56 case CLOSE_READ:
57 _pImpl->closeRead();
58 break;
59 case CLOSE_WRITE:
60 _pImpl->closeWrite();
61 break;
62 default:
63 _pImpl->closeRead();
64 _pImpl->closeWrite();
65 break;
66 }
67}
68
69
70} // namespace Poco
71