00001 //////////////////////////////////////////////////////////////////////////////// 00002 /// 00003 /// \file 00004 /// \author Gerald Fahrnholz 00005 /// 00006 /// @{ 00007 /// \ingroup GrpSynchronizer 00008 /// \brief interface to interact with a Synchronizer object 00009 /// 00010 /// \sa ISynchronizer.h (File documentation) 00011 /// \sa TestToolBox::ISynchronizer (interface documentation) 00012 /// 00013 //////////////////////////////////////////////////////////////////////////////// 00014 00015 #pragma once 00016 00017 namespace TestToolBox 00018 { 00019 00020 struct IEventReceiver; 00021 00022 // ---------- Interface ISynchronizer ---------- 00023 00024 /// \brief This interface is used for synchronizing a linear test sequence 00025 //( with parallel activities of the test objects. 00026 struct ISynchronizer 00027 { 00028 /// \brief Connect with callback interface. This method is intended to be 00029 /// used by the specific report facility of the test environment. 00030 /// The synchronizer will inform the tets environment 00031 /// through the callback interface when error conditions are detected. 00032 virtual void ConnectWithEventReceiver( 00033 IEventReceiver* in_pIEventReceiver) = 0; 00034 00035 /// Define maximum timeout to wait for sync events. 00036 virtual void SetSyncTimeout(long in_timeoutMs) = 0; 00037 00038 /// Init wait conditions. Define the number of events to wait for. 00039 virtual void InitSync(long in_numSyncEventsToWaitFor) = 0; 00040 00041 /// \brief Wait until the configured number of sync events has occurred. 00042 /// The number of sync events to wait for is given by the last call of 00043 /// InitSync(). 00044 /// If not all sync events arrive within a specific period of time 00045 /// a timeout error is generated and the function returns. 00046 /// The timeout is defined by the last call of SetSyncTimeout(). 00047 virtual void WaitSync( 00048 const char* in_fileName = 0, 00049 const long in_lineNum = 0) = 0; 00050 00051 /// \brief Signals that a single sync event has occured. 00052 /// The event represents an arbitrary action that has occured 00053 /// during the test (e.g. an asynchronous callback was executed, 00054 /// a notification arrived, an asynchronous telegram was received). 00055 /// In most cases before generating the sync event the information 00056 /// about the kind of the event (e.g. the contents of the received 00057 /// telegram) has to be stored within the specific test environment 00058 /// to make possible an automatic verification of test events even 00059 /// in case of asynchronous occurance. 00060 virtual void Sync( 00061 const char* in_fileName = 0, 00062 const long in_lineNum = 0) = 0; 00063 }; 00064 00065 00066 }; // namespace TestToolBox 00067