root/standardInterfaces/trunk/standardInterfaces/realChar_p.cpp @ 4945

Revision 4945, 2.3 KB (checked in by jgaeddert, 6 years ago)

moving bufferEmptied() method in complexShort and realChar provides port from .h to .cpp files. This allows the implementation of the standardInterfaces (MetaData) to be binary compatible with the trunk version of standardInterfaces

Line 
1/****************************************************************************
2
3Copyright 2006, Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Core Framework.
6
7OSSIE Core Framework is free software; you can redistribute it and/or modify
8it under the terms of the Lesser GNU General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or
10(at your option) any later version.
11
12OSSIE Core Framework is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15Lesser GNU General Public License for more details.
16
17You should have received a copy of the Lesser GNU General Public License
18along with OSSIE Core Framework; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23#include <iostream>
24
25#include <standardinterfaces/realChar_p.h>
26
27standardInterfaces_i::realChar_p::realChar_p(const char* _name, unsigned int bufLen) : portName(_name), bufferLength(bufLen), rdPtr(0), wrPtr(0)
28{
29
30    data_servant = new realChar::providesPort(this);
31    data_servant_var = data_servant->_this();
32
33    PortTypes::CharSequence a;
34    I_buf.assign(bufferLength, a);
35
36    ready_for_input = new omni_semaphore(bufferLength);
37    data_ready = new omni_semaphore(0);
38}
39
40standardInterfaces_i::realChar_p::~realChar_p()
41{
42
43}
44
45CORBA::Object_ptr standardInterfaces_i::realChar_p::getPort(const char* _portName)
46{
47    if (portName == _portName)
48        return CORBA::Object::_duplicate(data_servant_var);
49    else
50        return CORBA::Object::_nil();
51}
52
53void standardInterfaces_i::realChar_p::bufferEmptied()
54{
55    ready_for_input->post();
56}
57
58void standardInterfaces_i::realChar_p::getData(PortTypes::CharSequence* &I)
59{
60    data_ready->wait();
61
62    I = &I_buf[rdPtr];
63    rdPtr = ++rdPtr % bufferLength;
64}
65
66realChar::providesPort::providesPort(standardInterfaces_i::realChar_p* _base) : base(_base)
67{
68
69}
70
71realChar::providesPort::~providesPort()
72{
73
74}
75
76void realChar::providesPort::pushPacket(const PortTypes::CharSequence &I)
77{
78    base->ready_for_input->wait();
79
80    base->I_buf[base->wrPtr] = I;
81    base->wrPtr= ++base->wrPtr % base->bufferLength;
82
83    base->data_ready->post();
84}
Note: See TracBrowser for help on using the browser.