Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / compileonly / mfgen-tpd / library / HelloTpd / src / PCOType.cc
CommitLineData
970ed795 1///////////////////////////////////////////////////////////////////////////////
3abe9331 2// Copyright (c) 2000-2015 Ericsson Telecom AB
970ed795
EL
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
21namespace MyExample {
22
23PCOType::PCOType(const char *par_port_name)
24: PCOType_BASE(par_port_name)
25{
26
27}
28
29PCOType::~PCOType()
30{
31
32}
33
34void PCOType::set_parameter(const char *parameter_name,
35const char *parameter_value)
36{
37
38}
39
40void PCOType::Event_Handler(const fd_set *read_fds,
41const fd_set *write_fds, const fd_set *error_fds,
42double time_since_last_call)
43{
44size_t buf_len = 0, buf_size = 32;
45char *buf = (char*)Malloc(buf_size);
46for ( ; ; ) {
47int c = getc(stdin);
48if (c == EOF) {
49if (buf_len > 0) incoming_message(CHARSTRING(buf_len, buf));
50Uninstall_Handler();
51break;
52} else if (c == 'n') {
53incoming_message(CHARSTRING(buf_len, buf));
54break;
55} else {
56if (buf_len >= buf_size) {
57buf_size *= 2;
58buf = (char*)Realloc(buf, buf_size);
59}
60buf[buf_len++] = c;
61}
62}
63Free(buf);
64}
65
66void PCOType::user_map(const char *system_port)
67{
68fd_set readfds;
69FD_ZERO(&readfds);
70FD_SET(fileno(stdin), &readfds);
71Install_Handler(&readfds, NULL, NULL, 0.0);
72}
73
74void PCOType::user_unmap(const char *system_port)
75{
76Uninstall_Handler();
77}
78
79void PCOType::user_start()
80{
81
82}
83
84void PCOType::user_stop()
85{
86
87}
88
89void PCOType::outgoing_send(const CHARSTRING& send_par)
90{
91puts((const char*)send_par);
92fflush(stdout);
93}
94
95} /* end of namespace */
96
This page took 0.02774 seconds and 5 git commands to generate.