| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2006, Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Core Framework. |
|---|
| 6 | |
|---|
| 7 | OSSIE Core Framework is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the Lesser GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2.1 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE Core Framework is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | Lesser GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the Lesser GNU General Public License |
|---|
| 18 | along with OSSIE Core Framework; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | #ifndef REALCHAR_P_H |
|---|
| 24 | #define REALCHAR_P_H |
|---|
| 25 | |
|---|
| 26 | #include <string> |
|---|
| 27 | #include <vector> |
|---|
| 28 | |
|---|
| 29 | #include <standardinterfaces-metadata/realCharMD.h> |
|---|
| 30 | #include "standardinterfaces-metadata/RadioMetaData_impl.h" |
|---|
| 31 | |
|---|
| 32 | namespace realChar { |
|---|
| 33 | class providesPort; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | namespace standardInterfaces_i { |
|---|
| 37 | class realChar_p { |
|---|
| 38 | friend class realChar::providesPort; |
|---|
| 39 | |
|---|
| 40 | public: |
|---|
| 41 | realChar_p(const char* portName, unsigned int bufLen = 5); |
|---|
| 42 | ~realChar_p(); |
|---|
| 43 | |
|---|
| 44 | CORBA::Object_ptr getPort(const char* portName); |
|---|
| 45 | |
|---|
| 46 | void getData( |
|---|
| 47 | PortTypes::CharSequence* &I); |
|---|
| 48 | |
|---|
| 49 | void getData( |
|---|
| 50 | PortTypes::CharSequence* &I, |
|---|
| 51 | standardInterfaces::MetaData* &packet_data); |
|---|
| 52 | |
|---|
| 53 | void bufferEmptied(); |
|---|
| 54 | |
|---|
| 55 | private: |
|---|
| 56 | realChar_p(); |
|---|
| 57 | realChar_p(const realChar_p &); |
|---|
| 58 | |
|---|
| 59 | std::string portName; |
|---|
| 60 | |
|---|
| 61 | // Provides port |
|---|
| 62 | realChar::providesPort *data_servant; |
|---|
| 63 | standardInterfaces::realChar_var data_servant_var; |
|---|
| 64 | |
|---|
| 65 | // Buffer storage |
|---|
| 66 | unsigned int bufferLength; |
|---|
| 67 | unsigned int rdPtr; |
|---|
| 68 | unsigned int wrPtr; |
|---|
| 69 | std::vector <PortTypes::CharSequence> I_buf; |
|---|
| 70 | std::vector <standardInterfaces::MetaData> metadata_buf; |
|---|
| 71 | |
|---|
| 72 | // Semaphores for synchronization |
|---|
| 73 | omni_semaphore *data_ready; // Ready to process data |
|---|
| 74 | omni_semaphore *ready_for_input; // Ready to receive more data |
|---|
| 75 | |
|---|
| 76 | // packet meta data |
|---|
| 77 | standardInterfaces::MetaData metadata; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | }; |
|---|
| 82 | |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | namespace realChar { |
|---|
| 86 | |
|---|
| 87 | class providesPort : public POA_standardInterfaces::realChar { |
|---|
| 88 | public: |
|---|
| 89 | providesPort(standardInterfaces_i::realChar_p* _base); |
|---|
| 90 | ~providesPort(); |
|---|
| 91 | |
|---|
| 92 | void pushPacket(const PortTypes::CharSequence &I); |
|---|
| 93 | |
|---|
| 94 | void pushPacketMetaData( |
|---|
| 95 | const PortTypes::CharSequence &I, |
|---|
| 96 | const standardInterfaces::MetaData &packet_data); |
|---|
| 97 | |
|---|
| 98 | private: |
|---|
| 99 | standardInterfaces_i::realChar_p* base; |
|---|
| 100 | }; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | #endif |
|---|