ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
Connection.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_CONNECTION_H
17#define CPP_APP_CONNECTION_H
18
19#include <array>
20#include <string>
21#include <vector>
22
23#include "nlohmann/json.hpp"
24
25#include "data_management/DataIOBase.h"
26
27namespace modelspace {
28/// @brief Hold acceptable values for connection type
30 PARAM = -1, // One-off input value set on startup
31 INPUT = -2, // Input to be set regularly (mapped to upstream source typically)
32 ALL_INPUT = -3, // Special value to indicate all inputs to a node
33 OUTPUT = 1 // Output
34};
35
36/// @brief Hold all connection type enum values to loop through
38 {connection_type_e::PARAM, "Param"},
39 {connection_type_e::INPUT, "Input"}
40// TODO(Alex) do we need a node section for the ALL_INPUT type?
41// (If not, we probably don't need this whole map)
42 // {connection_type_e::ALL_INPUT, "All input"},
43// Only sorting inputs/params when drawing nodes, so leave this out
44 // {connection_type_e::OUTPUT, "Output"}
45};
46
47/** @brief Hold all information related to a connection point in the ImGUI UX */
48struct Connection {
49 /// @brief The name of the connection
50 std::string name;
51
52 /// @brief The unique ID of the connection given by the ImGUI UX or other
53 long unique_id;
54
55 /// @brief The type of connection
57
58 /// @brief The data type associated with the connection
59 clockwerk::dataio_types_e data_type;
60
61 /// @brief The size of the connection as rows, columns
62 std::array<unsigned int, 2> size;
63
64 /// @brief The values held within the connection. All values are stored as string
66
67 /// @brief Boolean indicating whether the connection is writable (true) or not (false)
68 int writable;
69
70 /// @brief The connection to which this connection is paired, given by unique ID
72
73 /// @brief The parent to this connection, given by its unique ID number
74 long parent_node_id;
75
76 /// @brief Flag to indicate whether user has set this value via the GUI
77 int user_set;
78
79 /// @brief Create Connection object from json
80 /// @param j The json object from which Connection is created
81 void fromJson(const nlohmann::json &j);
82
83 /// @brief Create json object from Connection
84 /// @return The json object from connection data
86
87 /// @brief Output all connection information
88 void dump();
89};
90
91} // namespace modelspace
92
93#endif
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18
const std::vector< std::pair< connection_type_e, std::string > > CONN_TYPES
Hold all connection type enum values to loop through.
Definition Connection.h:37
connection_type_e
Hold acceptable values for connection type.
Definition Connection.h:29
Hold all information related to a connection point in the ImGUI UX.
Definition Connection.h:48
int user_set
Flag to indicate whether user has set this value via the GUI.
Definition Connection.h:77
long unique_id
The unique ID of the connection given by the ImGUI UX or other.
Definition Connection.h:53
connection_type_e connection_type
The type of connection.
Definition Connection.h:56
std::array< unsigned int, 2 > size
The size of the connection as rows, columns.
Definition Connection.h:62
nlohmann::json toJson()
Create json object from Connection.
Definition Connection.cpp:40
void dump()
Output all connection information.
Definition Connection.cpp:60
std::vector< std::vector< std::string > > values
The values held within the connection. All values are stored as string.
Definition Connection.h:65
long paired_connection_id
The connection to which this connection is paired, given by unique ID.
Definition Connection.h:71
int writable
Boolean indicating whether the connection is writable (true) or not (false)
Definition Connection.h:68
void fromJson(const nlohmann::json &j)
Create Connection object from json.
Definition Connection.cpp:19
std::string name
The name of the connection.
Definition Connection.h:50
long parent_node_id
The parent to this connection, given by its unique ID number.
Definition Connection.h:74
clockwerk::dataio_types_e data_type
The data type associated with the connection.
Definition Connection.h:59