]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mgr/IntParam.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / mgr / IntParam.cc
CommitLineData
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 13Mgr::IntParam::IntParam():
10c40d99 14 QueryParam(QueryParam::ptInt), array()
b8151fa1
CT
15{
16}
17
18Mgr::IntParam::IntParam(const std::vector<int>& anArray):
10c40d99 19 QueryParam(QueryParam::ptInt), array(anArray)
b8151fa1
CT
20{
21}
22
23void
24Mgr::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
33void
34Mgr::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
43const std::vector<int>&
44Mgr::IntParam::value() const
45{
46 return array;
47}