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