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