00001
00002 #include "pup.h"
00003
00004 #ifndef DEBUG_CONV_PLUSPLUS_H
00005 #define DEBUG_CONV_PLUSPLUS_H
00006
00013 class CpdListAccessor {
00014 protected:
00020 void beginItem(PUP::er &p,int itemNo);
00022 bool checkBound;
00023 public:
00024 CpdListAccessor() : checkBound(true) {}
00025 virtual ~CpdListAccessor();
00027 virtual const char *getPath(void) const =0;
00029 virtual size_t getLength(void) const =0;
00031 virtual bool checkBoundary(void) const { return checkBound; }
00033 virtual void pup(PUP::er &p,CpdListItemsRequest &req) =0;
00034 };
00035
00041 void CpdListRegister(CpdListAccessor *acc);
00042
00043 class CpdListAccessor_c : public CpdListAccessor {
00044 const char *path;
00045 CpdListLengthFn_c lenFn;
00046 void *lenParam;
00047 CpdListItemsFn_c itemsFn;
00048 void *itemsParam;
00049 public:
00050 CpdListAccessor_c(const char *path_,
00051 CpdListLengthFn_c lenFn_,void *lenParam_,
00052 CpdListItemsFn_c itemsFn_,void *itemsParam_,bool checkBoundary_=true):
00053 path(path_), lenFn(lenFn_), lenParam(lenParam_),
00054 itemsFn(itemsFn_), itemsParam(itemsParam_) {checkBound = checkBoundary_;}
00055 CpdListAccessor_c(const CpdListAccessor_c &p);
00056 void operator=(const CpdListAccessor_c &p);
00057
00058 virtual const char *getPath(void) const {return path;}
00059 virtual size_t getLength(void) const {return (*lenFn)(lenParam);}
00060 virtual void pup(PUP::er &p,CpdListItemsRequest &req) {
00061 (itemsFn)(itemsParam,(pup_er *)&p,&req);
00062 }
00063 };
00064
00070 class CpdSimpleListAccessor : public CpdListAccessor {
00071 public:
00074 typedef void (*pupFn)(PUP::er &p,int itemNo);
00075 private:
00076 const char *path;
00077 size_t &length;
00078 pupFn pfn;
00079 public:
00089 CpdSimpleListAccessor(const char *path_,size_t &length_,pupFn pfn_)
00090 :path(path_),length(length_),pfn(pfn_) { }
00091 virtual ~CpdSimpleListAccessor();
00092 virtual const char *getPath(void) const;
00093 virtual size_t getLength(void) const;
00094 virtual void pup(PUP::er &p,CpdListItemsRequest &req);
00095 };
00096
00097 #endif