1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
24 #include <com/sun/star/uno/RuntimeException.hpp>
25 #include <rtl/byteseq.hxx>
26 #include <osl/mutex.hxx>
28 #include "lessoperators.hxx"
29 #include "outgoingrequest.hxx"
30 #include "outgoingrequests.hxx"
34 OutgoingRequests::OutgoingRequests() {}
36 OutgoingRequests::~OutgoingRequests() {}
38 void OutgoingRequests::push(
39 rtl::ByteSequence
const & tid
, OutgoingRequest
const & request
)
41 osl::MutexGuard
g(mutex_
);
42 map_
[tid
].push_back(request
);
45 OutgoingRequest
OutgoingRequests::top(rtl::ByteSequence
const & tid
) {
46 osl::MutexGuard
g(mutex_
);
47 Map::iterator
i(map_
.find(tid
));
48 if (i
== map_
.end()) {
49 throw css::uno::RuntimeException(
50 "URP: reply for unknown TID");
52 assert(!i
->second
.empty());
53 return i
->second
.back();
56 void OutgoingRequests::pop(rtl::ByteSequence
const & tid
) throw () {
57 osl::MutexGuard
g(mutex_
);
58 Map::iterator
i(map_
.find(tid
));
59 assert(i
!= map_
.end());
61 if (i
->second
.empty()) {
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */