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

net/src/AgentHandler.h

00001 /* 
00002 * Version: GPL 2.0
00003 *
00004 * K-10 Distributed Processing - Lium, Le Mans
00005 * Copyright (C) 2006 Laurent MOUTEL
00006 *
00007 * This program is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU General Public License
00009 * as published by the Free Software Foundation; either version 2
00010 * of the License, or (at your option) any later version.
00011 *
00012 * This program is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 * GNU General Public License for more details.
00016 *
00017 * You should have received a copy of the GNU General Public License
00018 * along with this program; if not, write to the Free Software
00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020 *
00021 */
00022 
00023 
00024 #ifndef AGENT_HANDLER_H
00025 #define AGENT_HANDLER_H
00026 
00027 #include <string>
00028 #include <prthread.h>
00029 #include <prlog.h>
00030 
00031 using namespace std;
00032 
00033 namespace net
00034 {
00035 
00041 class AgentHandler
00042 {
00043         
00044 protected:
00045         
00049         int mIsBusy;
00053         PRThread *mTaskThread;
00057         string mTaskDescriptor;
00058 
00059 protected:
00060 
00066         void SetBusyState(int aState) { mIsBusy = aState; }
00067 
00068 public:
00069 
00074         void LaunchTaskThread();
00075 
00081         virtual int CheckDescriptor(string) = 0;
00082         
00088         virtual void HandleDescriptor(string) = 0;
00089         
00094         AgentHandler();
00095 
00100         int IsBusy() { return mIsBusy; }
00101         
00107         void SetTaskDescriptor(string aDesc) { mTaskDescriptor = aDesc; }
00108         
00114         string GetTaskDescriptor() { return mTaskDescriptor; }
00115 
00116         
00117         PRThread* createThread(PRThreadType type,
00118                                                    void (*start)(void *arg),
00119                                                    void *arg,
00120                                                    PRThreadPriority priority,
00121                                                    PRThreadScope scope,
00122                                                    PRThreadState state,
00123                                                    PRUint32 stackSize, PRInt32 index);
00124         
00125         friend void PR_CALLBACK net::task_thread(void *);
00126         
00127 };
00128 
00129 }
00130 
00131 
00132 #endif

Generated on Fri May 19 23:12:36 2006 for common by  doxygen 1.4.4