- Timestamp:
- 07/15/11 15:25:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fad.cc
r11380 r11422 101 101 { 102 102 cout << "Data sent: (transmitted=" << bytes_transferred << ") rc=" << error.message() << " (" << error << ")" << endl; 103 fOutQueue.pop_front(); 103 104 } 104 105 105 106 vector<uint16_t> fBufCommand; 106 vector<uint16_t> fBuffer;107 107 108 108 vector<uint16_t> fCommand; … … 120 120 121 121 int fSocket; 122 123 deque<vector<uint16_t>> fOutQueue; 122 124 123 125 void SendData() … … 132 134 fHeader.fTempDrs[i] = (42.+fBoardId/40.+float(rand())/RAND_MAX*5)*16; 133 135 134 fBuffer.resize(0);136 vector<uint16_t> evtbuf; 135 137 136 138 for (int i=0; i<kNumChannels; i++) … … 140 142 const vector<uint16_t> buf = fChHeader[i].HtoN(); 141 143 142 fBuffer.insert(fBuffer.end(), buf.begin(), buf.end());143 fBuffer.insert(fBuffer.end(), fChHeader[i].fRegionOfInterest, 0x42+fHeader.fEventCounter*100);144 evtbuf.insert(evtbuf.end(), buf.begin(), buf.end()); 145 evtbuf.insert(evtbuf.end(), fChHeader[i].fRegionOfInterest, 0x42+fHeader.fEventCounter*100); 144 146 145 147 fHeader.fPackageLength += sizeof(ChannelHeader)/2; … … 147 149 } 148 150 149 fBuffer.push_back(htons(FAD::kDelimiterEnd));151 evtbuf.push_back(htons(FAD::kDelimiterEnd)); 150 152 151 153 const vector<uint16_t> h = fHeader.HtoN(); 152 154 153 fBuffer.insert(fBuffer.begin(), h.begin(), h.end()); 155 evtbuf.insert(evtbuf.begin(), h.begin(), h.end()); 156 157 fOutQueue.push_back(evtbuf); 154 158 155 159 if (fCommandSocket) 156 AsyncWrite(this, ba::buffer(ba::const_buffer(f Buffer.data(), fBuffer.size()*2)));160 AsyncWrite(this, ba::buffer(ba::const_buffer(fOutQueue.back().data(), fOutQueue.back().size()*2))); 157 161 else 158 162 { … … 163 167 fSocket %= fSockets.size(); 164 168 165 AsyncWrite(fSockets[fSocket].get(), ba::buffer(ba::const_buffer(f Buffer.data(), fBuffer.size()*2)));169 AsyncWrite(fSockets[fSocket].get(), ba::buffer(ba::const_buffer(fOutQueue.back().data(), fOutQueue.back().size()*2))); 166 170 } 167 171 }
Note:
See TracChangeset
for help on using the changeset viewer.