Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
types.hpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2015 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_IPC_TYPES_HPP
26 #define CARGO_IPC_TYPES_HPP
27 
28 #include <functional>
29 #include <memory>
30 #include <string>
31 
32 namespace cargo {
33 namespace ipc {
34 
42 typedef int FileDescriptor;
43 typedef unsigned int MethodID;
44 typedef std::string MessageID;
45 typedef std::string PeerID;
46 
54 typedef std::function<void(const cargo::ipc::PeerID peerID, const cargo::ipc::FileDescriptor fd)> PeerCallback;
55 
64 typedef std::function<void(cargo::ipc::FileDescriptor fd, std::shared_ptr<void>& data)> SerializeCallback;
65 
72 typedef std::function<std::shared_ptr<void>(cargo::ipc::FileDescriptor fd)> ParseCallback;
73 
81 
89 
90 
96 template<typename ReceivedDataType>
97 struct SignalHandler {
98  typedef std::function<bool(PeerID peerID,
99  std::shared_ptr<ReceivedDataType>& data)> type;
100 };
101 
102 } // namespace ipc
103 } // namespace cargo
104 
105 #endif // CARGO_IPC_TYPES_HPP
std::string PeerID
Definition: types.hpp:45
MessageID getNextMessageID()
Generate an unique message id.
Definition: types.cpp:46
std::function< std::shared_ptr< void >cargo::ipc::FileDescriptor fd)> ParseCallback
Generic function type used as callback for reading and parsing data.
Definition: types.hpp:72
std::function< void(const cargo::ipc::PeerID peerID, const cargo::ipc::FileDescriptor fd)> PeerCallback
Generic function type used as callback for peer events.
Definition: types.hpp:54
PeerID getNextPeerID()
Generate an unique peer id.
Definition: types.cpp:55
std::function< bool(PeerID peerID, std::shared_ptr< ReceivedDataType > &data)> type
Definition: types.hpp:99
char data[368]
Definition: initctl.cpp:41
unsigned int MethodID
Definition: types.hpp:43
std::function< void(cargo::ipc::FileDescriptor fd, std::shared_ptr< void > &data)> SerializeCallback
Generic function type used as callback for serializing and saving serialized data to the descriptor...
Definition: types.hpp:64
int FileDescriptor
Definition: types.hpp:42
Generic type used as a callback function for handling signals.
Definition: types.hpp:97
std::string MessageID
Definition: types.hpp:44