Line data Source code
1 : //# SerialTransport.h: simple/default transport model implemented as a simple queue 2 : //# Copyright (C) 1998,1999,2000 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : //# $Id$ 28 : 29 : #ifndef SYNTHESIS_SERIALTRANSPORT_H 30 : #define SYNTHESIS_SERIALTRANSPORT_H 31 : 32 : #include <synthesis/Parallel/PTransport.h> 33 : 34 : namespace casa { //# NAMESPACE CASA - BEGIN 35 : 36 : // <summary> 37 : // Serial casacore::Data Transport Model 38 : // </summary> 39 : 40 : // <use visibility=local> 41 : 42 : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 43 : // </reviewed> 44 : 45 : // <prerequisite> 46 : // <li> SomeClass 47 : // <li> SomeOtherClass 48 : // <li> some concept 49 : // </prerequisite> 50 : // 51 : // <etymology> 52 : // </etymology> 53 : // 54 : // <synopsis> 55 : // </synopsis> 56 : // 57 : // <example> 58 : // </example> 59 : // 60 : // <motivation> 61 : // </motivation> 62 : // 63 : // 64 : //# <todo asof="yyyy/mm/dd"> 65 : //# <li> add this feature 66 : //# <li> fix this bug 67 : //# <li> start discussion of this possible extension 68 : //# </todo> 69 : 70 : // SerialTransport is your basic no-op. We're just passing the pointers 71 : // to avoid unnecessary data copying. 72 : 73 : class SerialTransport : public PTransport { 74 : public: 75 : // Default constructor and destructor 76 : SerialTransport(); 77 0 : virtual ~SerialTransport(){} 78 : 79 : // Default source and message tag values 80 0 : virtual casacore::Int anyTag() {return -1;}; 81 0 : virtual casacore::Int anySource() {return -1;}; 82 : 83 : // Define the rank of the controller process 84 0 : virtual casacore::Int controllerRank() {return 0;}; 85 : 86 : // Get and put functions on the data transport layer 87 : virtual casacore::Int put(const casacore::Array<casacore::Float> &); 88 : virtual casacore::Int put(const casacore::Array<casacore::Double> &); 89 : virtual casacore::Int put(const casacore::Array<casacore::Complex> &); 90 : virtual casacore::Int put(const casacore::Array<casacore::DComplex> &); 91 : virtual casacore::Int put(const casacore::Array<casacore::Int> &); 92 : virtual casacore::Int put(const casacore::Float &); 93 : virtual casacore::Int put(const casacore::Double &); 94 : virtual casacore::Int put(const casacore::Complex &); 95 : virtual casacore::Int put(const casacore::DComplex &); 96 : virtual casacore::Int put(const casacore::Int &); 97 : virtual casacore::Int put(const casacore::String &); 98 : virtual casacore::Int put(const casacore::Bool &); 99 : virtual casacore::Int put(const casacore::Record &); 100 : 101 : virtual casacore::Int get(casacore::Array<casacore::Float> &); 102 : virtual casacore::Int get(casacore::Array<casacore::Double> &); 103 : virtual casacore::Int get(casacore::Array<casacore::Complex> &); 104 : virtual casacore::Int get(casacore::Array<casacore::DComplex> &); 105 : virtual casacore::Int get(casacore::Array<casacore::Int> &); 106 : virtual casacore::Int get(casacore::Float &); 107 : virtual casacore::Int get(casacore::Double &); 108 : virtual casacore::Int get(casacore::Complex &); 109 : virtual casacore::Int get(casacore::DComplex &); 110 : virtual casacore::Int get(casacore::Int &); 111 : virtual casacore::Int get(casacore::String &); 112 : virtual casacore::Int get(casacore::Bool &); 113 : virtual casacore::Int get(casacore::Record &); 114 : ///IsFinalized is just a dummy here as no finalization is needed 115 0 : virtual casacore::Bool isFinalized(){ return true; }; 116 : private: 117 : casacore::uInt inQue; 118 : casacore::uInt outQue; 119 : casacore::uInt lastInQue; 120 : casacore::PtrBlock<void *> _data; 121 : 122 : casacore::Int add2Queue(void *); 123 : void *getFromQueue(); 124 : }; 125 : 126 : } //# NAMESPACE CASA - END 127 : 128 : #endif