]>
Commit | Line | Data |
---|---|---|
b8151fa1 | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
b8151fa1 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
b8151fa1 CT |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 16 Cache Manager API */ |
10 | ||
f7f3304a | 11 | #include "squid.h" |
b8151fa1 | 12 | #include "base/TextException.h" |
675b8408 | 13 | #include "debug/Stream.h" |
b8151fa1 CT |
14 | #include "ipc/TypedMsgHdr.h" |
15 | #include "mgr/IntParam.h" | |
16 | ||
b8151fa1 | 17 | Mgr::IntParam::IntParam(): |
f53969cc | 18 | QueryParam(QueryParam::ptInt), array() |
b8151fa1 CT |
19 | { |
20 | } | |
21 | ||
22 | Mgr::IntParam::IntParam(const std::vector<int>& anArray): | |
f53969cc | 23 | QueryParam(QueryParam::ptInt), array(anArray) |
b8151fa1 CT |
24 | { |
25 | } | |
26 | ||
27 | void | |
28 | Mgr::IntParam::pack(Ipc::TypedMsgHdr& msg) const | |
29 | { | |
30 | msg.putPod(type); | |
31 | msg.putInt(array.size()); | |
32 | typedef std::vector<int>::const_iterator Iterator; | |
33 | for (Iterator iter = array.begin(); iter != array.end(); ++iter) | |
34 | msg.putInt(*iter); | |
35 | } | |
36 | ||
37 | void | |
38 | Mgr::IntParam::unpackValue(const Ipc::TypedMsgHdr& msg) | |
39 | { | |
40 | array.clear(); | |
41 | int count = msg.getInt(); | |
42 | Must(count >= 0); | |
43 | for ( ; count > 0; --count) | |
44 | array.push_back(msg.getInt()); | |
45 | } | |
46 | ||
47 | const std::vector<int>& | |
48 | Mgr::IntParam::value() const | |
49 | { | |
50 | return array; | |
51 | } | |
f53969cc | 52 |