00001 /************************************************************************************ 00002 * This file is part of the MynahSA streaming and archiving toolkit * 00003 * Copyright (C) 2006 Mynah-Software Ltd. All Rights Reserved. * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License, version 2 * 00007 * as published by the Free Software Foundation. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License along * 00015 * with this program; if not, write to the Free Software Foundation, Inc., * 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00017 * * 00018 ************************************************************************************/ 00019 00020 #ifndef __tcp_archive_stream_hpp 00021 #define __tcp_archive_stream_hpp 00022 00023 #include <mynahsa/iarchive.hpp> 00024 #include <mynahsa/oarchive.hpp> 00025 #include <mynahsa/itcpstream.hpp> 00026 #include <mynahsa/otcpstream.hpp> 00027 #include <mynahsa/archivestreambase.hpp> 00028 00029 00030 #include <iostream> 00031 00032 namespace MynahSA { 00033 00035 typedef IArchive<ITCPStream> ITCPArchiveStream; 00036 00038 typedef OArchive<OTCPStream> OTCPArchiveStream; 00039 00044 class TCPArchiveStream : public ArchiveStreamBase, 00045 public ITCPArchiveStream, 00046 public OTCPArchiveStream { 00047 00048 public: 00049 00051 TCPArchiveStream(int sd); 00052 00054 TCPArchiveStream(const TCPArchiveStream& s); 00055 00057 ~TCPArchiveStream(); 00058 00060 bool is_open() const; 00061 00063 void close(); 00064 00066 void registerConstructor(const std::string& name, 00067 const SHARED_PTR<Archive::ArchiveConstructor>& cons); 00068 00072 void clearUPR(); 00073 00074 00075 private: 00077 int _sd; 00078 00080 ITCPStream is; 00082 OTCPStream os; 00083 00084 }; 00085 }; 00086 00087 00088 #endif