Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
VariableArrayVar.cxx
Go to the documentation of this file.
1//*-- Author : Ole Hansen 15/2/2016
2
4//
5// VariableArrayVar
6//
7// A "global variable" referencing a variable size array of basic data.
8//
10
11#include "VariableArrayVar.h"
12#include "THaVar.h"
13#include <typeinfo> // for typeid
14#include <cassert>
15
16using namespace std;
17
18namespace Podd {
19
20//_____________________________________________________________________________
22 VarType type, const Int_t* count )
23 : Variable(pvar,addr,type), fCount(count)
24{
25 // Constructor
26
27 assert( fCount );
28
29 if( !VerifyNonArrayName(GetName()) ) {
30 fValueP = nullptr;
31 return;
32 }
33}
34
35//_____________________________________________________________________________
37{
38 // Get number of elements of the variable
39
40 if( !fCount )
41 return 0;
42 return *fCount;
43}
44
45//_____________________________________________________________________________
47{
48 // Number of dimensions
49
50 return 1;
51}
52
53//_____________________________________________________________________________
55{
56 // Return array of dimensions of the array. Scalars always return a
57 // pointer to 1 (as with array definition [1]).
58
59 return fCount;
60}
61
62//_____________________________________________________________________________
64{
65 // Compare the size counter of this variable to that of 'rhs'.
66
67 if( typeid(*this) != typeid(rhs) )
68 return false;
69
70 const auto *const other = dynamic_cast<const VariableArrayVar*>(&rhs);
71 assert( other );
72 if( !other )
73 return false;
74
75 return fCount == other->fCount;
76}
77
78//_____________________________________________________________________________
80{
81 return true;
82}
83
84//_____________________________________________________________________________
86{
87 // Data are contiguous in memory
88
89 return !IsPointerArray();
90}
91
92//_____________________________________________________________________________
94{
95 // Data are an array of pointers to data
96
97 return fType>=kDouble2P && fType <= kObject2P;
98}
99
100//_____________________________________________________________________________
102{
103 // Variable is a variable-size array
104
105 return true;
106}
107
108//_____________________________________________________________________________
109
110}// namespace Podd
int Int_t
bool Bool_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
virtual Bool_t IsContiguous() const
VariableArrayVar(THaVar *pvar, const void *addr, VarType type, const Int_t *count)
virtual Bool_t HasSizeVar() const
virtual Bool_t HasSameSize(const Variable &rhs) const
virtual Bool_t IsVarArray() const
virtual Bool_t IsPointerArray() const
virtual Int_t GetNdim() const
virtual const Int_t * GetDim() const
virtual Int_t GetLen() const
const void * fValueP
Definition Variable.h:60
Bool_t VerifyNonArrayName(const char *name) const
Definition Variable.cxx:38
const char * GetName() const
Definition Variable.cxx:56
VarType fType
Definition Variable.h:61
STL namespace.