| 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 RADIOMETADATA_P_H |
|---|
| 24 | #define RADIOMETADATA_P_H |
|---|
| 25 | |
|---|
| 26 | #include <string> |
|---|
| 27 | #include <vector> |
|---|
| 28 | |
|---|
| 29 | #include <standardinterfaces-metadata/RadioMetaData.h> |
|---|
| 30 | #include "standardinterfaces-metadata/RadioMetaData_impl.h" |
|---|
| 31 | |
|---|
| 32 | namespace RadioMetaData { |
|---|
| 33 | class providesPort; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | namespace standardInterfacesMD_i { |
|---|
| 37 | class RadioMetaData_p { |
|---|
| 38 | friend class RadioMetaData::providesPort; |
|---|
| 39 | |
|---|
| 40 | public: |
|---|
| 41 | RadioMetaData_p(const char* portName, unsigned int bufLen = 5); |
|---|
| 42 | RadioMetaData_p(const char* portName, const char* domainName, unsigned int bufLen = 5); |
|---|
| 43 | ~RadioMetaData_p(); |
|---|
| 44 | |
|---|
| 45 | CORBA::Object_ptr getPort(const char* portName); |
|---|
| 46 | |
|---|
| 47 | void getMetaData(standardInterfacesMD::MetaData* &packet_data); |
|---|
| 48 | |
|---|
| 49 | void bufferEmptied() { ready_for_input->post(); }; |
|---|
| 50 | |
|---|
| 51 | private: |
|---|
| 52 | RadioMetaData_p(); |
|---|
| 53 | RadioMetaData_p(const RadioMetaData_p &); |
|---|
| 54 | |
|---|
| 55 | std::string portName; |
|---|
| 56 | |
|---|
| 57 | // Provides port |
|---|
| 58 | RadioMetaData::providesPort *data_servant; |
|---|
| 59 | standardInterfacesMD::RadioMetaData_var data_servant_var; |
|---|
| 60 | |
|---|
| 61 | // Buffer storage |
|---|
| 62 | unsigned int bufferLength; |
|---|
| 63 | unsigned int rdPtr; |
|---|
| 64 | unsigned int wrPtr; |
|---|
| 65 | std::vector <standardInterfacesMD::MetaData> metadata_buf; |
|---|
| 66 | |
|---|
| 67 | // Semaphores for synchronization |
|---|
| 68 | omni_semaphore *data_ready; // Ready to process data |
|---|
| 69 | omni_semaphore *ready_for_input; // Ready to receive more data |
|---|
| 70 | |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | namespace RadioMetaData { |
|---|
| 76 | |
|---|
| 77 | class providesPort : public POA_standardInterfacesMD::RadioMetaData { |
|---|
| 78 | public: |
|---|
| 79 | providesPort(standardInterfacesMD_i::RadioMetaData_p* _base); |
|---|
| 80 | ~providesPort(); |
|---|
| 81 | |
|---|
| 82 | void pushMetaData(const standardInterfacesMD::MetaData &packet_data); |
|---|
| 83 | |
|---|
| 84 | private: |
|---|
| 85 | standardInterfacesMD_i::RadioMetaData_p* base; |
|---|
| 86 | }; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | #endif |
|---|