1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 #ifndef REQUEST_LIST_H_
22 #define REQUEST_LIST_H_
31 RequestList() : m_id(0) {}
38 std::lock_guard<std::recursive_mutex> lock(m_listMutex);
39 m_requestList[m_id++] = request;
45 std::lock_guard<std::recursive_mutex> lock(m_listMutex);
46 if (m_requestList.end() != m_requestList.find(id))
47 return m_requestList[id];
54 std::lock_guard<std::recursive_mutex> lock(m_listMutex);
55 if (m_requestList.end() != m_requestList.find(id))
57 T request = m_requestList[id];
58 m_requestList.erase(m_requestList.find(id));
67 std::lock_guard<std::recursive_mutex> lock(m_listMutex);
68 return m_requestList.size();
73 std::lock_guard<std::recursive_mutex> lock(m_listMutex);
74 m_requestList.clear();
79 std::recursive_mutex m_listMutex;
80 std::map<int, T> m_requestList;