libGizmod/GizmodThread.hpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 */
00028 
00029 #ifndef __GizmodThread_h
00030 #define __GizmodThread_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include <boost/python.hpp>
00037 
00039 // Namespace
00041 
00042 namespace Gizmod {
00043 
00045 // Typedef, enum's
00047         
00049 // Class Definition
00051 
00059 class GizmodThread {
00060 public:
00061         // public functions
00062         void                            create();               
00063         
00064         // construction / deconstruction        
00065         GizmodThread(boost::python::object ThreadFunction);     
00066         virtual ~GizmodThread();                                
00067 
00068 private:
00069         // private functions
00070         void                            threadProc();           
00071         
00072         // private member variables
00073         boost::python::object           mThreadFunction;        
00074         
00078         struct GizmodThreadThreadProc {
00079                 GizmodThreadThreadProc(GizmodThread * pGizmodThread) : mpGizmodThread(pGizmodThread) {
00080                         mpGizmodThread->mThreading = false;
00081                 };
00082                 
00084                 void operator()() {
00085                         mpGizmodThread->mThreading = true;
00086                         mpGizmodThread->threadProc();
00087                         mpGizmodThread->mThreading = false;
00088                 }
00089                 
00090                 GizmodThread *          mpGizmodThread;
00091         };              
00092         bool                            mThreading;     
00093         GizmodThreadThreadProc          mThreadProc;    
00094 };
00095 
00097 
00098 } // Gizmod namespace
00099 
00100 #endif // __GizmodThread_h

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3