| 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 COMPLEXSHORT_U_H |
|---|
| 24 | #define COMPLEXSHORT_U_H |
|---|
| 25 | |
|---|
| 26 | #include <string> |
|---|
| 27 | #include <vector> |
|---|
| 28 | |
|---|
| 29 | #ifdef HAVE_OMNIORB4 |
|---|
| 30 | #include "omniORB4/CORBA.h" |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | #include <omnithread.h> |
|---|
| 34 | |
|---|
| 35 | #include <ossie/PortTypes.h> |
|---|
| 36 | #include <ossie/cf.h> |
|---|
| 37 | |
|---|
| 38 | #include <standardinterfaces-metadata/complexShortMD.h> |
|---|
| 39 | #include "standardinterfaces-metadata/RadioMetaData_impl.h" |
|---|
| 40 | |
|---|
| 41 | // Forward declaration |
|---|
| 42 | namespace complexShort { |
|---|
| 43 | |
|---|
| 44 | class usesPort; |
|---|
| 45 | class ConnectionInfo; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | namespace standardInterfacesMD_i { |
|---|
| 49 | |
|---|
| 50 | class complexShort_u { |
|---|
| 51 | friend class complexShort::usesPort; |
|---|
| 52 | |
|---|
| 53 | public: |
|---|
| 54 | complexShort_u(const char* portName); |
|---|
| 55 | complexShort_u(const char* portName, const char* domainName); |
|---|
| 56 | ~complexShort_u(); |
|---|
| 57 | |
|---|
| 58 | CORBA::Object_ptr getPort(const char* portName); |
|---|
| 59 | |
|---|
| 60 | void pushPacket( |
|---|
| 61 | const PortTypes::ShortSequence &I, |
|---|
| 62 | const PortTypes::ShortSequence &Q); |
|---|
| 63 | |
|---|
| 64 | void pushPacket( |
|---|
| 65 | const PortTypes::ShortSequence &I, |
|---|
| 66 | const PortTypes::ShortSequence &Q, |
|---|
| 67 | const standardInterfacesMD::MetaData &packet_data); |
|---|
| 68 | |
|---|
| 69 | private: |
|---|
| 70 | complexShort_u(); |
|---|
| 71 | complexShort_u(const complexShort_u &); |
|---|
| 72 | |
|---|
| 73 | std::string portName; |
|---|
| 74 | |
|---|
| 75 | // Uses port |
|---|
| 76 | complexShort::usesPort *data_servant; |
|---|
| 77 | CF::Port_var data_servant_var; |
|---|
| 78 | std::vector <complexShort::ConnectionInfo> dest_ports; |
|---|
| 79 | omni_mutex port_mutex; |
|---|
| 80 | |
|---|
| 81 | /// Data to be pushed for each packet |
|---|
| 82 | standardInterfacesMD::MetaData metadata; |
|---|
| 83 | |
|---|
| 84 | }; |
|---|
| 85 | |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | namespace complexShort { |
|---|
| 89 | |
|---|
| 90 | class usesPort : public virtual POA_CF::Port { |
|---|
| 91 | public: |
|---|
| 92 | usesPort(standardInterfacesMD_i::complexShort_u *_base); |
|---|
| 93 | ~usesPort(); |
|---|
| 94 | |
|---|
| 95 | void connectPort(CORBA::Object_ptr connection, const char* connectionID); |
|---|
| 96 | void disconnectPort(const char* connectionID); |
|---|
| 97 | |
|---|
| 98 | private: |
|---|
| 99 | standardInterfacesMD_i::complexShort_u *base; |
|---|
| 100 | }; |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | class ConnectionInfo |
|---|
| 104 | { |
|---|
| 105 | public: |
|---|
| 106 | ConnectionInfo(standardInterfacesMD::complexShortMD_ptr _port, const char* _ID) : port_obj( _port), identifier(_ID) { }; |
|---|
| 107 | ConnectionInfo(const ConnectionInfo & c) { port_obj = c.port_obj; identifier = c.identifier;}; |
|---|
| 108 | |
|---|
| 109 | void setPort(standardInterfacesMD::complexShortMD_ptr _port) {port_obj = _port; }; |
|---|
| 110 | const char *getID() {return identifier.c_str(); }; |
|---|
| 111 | |
|---|
| 112 | standardInterfacesMD::complexShortMD_var port_obj; |
|---|
| 113 | |
|---|
| 114 | private: |
|---|
| 115 | ConnectionInfo(); // No default constructor |
|---|
| 116 | |
|---|
| 117 | std::string identifier; |
|---|
| 118 | }; |
|---|
| 119 | |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | #endif |
|---|