PCMNetServer.h
Go to the documentation of this file.00001 00002 // 00003 // This source file is a part of ParCompMark 00004 // Parallel Compositing Benchmark Framework 00005 // 00006 // for latest info see http://parcompmark.sourceforge.net 00007 00008 // 00009 // Copyright (C) 2006 IT2 ParCompMark Dev. Team 00010 // 00011 // This program is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU General Public License 00013 // as published by the Free Software Foundation; either version 2 00014 // of the License, or (at your option) any later version. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with this program; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00024 00027 00028 #ifndef __PCM_NETSERVER_H__ 00029 # define __PCM_NETSERVER_H__ 00030 00031 // 00032 // Inner includes 00033 // 00034 00035 # include "PCMPremeditations.h" 00036 00037 # include "PCMNetwork.h" 00038 00039 # include "PCMHandleClient.h" 00040 00041 namespace ParCompMark 00042 { 00043 00048 class NetServer:public Network 00049 { 00050 00051 // 00052 // Unit test class 00053 // 00054 # ifdef PARCOMPMARK_TEST 00055 friend class ParCompMarkTest::TestNetServer; 00056 # endif 00057 00058 // 00059 // Typedefs 00060 // 00061 00062 public: 00063 00065 typedef ParCompMark::Pointer < NetServer, 00066 DummyLock > Pointer; 00067 00069 typedef ParCompMark::Pointer < int, 00070 Mutex > IntPointer; 00071 00072 // 00073 // Variables 00074 // 00075 00077 00078 00079 protected: 00080 00086 struct sockaddr_in mBroadcastAddress; 00087 00093 u32 mMaxConnection; 00094 00100 u32 mHostNumber; 00101 00107 IntPointer mRecievedNumber; 00108 00114 IntPointer mStopFrameID; 00115 00117 00118 // 00119 // Constructors & destructor 00120 // 00121 00123 00124 00125 public: 00126 00131 NetServer(const std::string & name); 00132 00136 virtual ~ NetServer(); 00137 00139 00140 // 00141 // Getters & setters 00142 // 00143 00145 00146 00147 public: 00148 00154 const struct sockaddr_in &getBroadcastAddress() const; 00155 00161 const u32 & getMaxConnection() const; 00162 00168 const u32 & getHostNumber() const; 00169 00175 void setHostNumber(const u32 & hostnumber); 00176 00182 const NetServer::IntPointer & getRecievedNumber() const; 00183 00189 const NetServer::IntPointer & getStopFrameID() const; 00190 00192 00193 // 00194 // Methods 00195 // 00196 00198 00199 00200 public: 00201 00205 virtual void initialize(); 00206 00210 virtual void finalize(); 00211 00217 virtual void sendBroadcastMessage(const std::string & type, const std::string & message); 00218 00222 virtual void buildCluster(); 00223 00224 protected: 00225 00229 virtual void task(); 00230 00232 00233 }; 00234 00235 // 00236 // Include header implementation 00237 // 00238 00239 # include "PCMNetServer_impl.h" 00240 00241 } 00242 00243 #endif