Imt.Base C++ API V4.1.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RuntimeMock.h
Go to the documentation of this file.
1// (c) IMT - Information Management Technology AG, CH-9470 Buchs, www.imt.ch.
2//
3// ActiveParts (AP) and the corresponding Data Flow Framework (DFF) is invented and designed by Jakob Daescher.
4// ANY USE OF THIS CODE CONSTITUTES ACCEPTANCE OF THE TERMS OF THE COPYRIGHT NOTICE.
5// ===================================================================================================
6// COPYRIGHT NOTICE
7// ===================================================================================================
8// Copyright (C) 2005-2075, IMT Information Management Technology AG, 9470 Buchs, Switzerland
9// All rights reserved.
10// This code is proprietary software of IMT Information Management Technology AG (hereinafter: "IMT").
11// Proprietary software is computer software licensed under exclusive legal right of IMT.
12//
13// The licensee is given the irrevocable, perpetual, worldwide, non-exclusive right and license to use,
14// execute and reproduce the software in binary form within the licensed products.
15//
16// Redistribution and use in source forms, without modification, are permitted provided that the following conditions are met:
17// (1) Copying of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18// (2) Copying of source code is only allowed for regulatory documentation and archiving purposes
19// (3) Redistributions in binary form must reproduce the above copyright notice,
20// this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21//
22// IMT provide no reassurances that the source code provided does not infringe
23// any patent, copyright, or any other intellectual property rights of third parties.
24// IMT disclaim any liability to any recipient for claims brought against
25// recipient by any third party for infringement of that parties intellectual property rights.
26//
27// THIS SOFTWARE IS PROVIDED BY IMT AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
28// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29// IN NO EVENT SHALL IMT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCURE-MENT OF SUBSTITUTE GOODS OR SERVICES;
31// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34// ===================================================================================================
35
36#ifndef IMT_BASE_DFF_RUNTIME_MOCK_RUNTIMEMOCK_H
37#define IMT_BASE_DFF_RUNTIME_MOCK_RUNTIMEMOCK_H
38
42#include <queue>
43
44namespace imt {
45namespace base {
46namespace dff {
47namespace runtime {
48namespace mock {
49
53class RuntimeMock final {
54public:
55
59 class EventData {
60 public:
61
66
71
76
80 uint8_t dataBuffer[EVENTDATA_SIZE_BYTES];
81
86
91 };
92
98
103
108
114
119 void scheduleEvents(uint32_t durationMs);
120
124 static void process1msTick();
125
131
139
145
150
155
159 ExecutableIfc* m_executablePool[imt::base::dff::runtime::EXECUTABLES_MAX];
160
165
170
175
180
185
190
191private:
192
193 std::deque<EventData> m_sendEventData;
194 static RuntimeMock* s_pSingle;
195};
196
197} // namespace mock
198} // namespace runtime
199} // namespace dff
200} // namespace base
201} // namespace imt
202
203#endif // IMT_BASE_DFF_RUNTIME_MOCK_RUNTIMEMOCK_H
Interface of an executable which is called by the runtime once an event has to be processed.
int16_t CoreHandle
A CoreHandle is used to identify an executable with a unique number (similar to a phone number).
Definition RuntimeCore.h:64
Container which stores the received data.
Definition RuntimeMock.h:59
uint16_t protocolIdentifier
Unique identifier of the protocol.
Definition RuntimeMock.h:75
uint8_t dataBuffer[EVENTDATA_SIZE_BYTES]
Data buffer that holds the message bytes.
Definition RuntimeMock.h:80
uint32_t dataSize
Actual size of the serialized data in bytes.
Definition RuntimeMock.h:85
int32_t eventDataSizeBytes
Maximum size of the serialized data in bytes.
Definition RuntimeMock.h:90
RuntimeCore::CoreHandle receiverHandle
Unique identifier of the executable which receives the event.
Definition RuntimeMock.h:65
ExecutableIfc * executable
Executable which receives the message.
Definition RuntimeMock.h:70
Mocking object which stores all relevant information for runtime.
Definition RuntimeMock.h:53
int16_t m_coreCreateInvokeCounter
Number of calls to the create function.
uint32_t m_appIsrEntryCounter
Number of interrupt service routine entries.
bool m_interruptsEnabled
Indicates whether interrupts are enabled or not.
static void process1msTick()
Process the 1ms tick in order to fire active timers if they are expired.
void enqueueEvent(RuntimeMock::EventData &event)
Add an event to the list of queued events for the scheduler.
uint32_t getNumberOfQueuedEvents()
Returns the number of events which are queued to be scheduled.
uint32_t m_appIsrExitCounter
Number of interrupt service routine exits.
int16_t m_executablesAvailable
Number of remaining executables.
EventData const & getQueuedEvent(uint32_t index)
Returns the event at position index from the list of queued events for the scheduler.
bool m_appInIsr
Indicates whether an interrupt service routine is currently executed or not.
bool scheduleEvent()
Process one event.
void scheduleEvents(uint32_t durationMs)
Process scheduler events and increase the 1ms system tick count for the given durationMs [ms].
ExecutableIfc * m_executablePool[imt::base::dff::runtime::EXECUTABLES_MAX]
Pool of executables.
static RuntimeMock & getSingle()
Returns the one and only instance.
uint32_t m_freeRunningTimerTicks
Number of free running timer ticks.
bool m_isStopped
Indicates whether the dff runtime has been stopped.
This is a application specific file which is used to configure Imt.Base.Core.Math.
__int16 int16_t
Definition stdint.h:59
unsigned __int16 uint16_t
Definition stdint.h:63
__int32 int32_t
Definition stdint.h:60
unsigned __int32 uint32_t
Definition stdint.h:64
unsigned __int8 uint8_t
Definition stdint.h:62