-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stream.cc
78 lines (68 loc) · 1.43 KB
/
Stream.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- C++ -*-
//
// Package: Package
// Class : Stream
//
// Implementation:
// [Notes on implementation]
//
// Original Author: Chris Jones
// Created: Thu, 14 Mar 2013 19:25:35 GMT
// $Id$
//
// system include files
#include "tbb/task.h"
// user include files
#include "Stream.h"
#include "Run.h"
#include "GlobalWatcher.h"
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// constructors and destructor
//
Stream::Stream(unsigned int iID, GlobalWatcher* iWatcher):
m_id(iID),m_state(kInitialized),m_runTransitionID(0),m_run(0),
m_watcher(iWatcher)
{
m_watcher->beginStream(m_id);
}
// Stream::Stream(const Stream& rhs)
// {
// // do actual copying here;
// }
//Stream::~Stream()
//{
//}
void
Stream::processBeginRun(Run const* iRun) {
m_runTransitionID = iRun->transitionID();
m_run = iRun;
m_state = kBeginRun;
m_watcher->streamBeginRun(m_id,*iRun);
}
void
Stream::processEvent() {
m_state = kEvent;
m_watcher->event(m_id,m_event);
}
//will decrement iDoneTask and if reach 0 will spawn it
// this allows global end run to be called once all streams
// are done with a
void
Stream::processEndRun() {
m_state=kEndRun;
m_watcher->streamEndRun(m_id,*m_run);
}
void
Stream::processEndStream(tbb::task* iDoneTask) {
m_watcher->endStream(m_id);
m_state=kFinished;
if(0==iDoneTask->decrement_ref_count()) {
tbb::task::spawn(*iDoneTask);
}
}