예제 #1
0
void TraceBuffer::addFree(long address, float time) {
	ensureBufferSpace(frame_data->getFreeFrameSize());

	//Flag
	copyFlag(frame_data->FREEFLAG);

	//Data
	copyToBuffer(&address, sizeof(long));
	copyToBuffer(&time, sizeof(float));

}
예제 #2
0
void TraceBuffer::addRealloc(long addressold, long addressnew, float time,
		long allocationsize) {
	ensureBufferSpace(frame_data->getReallocFrameSize());

	//Flag
	copyFlag(frame_data->REALLOCFLAG);

	//Data
	copyToBuffer(&addressold, sizeof(long));
	copyToBuffer(&addressnew, sizeof(long));
	copyToBuffer(&time, sizeof(float));
	copyToBuffer(&allocationsize, sizeof(long));
}
예제 #3
0
void TraceBuffer::addCalloc(long address, float time, long allocationsize,
		int stackid) {
	ensureBufferSpace(frame_data->getCallocFrameSize());

	//Flag
	copyFlag(frame_data->CALLOCFLAG);

	//Data
	copyToBuffer(&address, sizeof(long));
	copyToBuffer(&time, sizeof(float));
	copyToBuffer(&allocationsize, sizeof(long));
	copyToBuffer(&stackid, sizeof(int));

}
예제 #4
0
void MultiChain::record() {
  //h_config = H5Gopen(h_file,"MultiChain");
  typedef Bead::RealType PosType;
  typedef Bead::Buffer_t Buffer_t;

  Buffer_t chain_buffer,bead_buffer;
  (*(this->begin()))->registerData(bead_buffer);

  chain_buffer.rewind();
  copyToBuffer(chain_buffer);

  HDFAttribIO<Buffer_t> mcout(chain_buffer);
  mcout.overwrite(h_config,"state");

  std::deque<Bead*>::iterator bead_it(this->begin());
  std::deque<Bead*>::iterator bead_end(this->end());
  //create the group and increment counter
  char GrpName[128];
  int ibead=0;
  while(bead_it != bead_end) {
    sprintf(GrpName,"bead%04d",ibead);
    hid_t bead_id = H5Gopen(h_config,GrpName);
    bead_buffer.rewind();
    Bead& bead(**bead_it);
    bead.copyToBuffer(bead_buffer);
    HDFAttribIO<Buffer_t> bout(bead_buffer);
    bout.overwrite(bead_id,"state");
    H5Gclose(bead_id);
    ++bead_it;
    ++ibead;
  }
}
예제 #5
0
ViewPlot::ViewPlot(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ViewPlot)
{
    ui->setupUi(this);

    this->setWindowFlags( Qt::Dialog |  Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint |
                          Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);
    ui->centralwidget->setStyleSheet("background-color: white;");
    stngViewPlot = new QSettings((QCoreApplication::applicationDirPath()) + "//configSanPasport.ini",QSettings::IniFormat);

    // Строка состояния
    sb1 = new QLabel(statusBar());
    ui->statusbar->setSizeGripEnabled(false);
    ui->statusbar->addWidget(sb1, 1);
    sb1->setText("");

    connect( ui->action_Open, SIGNAL(triggered()), SLOT(plotOpen()) );
    connect( ui->action_FileExport, SIGNAL(triggered()), SLOT(plotExport())  );
    connect( ui->action_CopyToBuffer, SIGNAL(triggered()), SLOT(copyToBuffer()) );
    connect( ui->action_Exit, SIGNAL(triggered()), SLOT(close()) );
    connect( ui->action_ConfizGraph, SIGNAL(triggered()), SLOT(showConfizGraph()) );
    connect( ui->action_Font, SIGNAL(triggered()), SLOT(settingFont()) );
    connect( ui->frame, SIGNAL(sgnlRazmer()), SLOT(plotSquare()) );

    // Подписи к осям
    ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::xTop)->enableComponent(QwtScaleDraw::Labels, false);
    ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::yRight)->enableComponent(QwtScaleDraw::Labels, false);
    ui->qwtPlot_spectrogram->setAxisEnableForAll(true);
    // Позиция курсора

    picker = new PlotZozPicker( ui->qwtPlot_spectrogram->canvas() );
    connect( picker, SIGNAL(position(QString)), SLOT(plotPos(QString)) );
    connect( ui->qwtPlot_spectrogram, SIGNAL(sgnlOutCanvas()), SLOT(plotPosReset())  );

    plotPosReset();
    // Кривая для легенды
    curve = new QwtPlotCurve();
    curve->setPen( Qt::red, 2 );
    curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
    curve->setLegendIconSize(QSize(30,2));
    curve->attach(ui->qwtPlot_spectrogram);
    // Легенда
    qwtLeg = new QwtLegend();
    qwtLeg->contentsWidget()->layout()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    ui->qwtPlot_spectrogram->insertLegend( qwtLeg, QwtPlot::RightLegend);
    // Маркеры
    markerV = new PlotZozMarker(QwtPlotMarker::VLine);
    markerH = new PlotZozMarker(QwtPlotMarker::HLine);
    // Костыль - чтоб не мигал ратянутый график
    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
    effect->setOpacity(0);
    ui->frame->setGraphicsEffect(effect);

    // Контекстное меню
    ui->frame->setContextMenuPolicy(Qt::CustomContextMenu);
    connect( ui->frame, SIGNAL(customContextMenuRequested(QPoint)), SLOT(contextMenuView(QPoint)) );
}
예제 #6
0
CFURLRef KURL::createCFURL() const
{
    // FIXME: What should this return for invalid URLs?
    // Currently it throws away the high bytes of the characters in the string in that case,
    // which is clearly wrong.
    CharBuffer buffer;
    copyToBuffer(buffer);
    return createCFURLFromBuffer(buffer);
}
예제 #7
0
파일: Edit.cpp 프로젝트: taglo/AudioEditor
Sample& Sample::cut() {

    int newLength = fxIStart + length - fxIEnd;
    setBufferMinLength(newLength);

    copyToBuffer(*this, 0, 0, fxIStart);
    copyToBuffer(*this, fxIEnd, fxIStart, length - fxIEnd);

    length = newLength;
    dataL = new double[length];
    dataR = new double[length];

    copyFromBuffer(*this, 0, 0, length);

    fxRangeReset();

    return *this;
}
예제 #8
0
void TraceBuffer::addTimer(double time){
	ensureBufferSpace(frame_data->getTimerFrameSize());

	//Flag
	copyFlag(frame_data->TIMERFLAG);

	//Data
	copyToBuffer(&time, sizeof(double));

}
예제 #9
0
/** 
 * - MultiChain
 *   -- Version
 *   -- NumberOfBeads
 *   -- state: number of beads, grotwh direction etc, see MultiChain::copyToBuffer 
 *   -- bead0000
 *      -- state:  everything is stored in a buffer using PooledData<t>
 *      R, Drift, Multiple Gradients,
 *      properties, weights etc, see Bead::copyToBuffer
 */
void MultiChain::open(const string& aroot) {
  hid_t h_file=-1;
  string h5file=aroot+".config.h5";
  h_file  =  H5Fopen(h5file.c_str(),H5F_ACC_RDWR,H5P_DEFAULT);
  h_config = H5Gcreate(h_file,"MultiChain",0);
  int m_version=1;
  HDFAttribIO<int> v(m_version);
  v.write(h_config,"Version");

  int nc=Beads.size();
  HDFAttribIO<int> c(nc);
  c.write(h_config,"NumberOfBeads");

  //typedef Bead::PosType PosType;
  typedef Bead::RealType PosType;
  typedef Bead::Buffer_t Buffer_t;

  Buffer_t chain_buffer,bead_buffer;
  (*(this->begin()))->registerData(bead_buffer);
  nc=bead_buffer.size();
  HDFAttribIO<int> c2(nc);
  c2.write(h_config,"BufferSize");

  chain_buffer.rewind();
  copyToBuffer(chain_buffer);

  HDFAttribIO<Buffer_t> mcout(chain_buffer);
  mcout.write(h_config,"state");

  std::deque<Bead*>::iterator bead_it(this->begin());
  std::deque<Bead*>::iterator bead_end(this->end());
  //create the group and increment counter
  char GrpName[128];
  int ibead=0;
  while(bead_it != bead_end) {
    sprintf(GrpName,"bead%04d",ibead);
    hid_t bead_id = H5Gcreate(h_config,GrpName,0);

    bead_buffer.rewind();
    Bead& bead(**bead_it);
    bead.copyToBuffer(bead_buffer);
    HDFAttribIO<Buffer_t> bout(bead_buffer);
    bout.write(bead_id,"state");

    H5Gclose(bead_id);
    ++bead_it;
    ++ibead;
  }
  if(h_file>-1) H5Fclose(h_file);
}
예제 #10
0
파일: KURLCFNet.cpp 프로젝트: dog-god/iptv
CFURLRef KURL::createCFURL() const
{
#if !USE(WTFURL)
    // FIXME: What should this return for invalid URLs?
    // Currently it throws away the high bytes of the characters in the string in that case,
    // which is clearly wrong.
    CharBuffer buffer;
    copyToBuffer(buffer);
    return createCFURLFromBuffer(buffer);
#else // USE(WTFURL)
    // FIXME: Add WTFURL Implementation.
    return 0;
#endif
}
예제 #11
0
파일: KURLCFNet.cpp 프로젝트: 13W/phantomjs
CFURLRef KURL::createCFURL() const
{
    // FIXME: What should this return for invalid URLs?
    // Currently it throws away the high bytes of the characters in the string in that case,
    // which is clearly wrong.

    Vector<char, 512> buffer;
    copyToBuffer(buffer);

    // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components
    // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
    // could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back
    // onto using ISO Latin-1 in those cases.
    CFURLRef result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true);
    if (!result)
        result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true);
    return result;
}
예제 #12
0
void transmitMotorBuffer(){
//     uint8_t payload[4];
    uint8_t bsize = copyToBuffer();
    
    if(bsize<=100)
      return;
    // fill in payload
    tbuffer[100] = bsize;
    tbuffer[101] = wbuffcount-rbuffcount;

    CDC_Device_Flush(&VirtualSerial_CDC_Interface);
    packet_t* pkt = PKT_Create(PKTYPE_STATUS_MOTOR_STATE, seq++, tbuffer, 102);
    uint8_t len = PKT_ToBuffer(pkt, txBuffer); 
    for(int i=0; i < len; i++) {
        sendByte(txBuffer[i]);
        handleUSB();
    }
    free(pkt);
}
예제 #13
0
bool MultiChain::read(hid_t grp){

  hid_t hgrp = H5Gopen(grp,"MultiChain");

  int m_version=1;
  HDFAttribIO<int> v(m_version);
  v.read(hgrp,"Version");

  int nc(0);
  HDFAttribIO<int> c(nc);
  c.read(hgrp,"NumberOfBeads");
  if(nc != Beads.size()) {
    WARNMSG("The number of chains is different. Previous = "  << nc << " Current = " << Beads.size())
  }

  typedef Bead::RealType PosType;
  typedef Bead::Buffer_t Buffer_t;

  Buffer_t chain_buffer,bead_buffer;
  (*(this->begin()))->registerData(bead_buffer);

  HDFAttribIO<int> c2(nc);
  c2.read(hgrp,"BufferSize");
  if(nc != bead_buffer.size()) {
    ERRORMSG("The buffer size is different. Ignore restart data")
        H5Gclose(hgrp);
    return false;
  }

  chain_buffer.rewind();
  copyToBuffer(chain_buffer);

  HDFAttribIO<Buffer_t> mcin(chain_buffer);
  mcin.read(hgrp,"state");
  chain_buffer.rewind();
  copyFromBuffer(chain_buffer);

  std::deque<Bead*>::iterator bead_it(this->begin());
  std::deque<Bead*>::iterator bead_end(this->end());
  //create the group and increment counter
  char GrpName[128];
  int ibead=0;
  while(bead_it != bead_end) {
    sprintf(GrpName,"bead%04d",ibead);
    hid_t bead_id = H5Gopen(hgrp,GrpName);

    Bead& bead(**bead_it);

    HDFAttribIO<Buffer_t> bout(bead_buffer);
    bout.read(bead_id,"state");

    bead_buffer.rewind();
    bead.copyFromBuffer(bead_buffer);

    H5Gclose(bead_id);
    ++bead_it;
    ++ibead;
  }

  H5Gclose(hgrp);

  return true;
}
예제 #14
0
  void SpaceWarp::updateBuffer(PooledData<RealType>& buf) {
//recompute Jacobian from scratch
    copyToBuffer(buf);
  }
예제 #15
0
void TraceBuffer::initBuffer() {
	internal_string_buffer.pubseekoff(0, ios_base::beg);
	copyFlag(frame_data->DATAFLAG);
	long data = 0;
	copyToBuffer(&data, sizeof(long));
}