File: testq_plain.m

package info (click to toggle)
mwrap 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,548 kB
  • sloc: cpp: 3,315; python: 1,850; ansic: 856; makefile: 258; lex: 233; sh: 145
file content (19 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
% testq_plain.m
%   Test case / demo of MWrap bindings to a C++ event queue class.
%
% Copyright (c) 2007  David Bindel
% See the file COPYING for copying permissions

q = EventQ_new();

EventQ_push(q, 1, 1.5);
EventQ_push(q, 2, 0.4);
EventQ_push(q, 3, 10);
EventQ_push(q, [4, 5], [8, 11]);

while ~EventQ_empty(q)
  [id,t] = EventQ_pop(q);
  fprintf('Time %g: Saw %d\n', t, id);
end

EventQ_destroy(q);