LibreOffice Module binaryurp (master)
1
binaryurp
source
outgoingrequests.cxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This file is part of the LibreOffice project.
4
*
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/.
8
*
9
* This file incorporates work covered by the following license notice:
10
*
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 .
18
*/
19
20
#include <
sal/config.h
>
21
22
#include <cassert>
23
24
#include <com/sun/star/uno/RuntimeException.hpp>
25
#include <rtl/byteseq.hxx>
26
27
#include "
lessoperators.hxx
"
28
#include "
outgoingrequest.hxx
"
29
#include "
outgoingrequests.hxx
"
30
31
namespace
binaryurp
{
32
33
OutgoingRequests::OutgoingRequests
() {}
34
35
OutgoingRequests::~OutgoingRequests
() {}
36
37
void
OutgoingRequests::push
(
38
rtl::ByteSequence
const
& tid,
OutgoingRequest
const
& request)
39
{
40
std::scoped_lock g(
mutex_
);
41
map_
[tid].push_back(request);
42
}
43
44
OutgoingRequest
OutgoingRequests::top
(rtl::ByteSequence
const
& tid) {
45
std::scoped_lock g(
mutex_
);
46
Map::iterator
i
(
map_
.find(tid));
47
if
(
i
==
map_
.end()) {
48
throw
css::uno::RuntimeException(
49
"URP: reply for unknown TID"
);
50
}
51
assert(!
i
->second.empty());
52
return
i
->second.back();
53
}
54
55
void
OutgoingRequests::pop
(rtl::ByteSequence
const
& tid)
noexcept
{
56
std::scoped_lock g(
mutex_
);
57
Map::iterator
i
(
map_
.find(tid));
58
assert(
i
!=
map_
.end());
59
i
->second.pop_back();
60
if
(
i
->second.empty()) {
61
map_
.erase(
i
);
62
}
63
}
64
65
}
66
67
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
binaryurp::OutgoingRequests::push
void push(rtl::ByteSequence const &tid, OutgoingRequest const &request)
Definition:
outgoingrequests.cxx:37
binaryurp::OutgoingRequests::mutex_
std::mutex mutex_
Definition:
outgoingrequests.hxx:58
binaryurp::OutgoingRequests::pop
void pop(rtl::ByteSequence const &tid) noexcept
Definition:
outgoingrequests.cxx:55
binaryurp::OutgoingRequests::map_
Map map_
Definition:
outgoingrequests.hxx:59
binaryurp::OutgoingRequests::OutgoingRequests
OutgoingRequests()
Definition:
outgoingrequests.cxx:33
binaryurp::OutgoingRequests::~OutgoingRequests
~OutgoingRequests()
Definition:
outgoingrequests.cxx:35
binaryurp::OutgoingRequests::top
OutgoingRequest top(rtl::ByteSequence const &tid)
Definition:
outgoingrequests.cxx:44
config.h
mutex_
std::mutex mutex_
lessoperators.hxx
binaryurp
Definition:
binaryany.cxx:31
i
int i
outgoingrequest.hxx
outgoingrequests.hxx
map_
std::map< OUString, rtl::Reference< Entity > > const & map_
binaryurp::OutgoingRequest
Definition:
outgoingrequest.hxx:29
Generated on Sun Jul 30 2023 04:26:48 for LibreOffice Module binaryurp (master) by
1.9.3