The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

commthread.h

Go to the documentation of this file.
00001 /*
00002  *  commthread.h
00003  *  
00004  *
00005  *  Created by Josh Susskind 2003.
00006  *  Copyright (c) 2003 Machine Perception Laboratory
00007  *  University of California San Diego.
00008  *  Please read the disclaimer and notes about redistribution
00009  *  at the end of this file.
00010  *
00011  *  Authors: Josh Susskind
00012  */
00013 #ifndef __MP_COMMTHREAD_H__
00014 #define __MP_COMMTHREAD_H__
00015 
00016 #include "preprocessor.h"
00017 #include "common.h"
00018 
00019 #include <vector>
00020 #include "Configuration/configuration.h"
00021 #include "Communications/io.h"
00022 #include "iniconfig.h"
00023 
00024 #define round(x) (floor((x)+0.5))
00025 
00026 /* ================================================================ */
00027 
00028 class CommThread {
00029 private:
00030         MUTEX_TYPE m_DataMutex, m_ThreadHandle;
00031         bool m_ThreadRunning;
00032         WSADATA ws;
00033         MPSocketIO *m_SocketWriter;
00034         std::vector<int> m_Data;
00035         bool m_Available;
00036         IniConfig m_Ini;
00037 
00038         void Process();
00039         void GetClientIP(char *c_ip, int &c_p);
00040         void WriteData(MPIO *writer);
00041 
00042 
00043 public:
00044         CommThread();
00045         ~CommThread();
00046         static void CommLoop(void *);
00047         void PutData(int *vec, int n);
00048 };
00049 
00050 /* ================================================================ */
00051 
00052 #endif __MP_COMMTHREAD_H__
00053 
00054 
00055 /*
00056  * 
00057  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00058  * 
00059  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00060  *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00061  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00062  * 
00063  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00064  * 
00065  */

Generated on Mon Nov 8 17:07:32 2004 for MPT by  doxygen 1.3.9.1