• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

bulkDataNTGenStreamerThread.h

Go to the documentation of this file.
00001 #ifndef bulkDataNTStreamerThread_H
00002 #define bulkDataNTStreamerThread_H
00003 /*******************************************************************************
00004  * ALMA - Atacama Large Millimeter Array
00005  * Copyright (c) AUI - Associated Universities Inc., 2011
00006  * (in the framework of the ALMA collaboration).
00007  * All rights reserved.
00008  * 
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  * 
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * Lesser General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00022  *******************************************************************************
00023  * 
00024  * "@(#) $Id: bulkDataNTGenStreamerThread.h,v 1.1 2013/02/11 18:37:33 rbourtem Exp $"
00025  *
00026  * who       when        what
00027  * --------  ----------  ----------------------------------------------
00028  * ramestic  2011-08-01  created
00029  */
00030 
00031 #ifndef __cplusplus
00032 #error This is a C++ include file and cannot be used from plain C
00033 #endif
00034 
00035 //
00036 // System stuff
00037 //
00038 #include <pthread.h>
00039 #include <semaphore.h>
00040 
00041 //
00042 // ACS stuff
00043 //
00044 #include <acsThread.h>
00045 #include <maciContainerServices.h>
00046 
00047 //
00048 // CORR stuff
00049 //
00050 //#include <MasterBulkDataSender.h>
00051 
00052 //
00053 // Local stuff
00054 //
00055 #include "bulkDataNTSenderFlow.h"
00056 
00060 namespace AcsBulkdata
00061 {
00062 class StreamerThread : public ACS::Thread
00063 {
00064 public:
00067         StreamerThread( const char *threadName,
00068                         const std::string & streamName,
00069                         const std::string &sendFlowName,
00070                         const std::string &qosLib,
00071                         const double & throttling,
00072                         const double & sendTimeout,
00073                         const double & ACKTimeout);
00074 
00077         ~StreamerThread();
00078 
00081         void send(uint8_t * data, size_t size);
00082 
00085         //  void abort(uint8_t * data, size_t size);
00086         void abort();
00091         void wait(const char *uid, const ACS::TimeInterval timeout)
00092         {
00093                 // TODO
00094                 //Streamer<Corr::CDP::Master::BulkData::SenderTemporal>::wait(uid, timeout);
00095         }
00096  // TODO?
00099         /*SpectralResolutionTypeMod::SpectralResolutionType getFlow() const
00100         {
00101                 // TODO
00102                 //return Streamer<Corr::CDP::Master::BulkData::SenderTemporal>::getFlow();
00103         }*/
00104 
00107         void run();
00108 
00109 
00110 private:
00114         StreamerThread(const StreamerThread &src);
00115 
00119         StreamerThread &operator =(const StreamerThread &src);
00120 
00126         bool m_isThreadRunning;
00127 
00130         bool m_isAbort;
00131 
00132         std::list< std::pair<uint8_t *, size_t> > data_buffers;
00133 
00138         //std::list<DataType> m_data;
00139         std::list< std::pair<uint8_t *, size_t> > m_data;
00140 
00144         sem_t m_dataReadySem;
00145 
00149         sem_t m_abortReadySem;
00150 
00155         pthread_mutex_t m_accessMutex;
00156 
00159         static const ACS::TimeInterval m_accessTimeout = 50000000LLU;
00160         //static const ACS::TimeInterval m_accessTimeout = 5000000000LLU;
00161         std::string m_streamName;
00162 
00163         std::string m_sendFlowName;
00164 
00165         std::string m_qosLib;
00166 
00167         BulkDataNTSenderStream * m_senderStream;
00168 
00169         BulkDataNTSenderFlow *m_sendFlow;
00170 
00171         double m_throttling;
00172         
00173         double m_sendTimeout;
00174         
00175         double m_ACKTimeout;
00176 };
00177 };
00178 
00179 #endif
00180 
00181 /*___oOo___*/

Generated on Mon May 4 2015 08:27:43 for ACS-2015.4 C++ API by  doxygen 1.7.0