Titan Core Initial Contribution
[deliverable/titan.core.git] / regression_test / compileonly / mfgen-tpd / invalid_buildconfig_tpd / Hello000 / src / PCOType0.cc
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 // This Test Port skeleton source file was generated by the
9 // TTCN-3 Compiler of the TTCN-3 Test Executor version 1.5.pl7
10 // for Janos Zoltan Szabo (ejnosza@balisea) on Mon Sep 13 09:35:21 2004
11
12
13 // You may modify this file. Complete the body of empty functions and
14 // add your member functions here.
15
16 #include <stdio.h>
17
18 #include "PCOType.hh"
19 #include "memory.h"
20
21 namespace MyExample {
22
23 PCOType::PCOType(const char *par_port_name)
24 : PCOType_BASE(par_port_name)
25 {
26
27 }
28
29 PCOType::~PCOType()
30 {
31
32 }
33
34 void PCOType::set_parameter(const char *parameter_name,
35 const char *parameter_value)
36 {
37
38 }
39
40 void PCOType::Event_Handler(const fd_set *read_fds,
41 const fd_set *write_fds, const fd_set *error_fds,
42 double time_since_last_call)
43 {
44 size_t buf_len = 0, buf_size = 32;
45 char *buf = (char*)Malloc(buf_size);
46 for ( ; ; ) {
47 int c = getc(stdin);
48 if (c == EOF) {
49 if (buf_len > 0) incoming_message(CHARSTRING(buf_len, buf));
50 Uninstall_Handler();
51 break;
52 } else if (c == 'n') {
53 incoming_message(CHARSTRING(buf_len, buf));
54 break;
55 } else {
56 if (buf_len >= buf_size) {
57 buf_size *= 2;
58 buf = (char*)Realloc(buf, buf_size);
59 }
60 buf[buf_len++] = c;
61 }
62 }
63 Free(buf);
64 }
65
66 void PCOType::user_map(const char *system_port)
67 {
68 fd_set readfds;
69 FD_ZERO(&readfds);
70 FD_SET(fileno(stdin), &readfds);
71 Install_Handler(&readfds, NULL, NULL, 0.0);
72 }
73
74 void PCOType::user_unmap(const char *system_port)
75 {
76 Uninstall_Handler();
77 }
78
79 void PCOType::user_start()
80 {
81
82 }
83
84 void PCOType::user_stop()
85 {
86
87 }
88
89 void PCOType::outgoing_send(const CHARSTRING& send_par)
90 {
91 puts((const char*)send_par);
92 fflush(stdout);
93 }
94
95 } /* end of namespace */
96
This page took 0.042028 seconds and 5 git commands to generate.