• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 25578281892

08 May 2026 08:36PM UTC coverage: 56.774%. Remained the same
25578281892

Pull #2112

github

web-flow
Merge 7d0b4c8c8 into af8c162b8
Pull Request #2112: Added to show a dialog window for applicable trick java apps while the variable server is disabled.

0 of 4 new or added lines in 1 file covered. (0.0%)

4 existing lines in 2 files now uncovered.

12915 of 22748 relevant lines covered (56.77%)

300673.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.67
/trick_source/sim_services/ExternalApplications/ExternalApplication.cpp
1

2
#include <sstream>
3
#include <iostream>
4
#include <stdlib.h>
5
#include <dlfcn.h>
6
#include <vector>
7
#include <cstring>
8

9
#include "trick/ExternalApplication.hh"
10
#include "trick/ExternalApplicationManager.hh"
11
#include "trick/variable_server_proto.h"
12
#include "trick/env_proto.h"
13
#include "trick/command_line_protos.h"
14
#include "trick/MemoryManager.hh"
15
extern Trick::MemoryManager* trick_MM;
16

17
Trick::ExternalApplication::ExternalApplication() :
934✔
18
    command(std::string(env_get_var("TRICK_HOME") + std::string("/bin/"))) {
934✔
19
    host_source = port_source = AUTO;
934✔
20
    cycle_period_set = minimum_cycle_period_set = disconnect_behavior_set = height_set =
934✔
21
      width_set = x_set = y_set = auto_reconnect_set = false;
934✔
22
}
934✔
23

24
Trick::ExternalApplication::~ExternalApplication() {
934✔
25
}
934✔
26

27
void Trick::ExternalApplication::set_startup_command(std::string in_command) {
×
28
    command = in_command;
×
29
}
×
30

31
std::string Trick::ExternalApplication::get_startup_command() {
×
32
    return command;
×
33
}
34

35
const char * Trick::ExternalApplication::get_startup_command_c_str() {
×
36
    return command.c_str();
×
37
}
38

39
void Trick::ExternalApplication::add_arguments(std::string args) {
×
40
    arguments << " " << args;
×
41
}
×
42

43
void Trick::ExternalApplication::set_arguments(std::string args) {
×
44
    arguments.str(args);
×
45
    host_source = port_source = NONE;
×
46
    cycle_period_set = disconnect_behavior_set = height_set = width_set = x_set = y_set = false;
×
47
}
×
48

49
std::string Trick::ExternalApplication::get_arguments() {
×
50
    return arguments.str() + create_arguments_string();
×
51
}
52

53
void Trick::ExternalApplication::set_host(std::string in_host) {
×
54
    host = in_host;
×
55
    host_source = USER;
×
56
}
×
57

58
std::string Trick::ExternalApplication::get_host() {
×
59
    return host;
×
60
}
61

62
void Trick::ExternalApplication::set_port(unsigned short in_port) {
×
63
    port = in_port;
×
64
    port_source = USER;
×
65
}
×
66

67
unsigned short Trick::ExternalApplication::get_port() {
×
68
    return port;
×
69
}
70

71
void Trick::ExternalApplication::set_auto_reconnect(bool in_auto_reconnect) {
×
72
    auto_reconnect = in_auto_reconnect;
×
73
    auto_reconnect_set = true;
×
74
}
×
75

76
bool Trick::ExternalApplication::get_auto_reconnect() {
×
77
    return auto_reconnect;
×
78
}
79

80
void Trick::ExternalApplication::set_cycle_period(double in_cycle_period) {
×
81
    cycle_period = in_cycle_period;
×
82
    cycle_period_set = true;
×
83
}
×
84

85
double Trick::ExternalApplication::get_cycle_period() {
×
86
    return cycle_period;
×
87
}
88

89
void Trick::ExternalApplication::set_minimum_cycle_period(double in_minimum_cycle_period) {
×
90
    minimum_cycle_period = in_minimum_cycle_period;
×
91
    minimum_cycle_period_set = true;
×
92
}
×
93

94
double Trick::ExternalApplication::get_minimum_cycle_period() {
×
95
    return minimum_cycle_period;
×
96
}
97

98
void Trick::ExternalApplication::set_disconnect_behavior(DisconnectBehavior in_disconnect_behavior) {
×
99
    disconnect_behavior = in_disconnect_behavior;
×
100
    disconnect_behavior_set = true;
×
101
}
×
102

103
Trick::ExternalApplication::DisconnectBehavior Trick::ExternalApplication::get_disconnect_behavior() {
×
104
    return disconnect_behavior;
×
105
}
106

107
void Trick::ExternalApplication::set_height(int in_height) {
×
108
    height = in_height;
×
109
    height_set = true;
×
110
}
×
111

112
int Trick::ExternalApplication::get_height() {
×
113
    return height;
×
114
}
115

116
void Trick::ExternalApplication::set_width(int in_width) {
×
117
    width = in_width;
×
118
    width_set = true;
×
119
}
×
120

121
int Trick::ExternalApplication::get_width() {
×
122
    return width;
×
123
}
124

125
void Trick::ExternalApplication::set_x(int in_x) {
×
126
    x = in_x;
×
127
    x_set = true;
×
128
}
×
129

130
int Trick::ExternalApplication::get_x() {
×
131
    return x;
×
132
}
133

134
void Trick::ExternalApplication::set_y(int in_y) {
×
135
    y = in_y;
×
136
    y_set = true;
×
137
}
×
138

139
int Trick::ExternalApplication::get_y() {
×
140
    return y;
×
141
}
142

143
/** @par Detailed Design */
144
void Trick::ExternalApplication::launch() {
×
145
    /** <ul><li> If the application is enabled: */
NEW
146
    std::ostringstream oss;
×
UNCOV
147
    if (var_server_get_enabled()) {
×
148
        /** <ul><li> Execute the command and pass it any arguments. */
149
        oss << command << " " << arguments.str() << " " << create_arguments_string() ;
×
UNCOV
150
        oss << " &";
×
151
    } else {
152
        /** <ul><li> Execute the command with a flag indicating the Variable Server is disabled. */
NEW
153
        oss << command << " --varServerDisabled &";
×
154
    }
NEW
155
    std::cout << oss.str() << std::endl;
×
NEW
156
    system(oss.str().c_str());
×
UNCOV
157
}
×
158

159
std::string Trick::ExternalApplication::create_arguments_string() {
×
160
    std::ostringstream oss;
×
161

162
    switch (host_source) {
×
163
        case AUTO:
×
164
            host = var_server_get_hostname();
×
165
        case USER:
×
166
            oss << " --host " << host;
×
167
        case NONE:
×
168
            break;
×
169
    }
170

171
    switch (port_source) {
×
172
        case AUTO:
×
173
            port = var_server_get_port();
×
174
        case USER:
×
175
            oss << " --port " << port;
×
176
        case NONE:
×
177
            break;
×
178
    }
179

180
    if (minimum_cycle_period_set) {
×
181
        oss << " --minCycle " << minimum_cycle_period;
×
182
    }
183

184
    if (cycle_period_set) {
×
185
        oss << " --cycle " << cycle_period;
×
186
    }
187

188
    if (disconnect_behavior_set) {
×
189
        switch(disconnect_behavior) {
×
190
            case CLOSE:
×
191
                oss << " --disconnectBehavior Close";
×
192
                break;
×
193
            case NOTIFY:
×
194
                oss << " --disconnectBehavior Notify";
×
195
                break;
×
196
            case NOTHING:
×
197
                oss << " --disconnectBehavior Nothing";
×
198
                break;
×
199
            default:
×
200
                std::cout << __FILE__ << ":" << __LINE__ << ":  [33;1mwarning: [0m "
×
201
                          << "Ignoring invalid value (" << disconnect_behavior
×
202
                          << ") for disconnect_behavior." << std::endl;
×
203
                break;
×
204
        }
205
    }
206

207
    if (height_set) {
×
208
        oss << " --height " << height;
×
209
    }
210

211
    if (width_set) {
×
212
        oss << " --width " << width;
×
213
    }
214

215
    if (x_set) {
×
216
        oss << " --x " << x;
×
217
    }
218

219
    if (y_set) {
×
220
        oss << " --y " << y;
×
221
    }
222

223
    if (auto_reconnect_set) {
×
224
        oss << " --autoReconnect " << (auto_reconnect ? "true" : "false");
×
225
    }
226

227
    return oss.str();
×
228
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc