ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
ConfigurationWriter.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#ifndef CPP_APP_CONFIGURATION_WRITER_H
17#define CPP_APP_CONFIGURATION_WRITER_H
18
19#include "utils/AutoDoc.h"
20#include "ImNode.h"
21#include "Connection.h"
22
23namespace modelspace {
24 /** @brief Write out script from UX to execute using set toolchain. Base class for override. */
26 public:
27 ConfigurationWriter() {}
28 virtual ~ConfigurationWriter() {}
29
30 /// @brief Set the file for write and redirect
31 /// output to that file
32 /// @param filename The filename to write to
33 /// @return 0 on success, 1 on failure
34 /// @note Calling this function will cause the ConfigurationWriter class
35 /// to begin writing its data to the provided file
36 void file(const std::string &filename) {_filename = filename;}
37 std::string file() {return _filename;}
38
39 /// @brief Add a node to the ConfigurationWriter for tracking
40 /// @param target The node to add to tracking
41 /// @note Will ignore node if its unique ID is already tracked
42 void watchNode(ImNode* target);
43
44 /// @brief Remove a node from the ConfigurationWriter for tracking
45 /// @param target The node to remove from tracking
46 /// @note Will ignore node if its unique ID is not tracked
47 void unwatchNode(ImNode* target);
48
49 /// @brief Write watched node data to file
50 void write();
51 protected:
52 /// @brief Set the sequence of nodes for creation and write paired connections
53 virtual void _setNodeConnectionSequence() {}
54
55 /// @brief Decompose all relevant strings from the provided node and connection information
56 virtual void _decomposeNodeInformation() {}
57
58 /// @brief Write the start of the file
59 virtual void _writeOutputStart() {}
60
61 /// @brief Write the creation of a single node, given by node
62 /// @param node The node to write to file
63 virtual void _writeDataValue(ImNode* node) {}
64
65 /// @brief Write the connection of one "Connection" to another
66 /// @param upstream The data output connection (typically, but not always an output) to connect
67 /// @param downstream The data input connection (typically, but not always an input) to connect
68 virtual void _writeDataConnection(Connection* upstream, Connection* downstream) {}
69
70 /// @brief Write all logged data to file
71 virtual void _writeLogData() {}
72
73 /// @brief Write the end of the file output
74 virtual void _writeOutputEnd() {}
75
76 // Autodoc framework, which we repurpose here for writing to file
77 AutoDoc* _autodoc_ptr;
78
79 // Vector in which to store watched nodes
80 std::vector<ImNode*> _watched_nodes;
81
82 // Vector in which to store sequenced nodes
83 std::vector<ImNode*> _sequenced_nodes;
84
85 // Vector of sequenced connections
86 std::vector<std::pair<Connection*, Connection*>> _paired_connections;
87
88 // String to record our filename
89 std::string _filename = "gui_config_file.py";
90 };
91}
92
93#endif
Class to document from code.
Definition AutoDoc.h:80
Write out script from UX to execute using set toolchain. Base class for override.
Definition ConfigurationWriter.h:25
virtual void _writeLogData()
Write all logged data to file.
Definition ConfigurationWriter.h:71
void file(const std::string &filename)
Set the file for write and redirect output to that file.
Definition ConfigurationWriter.h:36
virtual void _decomposeNodeInformation()
Decompose all relevant strings from the provided node and connection information.
Definition ConfigurationWriter.h:56
virtual void _writeOutputEnd()
Write the end of the file output.
Definition ConfigurationWriter.h:74
void write()
Write watched node data to file.
Definition ConfigurationWriter.cpp:45
virtual void _writeOutputStart()
Write the start of the file.
Definition ConfigurationWriter.h:59
virtual void _writeDataConnection(Connection *upstream, Connection *downstream)
Write the connection of one "Connection" to another.
Definition ConfigurationWriter.h:68
void watchNode(ImNode *target)
Add a node to the ConfigurationWriter for tracking.
Definition ConfigurationWriter.cpp:19
virtual void _writeDataValue(ImNode *node)
Write the creation of a single node, given by node.
Definition ConfigurationWriter.h:63
void unwatchNode(ImNode *target)
Remove a node from the ConfigurationWriter for tracking.
Definition ConfigurationWriter.cpp:32
virtual void _setNodeConnectionSequence()
Set the sequence of nodes for creation and write paired connections.
Definition ConfigurationWriter.h:53
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18
Hold all information related to a connection point in the ImGUI UX.
Definition Connection.h:48
Hold all data related to a visual node in the ImGUI UX.
Definition ImNode.h:39