Sync with 5.4.2
[deliverable/titan.core.git] / regression_test / makefilegen / makefilegen_envvar_test / testA / Test / src / PCOType.cc
1 // This Test Port skeleton source file was generated by the
2 // TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/4 R2A
3 // for Arpad Lovassy (earplov@esekilxxen1841) on Tue Jul 22 16:49:55 2014
4
5 // Copyright Ericsson Telecom AB 2000-2014
6
7 // You may modify this file. Complete the body of empty functions and// add your member functions here.
8
9 #include "PCOType.hh"
10 #include "memory.h"
11
12 #include <stdio.h>
13
14 namespace MyExample {
15
16 PCOType::PCOType(const char *par_port_name)
17 : PCOType_BASE(par_port_name)
18 {
19
20 }
21
22 PCOType::~PCOType()
23 {
24
25 }
26
27 void PCOType::set_parameter(const char * /*parameter_name*/,
28 const char * /*parameter_value*/)
29 {
30
31 }
32
33 void PCOType::Event_Handler(const fd_set *read_fds,
34 const fd_set *write_fds, const fd_set *error_fds,
35 double time_since_last_call)
36 {
37 size_t buf_len = 0, buf_size = 32;
38 char *buf = (char*)Malloc(buf_size);
39 for ( ; ; ) {
40 int c = getc(stdin);
41 if (c == EOF) {
42 if (buf_len > 0) incoming_message(CHARSTRING(buf_len, buf));
43 Uninstall_Handler();
44 break;
45 } else if (c == '\n') {
46 incoming_message(CHARSTRING(buf_len, buf));
47 break;
48 } else {
49 if (buf_len >= buf_size) {
50 buf_size *= 2;
51 buf = (char*)Realloc(buf, buf_size);
52 }
53 buf[buf_len++] = c;
54 }
55 }
56 Free(buf);
57 }
58
59 /*void PCOType::Handle_Fd_Event(int fd, boolean is_readable,
60 boolean is_writable, boolean is_error) {}*/
61
62 void PCOType::Handle_Fd_Event_Error(int /*fd*/)
63 {
64
65 }
66
67 void PCOType::Handle_Fd_Event_Writable(int /*fd*/)
68 {
69
70 }
71
72 void PCOType::Handle_Fd_Event_Readable(int /*fd*/)
73 {
74
75 }
76
77 /*void PCOType::Handle_Timeout(double time_since_last_call) {}*/
78
79 void PCOType::user_map(const char *system_port)
80 {
81 fd_set readfds;
82 FD_ZERO(&readfds);
83 FD_SET(fileno(stdin), &readfds);
84 Install_Handler(&readfds, NULL, NULL, 0.0);
85 }
86
87 void PCOType::user_unmap(const char *system_port)
88 {
89 Uninstall_Handler();
90 }
91
92 void PCOType::user_start()
93 {
94
95 }
96
97 void PCOType::user_stop()
98 {
99
100 }
101
102 void PCOType::outgoing_send(const CHARSTRING& send_par)
103 {
104 puts((const char*)send_par);
105 fflush(stdout);
106 }
107
108 } /* end of namespace */
This page took 0.05661 seconds and 6 git commands to generate.