Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fdstore.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Contact: Jan Olszak <j.olszak@samsung.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License
17  */
18 
25 #ifndef CARGO_FD_FDSTORE_HPP
26 #define CARGO_FD_FDSTORE_HPP
27 
28 #include <cstddef>
29 
30 namespace {
31 const unsigned int maxTimeout = 5000;
32 } // namespace
33 
34 namespace cargo {
35 
36 class FDStore {
37 
38 public:
46  FDStore(int fd = -1);
47  FDStore(const FDStore& store);
48  ~FDStore();
49 
57  void write(const void* bufferPtr, const size_t size, const unsigned int timeoutMS = maxTimeout);
58 
66  void read(void* bufferPtr, const size_t size, const unsigned int timeoutMS = maxTimeout);
67 
68  void sendFD(int fd, const unsigned int timeoutMS = maxTimeout);
69 
70  int receiveFD(const unsigned int timeoutMS = maxTimeout);
71 
72 private:
73  int mFD;
74 };
75 
76 } // namespace cargo
77 
78 #endif // CARGO_FD_FDSTORE_HPP
79 
80 
Definition: fdstore.hpp:36
int mFD
Definition: fdstore.hpp:73
FDStore(int fd=-1)
Constructor.
Definition: fdstore.cpp:90
void sendFD(int fd, const unsigned int timeoutMS=maxTimeout)
Definition: fdstore.cpp:168
void write(const void *bufferPtr, const size_t size, const unsigned int timeoutMS=maxTimeout)
Write data using the file descriptor.
Definition: fdstore.cpp:104
~FDStore()
Definition: fdstore.cpp:100
void read(void *bufferPtr, const size_t size, const unsigned int timeoutMS=maxTimeout)
Reads a value of the given type.
Definition: fdstore.cpp:134
int receiveFD(const unsigned int timeoutMS=maxTimeout)
Definition: fdstore.cpp:228