当前位置: 首页>>代码示例>>C++>>正文


C++ EventList类代码示例

本文整理汇总了C++中EventList的典型用法代码示例。如果您正苦于以下问题:C++ EventList类的具体用法?C++ EventList怎么用?C++ EventList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EventList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EventList

/**
 * Copy all of the data (event lists) from the source workspace to this
 *workspace.
 *
 * @param source: EventWorkspace from which we are taking data.
 * @param sourceStartWorkspaceIndex: index in the workspace of source where we
 *start
 *          copying the data. This index will be 0 in the "this" workspace.
 *          Default: -1, meaning copy all.
 * @param sourceEndWorkspaceIndex: index in the workspace of source where we
 *stop.
 *          It is inclusive = source[sourceEndWorkspaceIndex[ WILL be copied.
 *          Default: -1, meaning copy all.
 *
 */
void EventWorkspace::copyDataFrom(const EventWorkspace &source,
                                  std::size_t sourceStartWorkspaceIndex,
                                  std::size_t sourceEndWorkspaceIndex) {
  // Start with nothing.
  this->clearData(); // properly de-allocates memory!

  // Copy the vector of EventLists
  EventListVector source_data = source.data;
  EventListVector::iterator it;
  EventListVector::iterator it_start = source_data.begin();
  EventListVector::iterator it_end = source_data.end();
  size_t source_data_size = source_data.size();

  // Do we copy only a range?
  if (sourceEndWorkspaceIndex == size_t(-1))
    sourceEndWorkspaceIndex = source_data_size - 1;
  if ((sourceStartWorkspaceIndex < source_data_size) &&
      (sourceEndWorkspaceIndex < source_data_size) &&
      (sourceEndWorkspaceIndex >= sourceStartWorkspaceIndex)) {
    it_start += sourceStartWorkspaceIndex;
    it_end = source_data.begin() + sourceEndWorkspaceIndex + 1;
  }

  for (it = it_start; it != it_end; ++it) {
    // Create a new event list, copying over the events
    EventList *newel = new EventList(**it);
    // Make sure to update the MRU to point to THIS event workspace.
    newel->setMRU(this->mru);
    this->data.push_back(newel);
  }
  // Save the number of vectors
  m_noVectors = this->data.size();

  this->clearMRU();
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:50,代码来源:EventWorkspace.cpp

示例2: TEST

TEST(TestSuite, aTest) {
    // Create a list of events with time, set the size to 5 events

    EventList<Event_T> testList = EventList<Event_T>(5);
    testList[0].source = 0;
    testList[0].dest = 1;
    testList[0].setTime(1);
    testList[1].source = 0;
    testList[1].dest = 2;
    testList[1].setTime(2);
    testList[2].source = 0;
    testList[2].dest = 1;
    testList[2].setTime(4);
    testList[3].source = 2;
    testList[3].dest = 0;
    testList[3].setTime(5);
    testList[4].source = 0;
    testList[4].dest = 1;
    testList[4].setTime(7);

    // cout << "Simple event list:" << endl;
    for (int i = 0; i < testList.size; i++) {
        EXPECT_GT(testList[i].getLongEventInformation().length(), 0);
    }

    // Test writing and reading binary file
    char *testFileName = (char *) "test1.bin";
    testList.WriteFile_Binary(testFileName);

    EventList<Event_T> testList2 = EventList<Event_T>(0);
    testList2.ReadFile_Binary(testFileName);

    if (remove(testFileName) != 0) {
        cout << "Error while deleting file " << testFileName << endl;
    }


    // cout << "Simple event list after writing and reading binary file:" << endl;
    for (int i = 0; i < testList2.size; i++) {
        Event_T e1 = testList[i];
        Event_T e2 = testList2[i];

        EXPECT_GT(testList2[i].getLongEventInformation().length(), 0);

        EXPECT_EQ(e1.getDest(), e2.getDest());
        EXPECT_EQ(e1.getSource(), e2.getSource());
        EXPECT_EQ(e1.getTime(), e2.getTime());
    }

    // Test reading a file, compare result to explicit event list
    EventList<Event_T> testList_file = EventList<Event_T>(0);

    char *testListFileName = (char *) "../eventpy/data/eventlist_small1_sdt.txt";

    // cout << "Reading in some SourceDestTime data" << endl;
    testList_file.ReadFile_SourceDestTime(testListFileName);
    EXPECT_EQ(testList_file.size, testList.size);


}
开发者ID:bolozna,项目名称:Events,代码行数:60,代码来源:test_eventlist.cpp

示例3: createEventList

static EventList createEventList( const QDate& start, const QDate& end, int minutes, const TaskId& taskId )
{
    Q_ASSERT( start < end );

    EventList events;

    const int days = start.daysTo( end );
#if QT_VERSION >= 0x040700
    events.reserve( days );
#endif
    for ( int i = 0; i < days; ++i ) {
        const QDate date = start.addDays( i );
        //for each work day, create an event starting at 8 am
        if ( isWorkDay( date ) ) {
            const QDateTime startTime = QDateTime( date, QTime( 8, 0  ) );
            const QDateTime endTime = startTime.addSecs( minutes * 60 );
            Event event;
            event.setTaskId( taskId );
            event.setStartDateTime( startTime );
            event.setEndDateTime( endTime );
            event.setComment( QObject::tr( "(created by vacation dialog)" ) );
            events.append( event );
        }
    }
    return events;
}
开发者ID:OlivierJG,项目名称:Charm,代码行数:26,代码来源:EnterVacationDialog.cpp

示例4: Task1Name

void SqLiteStorageTests::deleteTaskWithEventsTest()
{
    // make a task
    const int TaskId = 1;
    const QString Task1Name( "Task-Name" );
    Task task;
    task.setId( TaskId );
    task.setName( Task1Name );
    task.setValidFrom( QDateTime::currentDateTime() );
    QVERIFY( m_storage->deleteAllTasks() );
    QVERIFY( m_storage->deleteAllEvents() );
    QVERIFY( m_storage->getAllTasks().size() == 0 );
    QVERIFY( m_storage->addTask( task ) );
    QVERIFY( m_storage->getAllTasks().size() == 1 );
    Task task2;
    task2.setId( 2 );
    task2.setName( "Task-2-Name" );
    QVERIFY( m_storage->addTask( task2 ) );
    QVERIFY( m_storage->getAllTasks().size() == 2 );

    // create 3 events, 2 for task 1, and one for another one
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 42 );
        const QString EventComment( "Event-Comment" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 43 );
        const QString EventComment( "Event-Comment 2" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    // this is the event that is supposed to remain in the DB:
    Event event = m_storage->makeEvent();
    QVERIFY( event.isValid() );
    event.setTaskId( task2.id() );
    event.setUserId( 1 );
    event.setReportId( 43 );
    const QString EventComment( "Event-Comment 2" );
    event.setComment( EventComment );
    QVERIFY( m_storage->modifyEvent( event ) );

    // verify task database entries
    QVERIFY( m_storage->deleteTask( task ) );
    EventList events = m_storage->getAllEvents();
    QVERIFY( events.count() == 1 );
    QVERIFY( events.first() == event );
}
开发者ID:MichaelRyanWebber,项目名称:Charm,代码行数:57,代码来源:SqLiteStorageTests.cpp

示例5: Event

/**
 * \brief ocl::Image::copyToAsync Copies asynchronously from this Image to the destination Image.
 *
 * \param queue is a command queue on which the command is executed.
 * \param src_origin is the 3D offset in bytes from which the Image is read.
 * \param region is the 3D region of the data. It is given with {image_width, image_height, image_depth}.
 * \param dest is the Image into which the data is going to be copied.
 * \param dest_origin is the 3D offset in bytes from which the destionation Image is read.
 * \param list contains all events for which this command has to wait.
 * \return event which can be integrated into other EventList.
 */
ocl::Event ocl::Image::copyToAsync(const Queue &queue, size_t *src_origin, const size_t *region, const Image &dest, size_t *dest_origin, const EventList &list)
{
    TRUE_ASSERT(this->context() == dest.context(), "Context of this and dest must be equal");
    TRUE_ASSERT(queue.context() == *this->context(), "Context of queue and this must be equal");
    cl_event event_id;
    OPENCL_SAFE_CALL( clEnqueueCopyImage(queue.id(), this->id(), dest.id(),
                                         src_origin, dest_origin, region, list.size(),
                                         list.events().data(), &event_id) );
    return ocl::Event(event_id, this->context());
}
开发者ID:FloWie90,项目名称:GPU-Programming,代码行数:21,代码来源:ocl_image.cpp

示例6: startUndo

void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len)/*{{{*/
{
        {
            startUndo();

            MidiPart* nPart = new MidiPart(*(MidiPart*) oPart);
            nPart->setLenTick(len);
            // Indicate no undo, and do port controller values but not clone parts.
            audio->msgChangePart(oPart, nPart, false, true, false);

            // cut Events in nPart
            // Changed by T356. Don't delete events if this is a clone part.
            // The other clones might be longer than this one and need these events.
            if (nPart->cevents()->arefCount() <= 1)
            {
                if (oPart->lenTick() > len)
                {
                    EventList* el = nPart->events();
                    iEvent ie = el->lower_bound(len);
                    for (; ie != el->end();)
                    {
                        iEvent i = ie;
                        ++ie;
                        // Indicate no undo, and do port controller values and clone parts.
                        audio->msgDeleteEvent(i->second, nPart, false, true, true);
                    }
                }
            }

            /*
            // cut Events in nPart
            // Changed by T356. Don't delete events if this is a clone part.
            // The other clones might be longer than this one and need these events.
            if(oPart->cevents()->arefCount() <= 1)
            {
              if (oPart->lenTick() > len) {
                    EventList* el = nPart->events();
                    iEvent ie = el->lower_bound(len);
                    for (; ie != el->end();) {
                          iEvent i = ie;
                          ++ie;
                          // Indicate no undo, and do not do port controller values and clone parts.
                          //audio->msgDeleteEvent(i->second, nPart, false);
                          audio->msgDeleteEvent(i->second, nPart, false, false, false);
                          }
                    }
            }
            // Indicate no undo, and do port controller values but not clone parts.
            //audio->msgChangePart(oPart, nPart, false);
            audio->msgChangePart(oPart, nPart, false, true, false);
             */

            endUndo(SC_PART_MODIFIED);
        }
}/*}}}*/
开发者ID:ViktorNova,项目名称:los,代码行数:55,代码来源:part.cpp

示例7: cmdGluePart

void Song::cmdGluePart(Track* track, Part* oPart)
{
    PartList* pl = track->parts();
    Part* nextPart = 0;

    for (iPart ip = pl->begin(); ip != pl->end(); ++ip)
    {
        if (ip->second == oPart)
        {
            ++ip;
            if (ip == pl->end())
                return;
            nextPart = ip->second;
            break;
        }
    }

    Part* nPart = track->newPart(oPart);
    nPart->setLenTick(nextPart->tick() + nextPart->lenTick() - oPart->tick());

    // populate nPart with Events from oPart and nextPart

    EventList* sl1 = oPart->events();
    EventList* dl = nPart->events();

    for (iEvent ie = sl1->begin(); ie != sl1->end(); ++ie)
        dl->add(ie->second);

    EventList* sl2 = nextPart->events();

    //int frameOffset = nextPart->frame() - oPart->frame();
    //for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie) {
    //      Event event = ie->second.clone();
    //      event.setFrame(event.frame() + frameOffset);
    //      dl->add(event);
    //      }
    // p3.3.54 Changed.

    {
        int tickOffset = nextPart->tick() - oPart->tick();
        for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie)
        {
            Event event = ie->second.clone();
            event.setTick(event.tick() + tickOffset);
            dl->add(event);
        }
    }

    startUndo();
    audio->msgRemovePart(nextPart, false);
    // Indicate no undo, and do port controller values but not clone parts.
    //audio->msgChangePart(oPart, nPart, false);
    audio->msgChangePart(oPart, nPart, false, true, false);
    endUndo(SC_PART_MODIFIED | SC_PART_REMOVED);
}
开发者ID:ViktorNova,项目名称:los,代码行数:55,代码来源:part.cpp

示例8: selectedEvents

EventList EventsView::selectedEvents() const
{
    EventList result;

    const QModelIndexList &selectedItems = selectionModel()->selectedRows();
    foreach (const QModelIndex &selectedItem, selectedItems)
    {
        EventData *eventData = selectedItem.data(EventsModel::EventDataPtr).value<EventData*>();
        if (eventData)
            result.append(*eventData);
    }
开发者ID:chenbk85,项目名称:bluecherry-client,代码行数:11,代码来源:EventsView.cpp

示例9: main

int main(int argc, char **argv)
{
    EventList eventlist;
    ProcessList processes;

    long ev_EndSimulation = 0;
    
    Traverser traverser(&eventlist);
    ColdTestCell cell1(&eventlist,&traverser);
    ColdTestCell cell2(&eventlist, &traverser);
    ColdTestCell cell3(&eventlist, &traverser);
    Source supply(&eventlist, &traverser);
    Sink derig(&eventlist);

    processes.push_back(&traverser);
    processes.push_back(&cell1);
    processes.push_back(&cell2);
    processes.push_back(&cell3);
    processes.push_back(&supply);
    processes.push_back(&derig);
    
    // Connect up production layout
    
    traverser.cell1(&cell1);
    traverser.cell2(&cell2);
    traverser.cell3(&cell3);
    traverser.infeed(&supply);
    traverser.outfeed(&derig);

    // Initialise the processes

    eventlist.push(new Event(100000,
                             nullptr,
                             ev_EndSimulation)); // End Simulation Event
    bool change;
    do {
        change = false;
        for (ProcessList::iterator i = processes.begin();
                 i != processes.end(); i++)
            change |= (*i)->run(); // Run each process until no change
    } while (change);


    // Run the event management loop.
    while (Event *event = eventlist.top()) {
        eventlist.pop(); // Remove the top element from the list
        SimulationTime += event->getTime(); // Advance simulation time
        if (event->getEventType() == ev_EndSimulation)
            break;
        event->getProcess()->HandleEvent(event);
        delete event; // no longer needed
    }
}
开发者ID:paul-jewell,项目名称:simulate,代码行数:53,代码来源:main.cpp

示例10: getProperty

/// Executes the algorithm for events
void UnaryOperation::execEvent() {
  g_log.information("Processing event workspace");

  const MatrixWorkspace_const_sptr matrixInputWS = getProperty(inputPropName());

  // generate the output workspace pointer
  API::MatrixWorkspace_sptr matrixOutputWS = getProperty(outputPropName());
  if (matrixOutputWS != matrixInputWS) {
    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
    setProperty(outputPropName(), matrixOutputWS);
  }
  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);

  // Now fetch any properties defined by concrete algorithm
  retrieveProperties();

  int64_t numHistograms = static_cast<int64_t>(outputWS->getNumberHistograms());
  API::Progress prog = API::Progress(this, 0.0, 1.0, numHistograms);
  PARALLEL_FOR1(outputWS)
  for (int64_t i = 0; i < numHistograms; ++i) {
    PARALLEL_START_INTERUPT_REGION
    // switch to weighted events if needed, and use the appropriate helper
    // function
    EventList *evlist = outputWS->getEventListPtr(i);
    switch (evlist->getEventType()) {
    case TOF:
      // Switch to weights if needed.
      evlist->switchTo(WEIGHTED);
    /* no break */
    // Fall through

    case WEIGHTED:
      unaryOperationEventHelper(evlist->getWeightedEvents());
      break;

    case WEIGHTED_NOTIME:
      unaryOperationEventHelper(evlist->getWeightedEventsNoTime());
      break;
    }

    prog.report();
    PARALLEL_END_INTERUPT_REGION
  }
  PARALLEL_CHECK_INTERUPT_REGION

  outputWS->clearMRU();
  auto inputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
  if (inputWS->getNumberEvents() != outputWS->getNumberEvents()) {
    g_log.information() << "Number of events has changed!!!" << std::endl;
  }
}
开发者ID:dezed,项目名称:mantid,代码行数:52,代码来源:UnaryOperation.cpp

示例11: part

void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2)
{
    int l1 = 0; // len of first new part (ticks or samples)
    int l2 = 0; // len of second new part

    int samplepos = tempomap.tick2frame(tickpos);

    {
            l1 = tickpos - part->tick();
            l2 = part->lenTick() - l1;
    }

    if (l1 <= 0 || l2 <= 0)
        return;

    p1 = newPart(part); // new left part
    p2 = newPart(part); // new right part

    // Added by Tim. p3.3.6
    //printf("Track::splitPart part ev %p sz:%d ref:%d p1 %p sz:%d ref:%d p2 %p sz:%d ref:%d\n", part->events(), part->events()->size(), part->events()->arefCount(), p1->events(), p1->events()->size(), p1->events()->arefCount(), p2->events(), p2->events()->size(), p2->events()->arefCount());

    {
            p1->setLenTick(l1);
            p2->setTick(tickpos);
            p2->setLenTick(l2);
    }

    p2->setSn(p2->newSn());

    EventList* se = part->events();
    EventList* de1 = p1->events();
    EventList* de2 = p2->events();

    p1->setColorIndex(part->colorIndex());
    p2->setColorIndex(part->colorIndex());

    {
        for (iEvent ie = se->begin(); ie != se->end(); ++ie)
        {
            Event event = ie->second.clone();
            int t = event.tick();
            if (t >= l1)
            {
                event.move(-l1);
                de2->add(event);
            }
            else
                de1->add(event);
        }
    }
}
开发者ID:ViktorNova,项目名称:los,代码行数:51,代码来源:part.cpp

示例12: a_hoster_stops_updating

void EventListIntegration::a_hoster_stops_updating()
{
    EventList testee;

    const QString expected_user = "Dave";
    const QString expected_event = "Beer";
    testee.update_event(expected_user, expected_event);

    IM::Events result = testee.get_active_events();
    QCOMPARE(result.size(), 1);
    QCOMPARE(result.first().nick_name, expected_user);
    QCOMPARE(result.first().event_name, expected_event);

    QSignalSpy block_and(this, SIGNAL(dummy()));

    block_and.wait(4000);
    testee.update_event(expected_user, expected_event);
    result = testee.get_active_events();
    QCOMPARE(result.size(), 1);
    QCOMPARE(result.first().nick_name, expected_user);
    QCOMPARE(result.first().event_name, expected_event);

    block_and.wait(4000);
    testee.update_event(expected_user, expected_event);
    result = testee.get_active_events();
    QCOMPARE(result.size(), 1);
    QCOMPARE(result.first().nick_name, expected_user);
    QCOMPARE(result.first().event_name, expected_event);

    block_and.wait(7800);

    result = testee.get_active_events();

    QCOMPARE(result.size(), 0);
}
开发者ID:rreinhard,项目名称:qt-workshop,代码行数:35,代码来源:eventlist_integration.cpp

示例13: EventList

EventList*
EventList::allEventsForObject(QObject *widget)
{
    if (!widget)  return 0;

    EventList *l = new EventList();
    EventList::ConstIterator endIt = constEnd();
    for (EventList::ConstIterator it = constBegin(); it != endIt; ++it) {
        if (((*it)->sender() == widget) || ((*it)->receiver() == widget))
            l->addEvent(*it);
    }

    return l;
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:14,代码来源:kexievents.cpp

示例14: EventSource

QueueLoggerSampling::QueueLoggerSampling(simtime_picosec period, EventList &eventlist)
: EventSource(eventlist,"QueuelogSampling"),
        _queue(NULL), _lastlook(0), _period(period), _lastq(0), 
	_seenQueueInD(false), _cumidle(0), _cumarr(0), _cumdrop(0)
	{	
	eventlist.sourceIsPendingRel(*this,0);
	}
开发者ID:Dexhub,项目名称:SDN-Common-REpo,代码行数:7,代码来源:loggers.cpp

示例15: UpdateEvent

/// Обновление
  void UpdateEvent (const char* name, ResourceState state)
  {
    EventMap::iterator iter = event_map.find (name);

    if (iter == event_map.end ())
    {
      EventPtr event = EventPtr (new EventDesc (name, state), false);

      EventList::iterator iter = event_list.insert (event_list.end (), event);

      event_map.insert_pair (name, iter);
    }
    else
    {
      EventPtr event = *iter->second;

      if (state == event->state)
        return;

      if (event->state == ResourceState_Ignore)
      {
        event_list.splice (event_list.end (), event_list, iter->second);

        event->state = state;

        return;
      }

      switch (state)
      {
        case ResourceState_Unloaded:
          event->state = ResourceState_Ignore;
          break;
        case ResourceState_Prefetched:
          if (event->state != ResourceState_Unloaded)
            return;

          event_list.splice (event_list.end (), event_list, iter->second);

          event->state = state;          

          break;
        case ResourceState_Loaded:
          if (event->state == ResourceState_Unloaded) event->state = ResourceState_Ignore;
          else 
          {
            event_list.splice (event_list.end (), event_list, iter->second);

            event->state = state;
          }

          break;
        default:
          break;
      }
    }    
  }
开发者ID:untgames,项目名称:funner,代码行数:58,代码来源:rms_event_batcher.cpp


注:本文中的EventList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。