00001
00002
00003 #ifndef SCTPIXELROD_RODPRIMLIST_H
00004 #define SCTPIXELROD_RODPRIMLIST_H
00005
00006 #include <list>
00007 #include <string>
00008 #include <fstream>
00009 #include <iostream>
00010 #include "RodPrimitive.h"
00011 #include "BaseException.h"
00012 #include "processor.h"
00013 #include "primParams.h"
00014
00015 namespace SctPixelRod {
00016
00025 class PrimListException : public BaseException {
00026 public:
00027 PrimListException( std::string descriptor, unsigned long data1, unsigned long data2);
00028 unsigned long getData1() {return m_data1;};
00029 unsigned long getData2() {return m_data2;};
00030 virtual std::ostream& what(std::ostream&, PrimListException&);
00031
00032 private:
00033 unsigned long m_data1;
00034 unsigned long m_data2;
00035 };
00036
00049 class RodPrimList : public std::list<RodPrimitive> {
00050 private:
00052 unsigned long m_index;
00054 unsigned long m_version;
00056 unsigned long *m_buffer;
00058 unsigned long m_bufferSize;
00059
00060 public:
00062 RodPrimList(unsigned long theIndex) :
00063 std::list<RodPrimitive>(), m_index(theIndex),
00064 m_buffer(0), m_bufferSize(0) {m_version = PRIM_LIST_REVISION;};
00066 RodPrimList() :
00067 std::list<RodPrimitive>(), m_index(0),
00068 m_buffer(0), m_bufferSize(0) {m_version = PRIM_LIST_REVISION;};
00070 RodPrimList(const RodPrimList &rhs);
00072 RodPrimList &operator=(const RodPrimList&);
00074 ~RodPrimList();
00075
00077 unsigned long checkSum();
00079 unsigned long numWords();
00080
00082 void bufferBuild() throw(PrimListException &);
00083
00085 void writeToXml(std::string& xmlFile) throw(PrimListException &);
00086
00088 void buildFromXml(std::string& xmlFile) throw(PrimListException &);
00089
00091 long getBufferLength() { return m_buffer[0]; };
00092
00094 unsigned long *getBuffer() { return m_buffer; };
00095
00097 void print();
00098
00100 void clear();
00101
00103 void setIndex(unsigned long i) { m_index=i; }
00105 unsigned long getIndex() const { return m_index; } ;
00106
00108 void setVersion(unsigned long version) { m_index=version; }
00110 unsigned long getVersion() const { return m_version; } ;
00111 };
00112
00113 }
00114
00115 std::ostream& operator<<(std::ostream& os, SctPixelRod::PrimListException& primExcept);
00116
00117 #endif // SCTPIXELROD_RODPRIMLIST_H