annotate example/ResizeWritebuf/ppe/Resize.cc @ 2048:6796d85f3d6b draft

remove error
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Thu, 28 Jan 2016 00:05:49 +0900
parents 8d2a1f5edf10
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "SchedTask.h"
1100
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1099
diff changeset
3 #include "../Container.h"
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include "Resize.h"
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 #include "Func.h"
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 /* これは必須 */
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 SchedDefineTask1(Resize,resize);
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 static int
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 resize(SchedTask *smanager, void *rbuf, void *wbuf)
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 {
1102
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
13 long length = (long)smanager->get_param(0);
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
1102
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
15 smanager->set_outputSize(0, sizeof(Container)+sizeof(int)*(length-1));
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 smanager->setup_outputData();
1102
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
17
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
18 ContainerPtr wcontainer = (ContainerPtr)smanager->get_output(wbuf, 0);
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
1102
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
20 for (int i =0; i < length;i++){
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
21 wcontainer->data[i] = i;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
22 }
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
23
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1100
diff changeset
24 wcontainer->length = length;
1099
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 return 0;
3b3b535baa51 add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }