XRootD
XrdSutCacheEntry Class Reference

#include <XrdSutCacheEntry.hh>

+ Collaboration diagram for XrdSutCacheEntry:

Public Member Functions

 XrdSutCacheEntry (const char *n=0, short st=0, short cn=0, kXR_int32 mt=0)
 
 XrdSutCacheEntry (const XrdSutCacheEntry &e)
 
virtual ~XrdSutCacheEntry ()
 
char * AsString () const
 
kXR_int32 Length () const
 
XrdSutCacheEntryoperator= (const XrdSutCacheEntry &pfe)
 
void Reset ()
 
void SetName (const char *n=0)
 

Public Attributes

XrdSutCacheEntryBuf buf1
 
XrdSutCacheEntryBuf buf2
 
XrdSutCacheEntryBuf buf3
 
XrdSutCacheEntryBuf buf4
 
short cnt
 
kXR_int32 mtime
 
char * name
 
XrdSysRWLock rwmtx
 
short status
 

Detailed Description

Definition at line 75 of file XrdSutCacheEntry.hh.

Constructor & Destructor Documentation

◆ XrdSutCacheEntry() [1/2]

XrdSutCacheEntry::XrdSutCacheEntry ( const char *  n = 0,
short  st = 0,
short  cn = 0,
kXR_int32  mt = 0 
)

Definition at line 85 of file XrdSutCacheEntry.cc.

87 {
88  // Constructor
89 
90  name = 0;
91  status = st;
92  cnt = cn;
93  mtime = (mt > 0) ? mt : (kXR_int32)time(0);
94  if (n) {
95  name = new char[strlen(n)+1];
96  if (name)
97  strcpy(name,n);
98  }
99 }
int kXR_int32
Definition: XPtypes.hh:89

References cnt, mtime, name, and status.

◆ XrdSutCacheEntry() [2/2]

XrdSutCacheEntry::XrdSutCacheEntry ( const XrdSutCacheEntry e)

Definition at line 102 of file XrdSutCacheEntry.cc.

102  : buf1(e.buf1),
103  buf2(e.buf2), buf3(e.buf3), buf4(e.buf4)
104 {
105  // Copy constructor
106 
107  name = 0;
108  status = e.status;
109  cnt = e.cnt;
110  mtime = e.mtime;
111  if (e.name) {
112  name = new char[strlen(e.name)+1];
113  if (name)
114  strcpy(name,e.name);
115  }
116 }
XrdSutCacheEntryBuf buf2
XrdSutCacheEntryBuf buf4
XrdSutCacheEntryBuf buf1
XrdSutCacheEntryBuf buf3

References cnt, mtime, name, and status.

◆ ~XrdSutCacheEntry()

virtual XrdSutCacheEntry::~XrdSutCacheEntry ( )
inlinevirtual

Definition at line 89 of file XrdSutCacheEntry.hh.

89 { if (name) delete[] name; }

References name.

Member Function Documentation

◆ AsString()

char * XrdSutCacheEntry::AsString ( ) const

Definition at line 152 of file XrdSutCacheEntry.cc.

153 {
154  // Return a string with serialized information
155  // For print purposes
156  // The output string points to a static buffer, so it must
157  // not be deleted by the caller
158  static char pbuf[2048];
159 
160  char smt[20] = {0};
161  XrdSutTimeString(mtime,smt);
162 
163  sprintf(pbuf,"st:%d cn:%d buf:%d,%d,%d,%d modified:%s name:%s",
165 
166  return pbuf;
167 }
int XrdSutTimeString(int t, char *st, int opt)
Definition: XrdSutAux.cc:311

References buf1, buf2, buf3, buf4, cnt, XrdSutCacheEntryBuf::len, mtime, name, status, and XrdSutTimeString().

+ Here is the call graph for this function:

◆ Length()

kXR_int32 XrdSutCacheEntry::Length ( ) const
inline

Definition at line 90 of file XrdSutCacheEntry.hh.

90  { return (buf1.len + buf2.len + 2*sizeof(short) +
91  buf3.len + buf4.len + 5*sizeof(kXR_int32)); }

References buf1, buf2, buf3, buf4, and XrdSutCacheEntryBuf::len.

◆ operator=()

XrdSutCacheEntry & XrdSutCacheEntry::operator= ( const XrdSutCacheEntry pfe)

Definition at line 170 of file XrdSutCacheEntry.cc.

171 {
172  // Assign entry e to local entry.
173 
174  SetName(name);
175  status = e.status;
176  cnt = e.cnt; // counter
177  mtime = e.mtime; // time of last modification / creation
178  buf1.SetBuf(e.buf1.buf);
179  buf2.SetBuf(e.buf2.buf);
180  buf3.SetBuf(e.buf3.buf);
181  buf4.SetBuf(e.buf4.buf);
182 
183  return (*this);
184 }
void SetBuf(const char *b=0, kXR_int32 l=0)
void SetName(const char *n=0)

References XrdSutCacheEntryBuf::buf, buf1, buf2, buf3, buf4, cnt, mtime, name, XrdSutCacheEntryBuf::SetBuf(), SetName(), and status.

+ Here is the call graph for this function:

◆ Reset()

void XrdSutCacheEntry::Reset ( )

Definition at line 119 of file XrdSutCacheEntry.cc.

120 {
121  // Resetting entry
122 
123  if (name)
124  delete[] name;
125  name = 0;
126  status = 0;
127  cnt = 0;
128  mtime = (kXR_int32)time(0);
129  buf1.SetBuf();
130  buf2.SetBuf();
131  buf3.SetBuf();
132  buf4.SetBuf();
133 }

References buf1, buf2, buf3, buf4, cnt, mtime, name, XrdSutCacheEntryBuf::SetBuf(), and status.

+ Here is the call graph for this function:

◆ SetName()

void XrdSutCacheEntry::SetName ( const char *  n = 0)

Definition at line 136 of file XrdSutCacheEntry.cc.

137 {
138  // Set the name
139 
140  if (name) {
141  delete[] name;
142  name = 0;
143  }
144  if (n) {
145  name = new char[strlen(n)+1];
146  if (name)
147  strcpy(name,n);
148  }
149 }

References name.

Referenced by operator=().

+ Here is the caller graph for this function:

Member Data Documentation

◆ buf1

◆ buf2

◆ buf3

XrdSutCacheEntryBuf XrdSutCacheEntry::buf3

Definition at line 83 of file XrdSutCacheEntry.hh.

Referenced by AsString(), Length(), operator=(), and Reset().

◆ buf4

XrdSutCacheEntryBuf XrdSutCacheEntry::buf4

Definition at line 84 of file XrdSutCacheEntry.hh.

Referenced by AsString(), Length(), operator=(), and Reset().

◆ cnt

short XrdSutCacheEntry::cnt

◆ mtime

◆ name

char* XrdSutCacheEntry::name

◆ rwmtx

XrdSysRWLock XrdSutCacheEntry::rwmtx

◆ status


The documentation for this class was generated from the following files: