Main Page | Class Hierarchy | Class List | File List | Class Members

Channel.h

00001 // Channel.h -- The super class of communication channels for PCSPs.
00002 
00003 /*
00004  * Copyright (C) 1998 Tudor Hulubei <tudor@hulubei.net>.
00005  *
00006  * This library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2, or (at
00009  * your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00019  * 02111-1307, USA.
00020  */
00021 
00022 /*
00023  * NOTE: This is an interal header file.
00024  * You should not attempt to use it directly.
00025  */
00026 
00027 // $Id: Channel_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
00028 
00029 #ifndef _CSP_KERNEL_Channel_H
00030 #define _CSP_KERNEL_Channel_H
00031 
00032 
00033 CSP_NAMESPACE_BEGIN(csp);
00034 
00035 
00040 class CSP_API Channel
00041 {
00042   public:
00043     Channel() : m_size(-1), m_rank(-1), m_closed(false) {}
00044     virtual ~Channel() {}
00045 
00046     int size() const { return m_size; }
00047     int rank() const { return m_rank; }
00048     bool closed() const { return m_closed; }
00049 
00050     void close() { assert(!m_closed); m_closed = true; }
00051 
00055     virtual void sendInt(int destRank, int i) const = 0;
00056 
00061     virtual int recvInt(int& srcRank) const = 0;
00062 
00066     virtual int recvIntFrom(int srcRank) const = 0;
00067 
00071     virtual void sendBytes(
00072         int destRank,
00073         const unsigned char* buf,
00074         int count) const = 0;
00075 
00081     virtual unsigned char* recvBytes(int srcRank, int count) const = 0;
00082 
00083   protected:
00085     Channel(const Channel&);
00086 
00088     Channel& operator=(const Channel&);
00089 
00091     int m_size;
00092 
00094     int m_rank;
00095 
00097     bool m_closed;
00098 };
00099 
00100 
00101 CSP_NAMESPACE_END(csp);
00102 
00103 
00104 #endif // _CSP_KERNEL_Channel_H
00105 
00106 // Local Variables:
00107 // mode: C++
00108 // End:

Generated on Wed May 25 12:21:13 2005 for csp.kdevelop by  doxygen 1.3.9.1