00001 #include <algorithm>
00002
00003 #include "primListWrapper.h"
00004
00005 #include "RodCrate/RodModule.h"
00006
00007 namespace SctApi {
00008
00009 PrimListWrapper::PrimListWrapper() : list(new SctPixelRod::RodPrimList) {}
00010 PrimListWrapper::PrimListWrapper(unsigned int index) : list(new SctPixelRod::RodPrimList(index)) {}
00011
00012 void PrimListWrapper::clear()
00013 {
00014 list->clear();
00015 }
00016
00017 void PrimListWrapper::addPrimitive(const SctPixelRod::RodPrimitive &prim, long *store)
00018 {
00019 list->push_back(prim);
00020 if(store)
00021 data.push_back(store);
00022 }
00023
00024 void PrimListWrapper::addPrimitive(long length, long index, long prim, long rev, const long *primData)
00025 {
00026 long *copied = new long[length];
00027
00028 std::copy(primData, primData+length, copied);
00029
00030 list->push_back(SctPixelRod::RodPrimitive(length+4, index, prim, rev, copied));
00031 data.push_back(copied);
00032 }
00033
00034 PrimListWrapper::~PrimListWrapper()
00035 {
00036 for(std::list<long *>::const_iterator i = data.begin();
00037 i != data.end();
00038 i++) {
00039 delete [] *i;
00040 }
00041 }
00042
00043 }