ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
macros.h
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/*
17Macros Header File
18------------------
19This file contains macro definitions to invoke specialized
20versions of templated classes. The classes defined here
21are guaranteed to be available to SWIG implementations
22as well.
23
24Author: Alex Reynolds
25*/
26#ifndef CLOCKWERK_MACROS_H
27#define CLOCKWERK_MACROS_H
28
29// --------------------------------------------------------------------------
30// Matrix definitions for easy use in C++ and SWIG Implementations
31// --------------------------------------------------------------------------
32#define Matrix2D clockwerk::Matrix<double, 2, 2>
33#define Matrix3D clockwerk::Matrix<double, 3, 3>
34#define Matrix3F clockwerk::Matrix<float, 3, 3>
35#define Matrix4D clockwerk::Matrix<double, 4, 4>
36#define Matrix4F clockwerk::Matrix<float, 4, 4>
37#define Matrix6D clockwerk::Matrix<double, 6, 6>
38#define Matrix6F clockwerk::Matrix<float, 6, 6>
39#define Matrix21D clockwerk::Matrix<double, 2, 1>
40#define Matrix31D clockwerk::Matrix<double, 3, 1>
41#define Matrix31F clockwerk::Matrix<float, 3, 1>
42#define Matrix41D clockwerk::Matrix<double, 4, 1>
43#define Matrix41F clockwerk::Matrix<float, 4, 1>
44#define Matrix61D clockwerk::Matrix<double, 6, 1>
45#define Matrix61F clockwerk::Matrix<float, 6, 1>
46#define Matrix63D clockwerk::Matrix<double, 6, 3>
47#define Matrix63F clockwerk::Matrix<float, 6, 3>
48
49// --------------------------------------------------------------------------
50// Vector definitions for easy use in C++ and SWIG Implementations
51// --------------------------------------------------------------------------
52#define CartesianVector2D clockwerk::CartesianVector<double, 2>
53#define CartesianVector2F clockwerk::CartesianVector<float, 2>
54#define CartesianVector3D clockwerk::CartesianVector<double, 3>
55#define CartesianVector3F clockwerk::CartesianVector<float, 3>
56#define CartesianVector4D clockwerk::CartesianVector<double, 4>
57#define CartesianVector4F clockwerk::CartesianVector<float, 4>
58#define CartesianVector6D clockwerk::CartesianVector<double, 6>
59#define CartesianVector6F clockwerk::CartesianVector<float, 6>
60
61// --------------------------------------------------------------------------
62// Frame/6-DOF definitions for easy use in C++ and SWIG Implementations
63// --------------------------------------------------------------------------
64#define FrameD clockwerk::Frame<double>
65#define FrameF clockwerk::Frame<float>
66#define BodyD clockwerk::Body<double>
67#define BodyF clockwerk::Body<float>
68#define NodeD clockwerk::Node<double>
69#define NodeF clockwerk::Node<float>
70#define DCMD clockwerk::DCM<double>
71#define DCMF clockwerk::DCM<float>
72#define Euler321D clockwerk::Euler321<double>
73#define Euler321F clockwerk::Euler321<float>
74#define JointD clockwerk::Joint<double>
75#define JointF clockwerk::Joint<float>
76#define MRPD clockwerk::MRP<double>
77#define MRPF clockwerk::MRP<float>
78#define QuaternionD clockwerk::Quaternion<double>
79#define QuaternionF clockwerk::Quaternion<float>
80
81// --------------------------------------------------------------------------
82// Model, Task, Monitor, Event definitions for easy use in C++ and SWIG
83// Implementations
84// --------------------------------------------------------------------------
85#define REQUIRED(NAME, TYPE) clockwerk::DataIO<TYPE> NAME = clockwerk::DataIO<TYPE>(this, #NAME);
86#define OPTIONAL(NAME, TYPE, DEFAULT_VALUE) clockwerk::DataIO<TYPE> NAME = clockwerk::DataIO<TYPE>(this, #NAME, DEFAULT_VALUE);
87#define SIGNAL(NAME, TYPE, INITIAL_VALUE) clockwerk::DataIO<TYPE> NAME = clockwerk::DataIO<TYPE>(this, #NAME, INITIAL_VALUE);
88#define START_OUTPUTS struct Outputs : clockwerk::GraphTreeObject {
89 Outputs(clockwerk::GraphTreeObject* par, std::string nme) {_name=nme; parent(par);}
90#define END_OUTPUTS };
91 Outputs outputs = Outputs(this, "outputs");
92#define START_INPUTS struct Inputs : clockwerk::GraphTreeObject {
93 Inputs(clockwerk::GraphTreeObject* par, std::string nme) {_name=nme; parent(par);}
94#define END_INPUTS };
95 Inputs inputs = Inputs(this, "inputs");
96#define START_PARAMS struct Params : clockwerk::GraphTreeObject {
97 Params(clockwerk::GraphTreeObject* par, std::string nme) {_name=nme; parent(par);}
98#define END_PARAMS };
99 Params params = Params(this, "params");
100
101// --------------------------------------------------------------------------
102// Logging macro to make event logging easy
103// --------------------------------------------------------------------------
104// This macro works only inside models, tasks, monitors, and events -- it receives
105// the log message and associated log level as arguments, and implicitly receives
106// the local and gloabl log levels via the executive and known variables in those items
107// If the log level is error, prints the file/function/line where the error is logged
108#define LOG(LEVEL, MESSAGE)
109 if(exc != nullptr) {
110 if(LEVEL <= exc->eventLog()->logLevel() || LEVEL <= _local_log_level) {
111 exc->eventLog()->logMessage(LEVEL, address() + ":\t" + MESSAGE, _local_log_level);
112 if(LEVEL == ERROR) {
113 exc->eventLog()->logMessage(LEVEL, "FILE : " + std::string(__FILE__));
114 exc->eventLog()->logMessage(LEVEL, "FUNCTION : " + std::string(__func__));
115 exc->eventLog()->logMessage(LEVEL, "LINE : " + std::to_string(__LINE__));
116 }
117 }
118 }
119
120// Header for our clockwerk page
121/*! \mainpage Clockwerk Doxygen Landing Page
122 *
123 * \section intro_sec Overview
124 *
125 * This module contains all C++ documentation generated for
126 * the Clockwerk module. Clockwerk includes all base tools and
127 * utilities necessary to build a software instance. That includes
128 * matrix math, dynamics, attitude representations, software
129 * architecture, logging, and other general utilities. See the
130 * class list for more information.
131 */
132
133#endif