XRootD
Loading...
Searching...
No Matches
XrdMonRoll.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d M o n R o l l . h h */
4/* */
5/* (c) 2024 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* All Rights Reserved */
7/* Produced by Andrew Hanushevsky for Stanford University under contract */
8/* DE-AC02-76-SFO0515 with the Department of Energy */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31#include <cstring>
32
33#include "Xrd/XrdMonitor.hh"
34#include "Xrd/XrdMonRoll.hh"
35
36/******************************************************************************/
37/* S t a t i c M e m b e r s */
38/******************************************************************************/
39
41
42/******************************************************************************/
43/* C o n s t r u c t o r */
44/******************************************************************************/
45
47{ memset(rsvd, 0, sizeof(rsvd));}
48
49/******************************************************************************/
50/* R e g i s t e r */
51/******************************************************************************/
52
53bool XrdMonRoll::Register(rollType setType, const char* setName,
54 std::vector<XrdMonRoll::Item>& iVec)
55{
56 return XrdMon.Register(setType, setName, iVec.data(), iVec.size());
57}
58
59/******************************************************************************/
60bool XrdMonRoll::Register(rollType setType, const char* setName,
61 setMember setVec[])
62{
63 int numE = 0;
64
65// Convert this setMember list to an Item list as using setMember is deprecated.
66//
67 std::vector<Item>* iVec = new std::vector<Item>();
68
69 for(int i = 0; &setVec[i].varValu != &EOV; i++)
70 {XrdMonRoll::Item theItem(setVec[i].varName, setVec[i].varValu);
71 iVec->push_back(theItem);
72 numE++;
73 }
74
75// Now register the converted list
76//
77 if (XrdMon.Register(setType, setName, iVec->data(), numE)) return true;
78 delete iVec;
79 return false;
80}
XrdSys::RAtomic< unsigned int > RAtomic_uint
XrdMonRoll(XrdMonitor &xMon)
Definition XrdMonRoll.cc:46
bool Register(rollType setType, const char *setName, std::vector< Item > &iVec)
Definition XrdMonRoll.cc:53
RAtomic_uint & varValu
static RAtomic_uint EOV
Definition XrdMonRoll.hh:40