1 | /**
|
---|
2 | * @fileOverview
|
---|
3 | * Documentation of the Event object returned by Subscription.get()
|
---|
4 | */
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * @class
|
---|
8 | *
|
---|
9 | * The object returned by Subscription.get(). It contains
|
---|
10 | * all data received with the event.
|
---|
11 | *
|
---|
12 | */
|
---|
13 | function Event()
|
---|
14 | {
|
---|
15 | /**
|
---|
16 | * The name of the Subscription this event belongs to.
|
---|
17 | *
|
---|
18 | * @type String
|
---|
19 | * @constant
|
---|
20 | */
|
---|
21 | this.name = name;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The format string corresponding to this event.
|
---|
25 | *
|
---|
26 | * @see <A HREF="dim.cern.ch">DIM</A> for more details
|
---|
27 | * @type String
|
---|
28 | * @constant
|
---|
29 | */
|
---|
30 | this.format = format;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The Quality-of-Service transmitted by this event.
|
---|
34 | *
|
---|
35 | * @type Integer
|
---|
36 | * @constant
|
---|
37 | */
|
---|
38 | this.qos = qos;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * The size in bytes of the event received
|
---|
42 | *
|
---|
43 | * @type Integer
|
---|
44 | * @constant
|
---|
45 | */
|
---|
46 | this.size = size;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * An counter of events received since the Subscription has
|
---|
50 | * been created. The first event received is 1. 0 corresponds
|
---|
51 | * to no event received yet.
|
---|
52 | *
|
---|
53 | * @type Integer
|
---|
54 | * @constant
|
---|
55 | */
|
---|
56 | this.counter = counter;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * The time transmitted with this event, if transmitted. If nonw
|
---|
60 | * was transmitted, this might just be the time the event was
|
---|
61 | * received.
|
---|
62 | *
|
---|
63 | * @type Date
|
---|
64 | * @constant
|
---|
65 | */
|
---|
66 | this.time = time;
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Array with the data received.
|
---|
70 | *
|
---|
71 | * The contents of the array are sorted in the order of the event format
|
---|
72 | * string. The contents of the array can be all kind of objects
|
---|
73 | * defined by the format string. If a format described several entries
|
---|
74 | * (e.g. I:5) and array will be added.<P>
|
---|
75 | *
|
---|
76 | * In the special case that the format string contains only a single
|
---|
77 | * format, e.g. "I", "F:5" or "C", data will not be an array,
|
---|
78 | * but contain the object data (or the array) directly.
|
---|
79 | *
|
---|
80 | * If valid data was received, but the size was zero, then
|
---|
81 | * null is returned as data
|
---|
82 | *
|
---|
83 | * <li> data===undefined: no data received (no connection)
|
---|
84 | * <li> data===null: an event was received, but it was empty
|
---|
85 | * <li> data.length>0: an event was received and it contains data
|
---|
86 | *
|
---|
87 | * @type Array
|
---|
88 | * @constant
|
---|
89 | *
|
---|
90 | */
|
---|
91 | this.data = [ ];
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Object with the data received.
|
---|
95 | *
|
---|
96 | * The object contains essentially the same information than the
|
---|
97 | * data memeber, but the received data are added as properties
|
---|
98 | * instead of enumerable lements. This allows to access
|
---|
99 | * the received data by names as specified by the SERVICE_DESC
|
---|
100 | * service.<P>
|
---|
101 | *
|
---|
102 | * If an empty event was received, but names are available,
|
---|
103 | * the object will be empty. Otherwise 'obj' will be undefined.
|
---|
104 | *
|
---|
105 | * <li> obj===undefined: no names are available
|
---|
106 | * <li> obj!==undefined, length==0: names are available, but no data (no connection)
|
---|
107 | * <li> obj!==undefined, length>0: names are available, data has been received
|
---|
108 | *
|
---|
109 | * <P>
|
---|
110 | * Note that to get the number of properties (length) you have to call
|
---|
111 | * Object.keys(obj).length;
|
---|
112 | *
|
---|
113 | * @type Object
|
---|
114 | * @constant
|
---|
115 | *
|
---|
116 | */
|
---|
117 | this.obj = { };
|
---|
118 | }
|
---|