xrootd
|
00001 #ifndef __OUC_TLIST__ 00002 #define __OUC_TLIST__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O u c T L i s t . h h */ 00006 /* */ 00007 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id$ 00014 00015 #include <stdlib.h> 00016 #include <string.h> 00017 #include <strings.h> 00018 00019 class XrdOucTList 00020 { 00021 public: 00022 00023 XrdOucTList *next; 00024 char *text; 00025 union 00026 { 00027 long long dval; 00028 int ival[2]; 00029 short sval[4]; 00030 char cval[8]; 00031 int val; 00032 }; 00033 00034 XrdOucTList(const char *tval, long long *dv,XrdOucTList *np=0) 00035 {next=np; text = (tval ? strdup(tval) : 0); dval=*dv;} 00036 00037 XrdOucTList(const char *tval=0, int num=0, XrdOucTList *np=0) 00038 {next=np; text = (tval ? strdup(tval) : 0); val=num;} 00039 00040 XrdOucTList(const char *tval, int iv[2], XrdOucTList *np=0) 00041 {next=np; text = (tval ? strdup(tval) : 0); 00042 memcpy(sval, iv, sizeof(ival));} 00043 00044 XrdOucTList(const char *tval, short sv[4], XrdOucTList *np=0) 00045 {next=np; text = (tval ? strdup(tval) : 0); 00046 memcpy(sval, sv, sizeof(sval));} 00047 00048 XrdOucTList(const char *tval, char cv[8], XrdOucTList *np=0) 00049 {text = (tval ? strdup(tval) : 0); next=np; 00050 memcpy(cval, cv, sizeof(cval));} 00051 00052 ~XrdOucTList() {if (text) free(text);} 00053 }; 00054 00055 class XrdOucTListHelper 00056 { 00057 public: 00058 00059 XrdOucTList **Anchor; 00060 00061 XrdOucTListHelper(XrdOucTList **p) : Anchor(p) {} 00062 ~XrdOucTListHelper() {XrdOucTList *tp; 00063 while((tp = *Anchor)) 00064 {*Anchor = tp->next; delete tp;} 00065 } 00066 }; 00067 #endif