WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
appmacros.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17File containing useful macros for math utilities
18
19Author: Alex Reynolds
20*/
21
22#ifndef FLIGHT_APPMACROS_H
23#define FLIGHT_APPMACROS_H
24
25#include "configuration.h"
26
27#define SIGNAL(NAME, TYPE, INITIAL_VALUE) clockwerk::DataIO<TYPE> NAME = clockwerk::DataIO<TYPE>(this, #NAME, INITIAL_VALUE);
28#define START_OUTPUTS struct Outputs : clockwerk::GraphTreeObject {\
29 Outputs(clockwerk::GraphTreeObject* par, const char* nme) : clockwerk::GraphTreeObject(nme, _children, MAXIMUM_APP_CHILDREN) {parent(par);}\
30 private:\
31 clockwerk::GraphTreeObject* _children[MAXIMUM_APP_CHILDREN];\
32 public:
33#define END_OUTPUTS };\
34 Outputs outputs = Outputs(this, "outputs");
35#define START_INPUTS struct Inputs : clockwerk::GraphTreeObject {\
36 Inputs(clockwerk::GraphTreeObject* par, const char* nme) : clockwerk::GraphTreeObject(nme, _children, MAXIMUM_APP_CHILDREN) {parent(par);}\
37 private:\
38 clockwerk::GraphTreeObject* _children[MAXIMUM_APP_CHILDREN];\
39 public:
40#define END_INPUTS };\
41 Inputs inputs = Inputs(this, "inputs");
42#define START_PARAMS struct Params : clockwerk::GraphTreeObject {\
43 Params(clockwerk::GraphTreeObject* par, const char* nme) : clockwerk::GraphTreeObject(nme, _children, MAXIMUM_APP_CHILDREN) {parent(par);}\
44 private:\
45 clockwerk::GraphTreeObject* _children[MAXIMUM_APP_CHILDREN];\
46 public:
47#define END_PARAMS };\
48 Params params = Params(this, "params");
49
53// ----------------- CODE COVERAGE ECXLUSION --------------------------
54// Excluded from code review 8/29/2025
55// The log macro expands to a two condition if statement which is placed
56// everywhere it is called. The two conditions are based on the local
57// log level and the overall (executive) log. To exercise both conditions
58// would require re-running every test with the local and executive log
59// levels separately enabled, which adds no value to overall testing. The internal
60// elements of the LOG macro (os syslog) are tested independently, so
61// excluding this macro from code coverage utilities eliminates an undue
62// testing burden without lowering the quality of testing or coverage.
63// complex
64// Author: Alex Reynolds
65// Tech Authority: Alex Reynolds
66// Reviewer: Will Burken
67//TODO Handle strlen when MESSAGE is nullptr or has no terminating bytes
68#define LOG(LEVEL, MESSAGE) \
69EXCLUDE_FROM_COVERAGE(\
70 if(LEVEL <= exc.logLevel() || LEVEL <= _local_log_level /* LCOV_EXCL_LINE */) {\
71 exc.os().sysLog(exc.os().systemTime().asFloatingPoint(), name(), MESSAGE, strlen(MESSAGE)); /* LCOV_EXCL_LINE */\
72 }\
73)
74
75// Custom log function defined for the scheduler, which manages executive differently
76#define LOG_SCHEDULER(LEVEL, MESSAGE) \
77EXCLUDE_FROM_COVERAGE(\
78 if(_exc_ptr) {\
79 if(LEVEL <= _exc_ptr->logLevel() /* LCOV_EXCL_LINE */) {\
80 _exc_ptr->os().sysLog(_exc_ptr->os().systemTime().asFloatingPoint(), name(), MESSAGE, strlen(MESSAGE)); /* LCOV_EXCL_LINE */\
81 }\
82 }\
83)
84
85#endif