/usr/include/tango/pollring.h is in libtango8-dev 8.1.2c+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | //=============================================================================
//
// file : PollRing.h
//
// description : Include for the PollRing object. This class implements
// the polling ring buffer. Command result or attribute
// values are stored in this buffer manages as a ring
// buffer.
//
// project : TANGO
//
// author(s) : E.Taurel
//
// Copyright (C) : 2004,2005,2006,2007,2008,2009,2010,2011,2012,2013
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This file is part of Tango.
//
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tango. If not, see <http://www.gnu.org/licenses/>.
//
// $Revision: 22213 $
//
//=============================================================================
#ifndef _POLLRING_H
#define _POLLRING_H
#include <tango.h>
namespace Tango
{
//=============================================================================
//
// The RingElt class
//
// description : Class to store all the necessary information which will
// be stored and returned to client on request
//
//=============================================================================
class RingElt
{
public:
RingElt();
CORBA::Any *cmd_result;
Tango::AttributeValueList *attr_value;
Tango::AttributeValueList_3 *attr_value_3;
Tango::AttributeValueList_4 *attr_value_4;
Tango::DevFailed *except;
struct timeval when;
};
inline bool operator<(const RingElt &,const RingElt &)
{
return true;
}
inline bool operator==(const RingElt &,const RingElt &)
{
return true;
}
//=============================================================================
//
// The PollRing class
//
// description : Class to implement the ring buffer itself. This is mainly
// a vector of RingElt managed as a circular buffer
//
//=============================================================================
class PollRing
{
public:
PollRing();
PollRing(long);
~PollRing();
void insert_data(CORBA::Any *,struct timeval &);
void insert_data(Tango::AttributeValueList *,struct timeval &);
void insert_data(Tango::AttributeValueList_3 *,struct timeval &);
void insert_data(Tango::AttributeValueList_4 *,struct timeval &,bool);
void insert_except(Tango::DevFailed *,struct timeval &);
void force_copy_data(Tango::AttributeValueList_4 *);
void get_delta_t(vector<double> &,long nb);
struct timeval get_last_insert_date();
bool is_empty() {if (nb_elt == 0) return true;else return false;}
bool is_last_an_error();
bool is_last_cmd_an_error();
bool is_last_attr_an_error();
Tango::DevFailed *get_last_except();
Tango::DevErrorList &get_last_attr_error();
CORBA::Any *get_last_cmd_result();
Tango::AttributeValue &get_last_attr_value();
Tango::AttributeValue_3 &get_last_attr_value_3();
Tango::AttributeValue_4 &get_last_attr_value_4();
long get_nb_elt() {return nb_elt;}
void get_cmd_history(long,Tango::DevCmdHistoryList *);
void get_cmd_history(long,Tango::DevCmdHistory_4 *,Tango::CmdArgType &);
void get_attr_history(long,Tango::DevAttrHistoryList *,long);
void get_attr_history(long,Tango::DevAttrHistoryList_3 *,long);
void get_attr_history(long,Tango::DevAttrHistory_4 *,long);
void get_attr_history_43(long,Tango::DevAttrHistoryList_3 *,long);
private:
void inc_indexes();
vector<RingElt> ring;
long insert_elt;
long nb_elt;
long max_elt;
};
#define ADD_ELT_DATA_TO_GLOBAL_SEQ(GLOB,ELT,IND) \
{\
unsigned int elt_data_length = ELT->length(); \
for (unsigned int k = 0;k < elt_data_length;k++) \
(*GLOB)[IND + k] = (*ELT)[k]; \
IND = IND + elt_data_length; \
}
#define ADD_ELT_DATA_TO_GLOBAL_SEQ_BY_REF(GLOB,ELT,IND) \
{\
unsigned int elt_data_length = ELT.length(); \
for (unsigned int k = 0;k < elt_data_length;k++) \
GLOB[IND + k] = ELT[k]; \
IND = IND + elt_data_length; \
}
#define ADD_ELT_DATA_TO_GLOBAL_SEQ_BY_PTR_REF(GLOB,ELT,IND) \
{\
unsigned int elt_data_length = ELT.length(); \
for (unsigned int k = 0;k < elt_data_length;k++) \
(*GLOB)[IND + k] = ELT[k]; \
IND = IND + elt_data_length; \
}
#define MANAGE_DIM_ARRAY(LENGTH) \
if (last_dim.dim_x == LENGTH) \
{ \
ptr->dims_array[dims_length - 2].nb_elt++; \
} \
else \
{ \
last_dim.dim_x = LENGTH; \
last_dim.dim_y = 0; \
ptr->dims.length(dims_length); \
ptr->dims[dims_length - 1] = last_dim; \
ptr->dims_array.length(dims_length); \
ptr->dims_array[dims_length - 1].start = n - (i + 1); \
ptr->dims_array[dims_length - 1].nb_elt = 1; \
dims_length++; \
}
#define ADD_SIMPLE_DATA_TO_GLOBAL_SEQ(GLOB,ELT,IND) \
(*GLOB)[IND] = ELT; \
IND = IND + 1;
#define MANAGE_DIM_SIMPLE() \
if (last_dim.dim_x == 1) \
{ \
ptr->dims_array[dims_length - 2].nb_elt++; \
} \
else \
{ \
last_dim.dim_x = 1; \
last_dim.dim_y = 0; \
ptr->dims.length(dims_length); \
ptr->dims[dims_length - 1] = last_dim; \
ptr->dims_array.length(dims_length); \
ptr->dims_array[dims_length - 1].start = n - (i + 1); \
ptr->dims_array[dims_length - 1].nb_elt = 1; \
dims_length++; \
}
#define MANAGE_DIM_ARRAY_SEQ(LENGTH_STR,LENGTH_NUM) \
if ((last_dim.dim_x == LENGTH_STR) && (last_dim.dim_y == LENGTH_NUM))\
{ \
ptr->dims_array[dims_length - 2].nb_elt++; \
} \
else \
{ \
last_dim.dim_x = LENGTH_STR; \
last_dim.dim_y = LENGTH_NUM; \
ptr->dims.length(dims_length); \
ptr->dims[dims_length - 1] = last_dim; \
ptr->dims_array.length(dims_length); \
ptr->dims_array[dims_length - 1].start = n - (i + 1); \
ptr->dims_array[dims_length - 1].nb_elt = 1; \
dims_length++; \
}
} // End of Tango namespace
#endif /* _POLLRING_ */
|