00001 //////////////////////////////////////////////////////////////////////////////// 00002 /// 00003 /// \file 00004 /// \author Gerald Fahrnholz 00005 /// 00006 /// \brief 00007 /// Class CallBackFromSimpleObjectis a call back object with interface 00008 /// ICallBackFromSimpleObject to receive calls from SimpleObject. 00009 /// 00010 //////////////////////////////////////////////////////////////////////////////// 00011 00012 #pragma once 00013 00014 00015 #include "SourcesToTest\ISimpleObject.h" // ICallBackFromSimpleObject 00016 #include "TestToolBox/Synchronizer.h" // synchronization via TU_SYNC 00017 #include "TestToolBox/TestEvents.h" // signalling (asynchronous) textual events 00018 using namespace TestToolBox; 00019 00020 ///\cond do not document 00021 00022 class CallBackFromSimpleObject : 00023 public ICallBackFromSimpleObject 00024 { 00025 public: 00026 00027 // Constructor 00028 explicit CallBackFromSimpleObject( 00029 bool in_generateSyncEvent = true) 00030 : m_generateSyncEvent (in_generateSyncEvent) 00031 {}; 00032 00033 // Destructor 00034 virtual ~CallBackFromSimpleObject(){}; 00035 00036 //******************************************************************** 00037 // Interface ICallBackFromSimpleObject 00038 //******************************************************************** 00039 00040 void Result ( 00041 long in_val) 00042 { 00043 TRCF("CallBackFromSimpleObject::Result") 00044 TRC (TL_DEBUG, "Begin in_val = %d", in_val); 00045 00046 // Inform test utility about the received value 00047 TestEvents::Get()->Act("CallBack-Result: %d", in_val); 00048 00049 // TODO / possible extension: 00050 // Add implementation variant allowing output to stream instead of printf syntax 00051 00052 // Generate sync event to synchronize with main thread of test exe 00053 if (m_generateSyncEvent) 00054 { 00055 TTB_SYNC(); 00056 } 00057 00058 TRC (TL_DEBUG, "End"); 00059 } 00060 00061 private: 00062 00063 // Flag indicating whether a synchronization event shall be generated when 00064 // a call into callback interface occurs. 00065 bool m_generateSyncEvent; 00066 00067 }; // class CallBackFromSimpleObject 00068 00069 ///\endcond do not document