| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2007 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE _base_. |
|---|
| 6 | |
|---|
| 7 | OSSIE _base_ is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE _base_ 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 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE _base_; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | #include <stdlib.h> |
|---|
| 24 | #include "ossie/cf.h" |
|---|
| 25 | #include "ossie/PortTypes.h" |
|---|
| 26 | #include "ossie/Resource_impl.h" |
|---|
| 27 | #include "ossie/debug.h" |
|---|
| 28 | |
|---|
| 29 | #include "standardinterfaces/complexShort_u.h" |
|---|
| 30 | #include "standardinterfaces/complexShort_p.h" |
|---|
| 31 | |
|---|
| 32 | #include <boost/shared_ptr.hpp> |
|---|
| 33 | #include <boost/utility.hpp> |
|---|
| 34 | |
|---|
| 35 | typedef boost::shared_ptr<standardInterfaces_i::complexShort_u> complexShort_u_sptr; |
|---|
| 36 | typedef boost::shared_ptr<standardInterfaces_i::complexShort_p> complexShort_p_sptr; |
|---|
| 37 | |
|---|
| 38 | class _base__i : public virtual Resource_impl, |
|---|
| 39 | boost::noncopyable |
|---|
| 40 | { |
|---|
| 41 | public: |
|---|
| 42 | _base__i(const char *uuid, omni_condition *sem); |
|---|
| 43 | ~_base__i(void); |
|---|
| 44 | |
|---|
| 45 | // SCA Resource Interfaces |
|---|
| 46 | void start() |
|---|
| 47 | throw (CF::Resource::StartError, CORBA::SystemException); |
|---|
| 48 | void stop() |
|---|
| 49 | throw (CF::Resource::StopError, CORBA::SystemException); |
|---|
| 50 | CORBA::Object_ptr getPort( const char* portName ) |
|---|
| 51 | throw (CF::PortSupplier::UnknownPort, CORBA::SystemException); |
|---|
| 52 | void releaseObject() |
|---|
| 53 | throw (CF::LifeCycle::ReleaseError, CORBA::SystemException); |
|---|
| 54 | void initialize() |
|---|
| 55 | throw (CF::LifeCycle::InitializeError, CORBA::SystemException); |
|---|
| 56 | void configure(const CF::Properties&) |
|---|
| 57 | throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, |
|---|
| 58 | CF::PropertySet::PartialConfiguration); |
|---|
| 59 | |
|---|
| 60 | private: |
|---|
| 61 | _base__i(); |
|---|
| 62 | |
|---|
| 63 | // Threading & Control |
|---|
| 64 | static void process_data(void *g); |
|---|
| 65 | omni_condition *component_running; |
|---|
| 66 | omni_thread *processing_thread; |
|---|
| 67 | volatile bool processing_active; |
|---|
| 68 | |
|---|
| 69 | // Ports |
|---|
| 70 | complexShort_p_sptr p_in; |
|---|
| 71 | complexShort_u_sptr p_out; |
|---|
| 72 | }; |
|---|