]>
Commit | Line | Data |
---|---|---|
b8151fa1 CT |
1 | /* |
2 | * $Id$ | |
3 | * | |
4 | * DEBUG: section 16 Cache Manager API | |
5 | * | |
6 | */ | |
7 | ||
f7f3304a | 8 | #include "squid.h" |
b8151fa1 CT |
9 | #include "base/TextException.h" |
10 | #include "ipc/TypedMsgHdr.h" | |
11 | #include "mgr/IntParam.h" | |
12 | ||
b8151fa1 | 13 | Mgr::IntParam::IntParam(): |
10c40d99 | 14 | QueryParam(QueryParam::ptInt), array() |
b8151fa1 CT |
15 | { |
16 | } | |
17 | ||
18 | Mgr::IntParam::IntParam(const std::vector<int>& anArray): | |
10c40d99 | 19 | QueryParam(QueryParam::ptInt), array(anArray) |
b8151fa1 CT |
20 | { |
21 | } | |
22 | ||
23 | void | |
24 | Mgr::IntParam::pack(Ipc::TypedMsgHdr& msg) const | |
25 | { | |
26 | msg.putPod(type); | |
27 | msg.putInt(array.size()); | |
28 | typedef std::vector<int>::const_iterator Iterator; | |
29 | for (Iterator iter = array.begin(); iter != array.end(); ++iter) | |
30 | msg.putInt(*iter); | |
31 | } | |
32 | ||
33 | void | |
34 | Mgr::IntParam::unpackValue(const Ipc::TypedMsgHdr& msg) | |
35 | { | |
36 | array.clear(); | |
37 | int count = msg.getInt(); | |
38 | Must(count >= 0); | |
39 | for ( ; count > 0; --count) | |
40 | array.push_back(msg.getInt()); | |
41 | } | |
42 | ||
43 | const std::vector<int>& | |
44 | Mgr::IntParam::value() const | |
45 | { | |
46 | return array; | |
47 | } |