- Timestamp:
- Mar 13, 2014, 10:41:47 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/kernel/InputOutputInterface.h
r269 r273 5 5 #include <Pacpus/kernel/Log.h> 6 6 7 #include <boost/function.hpp> 7 8 #include <QByteArray> 8 9 #include <QCoreApplication> … … 22 23 typedef void (C::*process_const_data_function_type_with_event)(T const&, PacpusEvent); 23 24 typedef void (C::*process_const_data_function_type)(T const&); 25 //typedef boost::function<void (C*, T&, PacpusEvent)> process_data_function_type_with_event; 26 //typedef boost::function<void (C*, T&)> process_data_function_type; 27 //typedef boost::function<void (C*, T const&, PacpusEvent)> process_const_data_function_type_with_event; 28 //typedef boost::function<void (C*, T const&)> process_const_data_function_type; 24 29 25 30 InputInterface(QString name, C* component, process_data_function_type_with_event processingMethod) … … 166 171 return; 167 172 } 173 //if (fe) { 174 // fe(comp, data, event); 175 //} else if (f) { 176 // f(comp, data); 177 //} else if (cfe) { 178 // cfe(comp, data, event); 179 //} else if (cf) { 180 // cf(comp, data); 181 //} else { 182 // LOG_WARN("no method to invoke"); 183 //} 168 184 if (fe) { 169 185 (comp->*fe)(data, event); -
trunk/src/RoadTime/src/road_time.c
r89 r273 27 27 DWORD ul_reason_for_call, 28 28 LPVOID lpReserved 29 29 ) 30 30 { 31 31 HANDLE hMapObject = NULL; // handle to file mapping 32 32 BOOL fInit, fIgnore; 33 34 35 33 struct Initialisation_Time First_Launcher; 34 struct timeb timeptr; 35 LARGE_INTEGER tmp; 36 36 37 37 switch (ul_reason_for_call) 38 39 40 41 42 38 { 39 case DLL_THREAD_ATTACH: 40 break; 41 case DLL_PROCESS_ATTACH: 42 // Create a named file mapping object. 43 43 hMapObject = CreateFileMapping( 44 44 INVALID_HANDLE_VALUE, // use paging file … … 68 68 // Initialize memory if this is the first process. 69 69 if (fInit) 70 71 72 73 74 75 76 77 78 79 80 81 82 83 } 84 85 86 { 87 88 89 90 91 92 93 94 95 96 97 70 { 71 memset(lpvMem, '\0', SHMEMSIZE); 72 73 ftime(&timeptr ); 74 First_Launcher.Real_Time=(road_time_t) timeptr.time * 1000000 +(road_time_t) timeptr.millitm * 1000; 75 if (!QueryPerformanceFrequency(&tmp)) 76 { 77 MessageBox(NULL,"No Multimedia Counter Available","DLL Message",MB_OK); 78 First_Launcher.Multimedia_Counter_Frequency=(unsigned __int64) 0; 79 First_Launcher.Multimedia_Counter=(unsigned __int64)0; 80 First_Launcher.delta_t=First_Launcher.Real_Time; 81 SetSharedMem(&First_Launcher); 82 return FALSE; 83 } 84 First_Launcher.Multimedia_Counter_Frequency=(unsigned __int64) tmp.QuadPart; 85 if (!QueryPerformanceCounter(&tmp)) 86 { 87 MessageBox(NULL,"Couldn't Get the value of Multimedia Counter","DLL Message",MB_OK); 88 First_Launcher.Multimedia_Counter_Frequency=(unsigned __int64) 0; 89 First_Launcher.Multimedia_Counter=(unsigned __int64)0; 90 First_Launcher.delta_t=First_Launcher.Real_Time; 91 SetSharedMem(&First_Launcher); 92 return FALSE; 93 } 94 First_Launcher.Multimedia_Counter=(unsigned __int64)tmp.QuadPart; 95 First_Launcher.delta_t=First_Launcher.Real_Time-(road_time_t) (First_Launcher.Multimedia_Counter*1000000/First_Launcher.Multimedia_Counter_Frequency); 96 //MessageBox(NULL,"You called Road_Time_2.DLL","DLL Message",MB_OK); 97 SetSharedMem(&First_Launcher); 98 98 99 99 100 101 102 103 104 105 106 100 } 101 break; 102 case DLL_THREAD_DETACH: 103 break; 104 case DLL_PROCESS_DETACH: 105 // Unmap shared memory from the process's address space. 106 // In the case of the last process, Windwos automatically clean up the memory. 107 107 fIgnore = UnmapViewOfFile(lpvMem); 108 108 // Close the process's handle to the file-mapping object. 109 109 fIgnore = CloseHandle(hMapObject); 110 110 break; 111 111 } 112 112 return TRUE; … … 132 132 road_time_t ROAD_TIME_API road_time2(void) 133 133 { 134 135 136 137 138 139 134 struct Initialisation_Time First_Launcher; 135 road_time_t reply; 136 LARGE_INTEGER tmp; 137 struct timeb timeptr; 138 139 GetSharedMem(&First_Launcher); 140 140 141 142 { 143 144 145 146 147 148 149 { 150 151 152 141 if (!QueryPerformanceCounter(&tmp)) 142 { 143 MessageBox(NULL,"Couldn't Get the value of Multimedia Counter","DLL Message",MB_OK); 144 ftime(&timeptr ); 145 reply=(road_time_t) timeptr.time * 1000000 +(road_time_t) timeptr.millitm * 1000; 146 } 147 148 else 149 { 150 reply=(road_time_t) First_Launcher.Real_Time + (road_time_t) (((unsigned __int64) tmp.QuadPart - First_Launcher.Multimedia_Counter) * 1000000/First_Launcher.Multimedia_Counter_Frequency); 151 } 152 return(reply); 153 153 154 154 } … … 157 157 road_time_t ROAD_TIME_API road_time(void) 158 158 { 159 160 161 162 163 164 165 166 167 { 168 169 170 171 172 173 174 { 175 176 177 178 159 struct Initialisation_Time First_Launcher; 160 road_time_t reply; 161 LARGE_INTEGER tmp; 162 struct timeb timeptr; 163 164 GetSharedMem(&First_Launcher); 165 166 if (!QueryPerformanceCounter(&tmp)) 167 { 168 MessageBox(NULL,"Couldn't Get the value of Multimedia Counter","DLL Message",MB_OK); 169 ftime(&timeptr ); 170 reply=(road_time_t) timeptr.time * 1000000 +(road_time_t) timeptr.millitm * 1000; 171 } 172 173 else 174 { 175 reply=First_Launcher.delta_t+(road_time_t) ((tmp.QuadPart*1000000)/First_Launcher.Multimedia_Counter_Frequency); 176 177 } 178 return(reply); 179 179 180 180 } … … 183 183 struct Initialisation_Time ROAD_TIME_API road_time_init(void) 184 184 { 185 186 187 188 185 struct Initialisation_Time First_Launcher; 186 187 GetSharedMem(&First_Launcher); 188 return(First_Launcher); 189 189 190 190 }
Note:
See TracChangeset
for help on using the changeset viewer.