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

nasa / trick / 17772917031

16 Sep 2025 04:46PM UTC coverage: 55.866% (-0.005%) from 55.871%
17772917031

Pull #1958

github

web-flow
Merge d8200bf04 into ed8b1979f
Pull Request #1958: Resolves potential-for-fpe-in-run_ratio-sample-calcs

10 of 12 new or added lines in 1 file covered. (83.33%)

5 existing lines in 3 files now uncovered.

12352 of 22110 relevant lines covered (55.87%)

267838.56 hits per line

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

39.08
/trick_source/sim_services/Executive/Executive_c_intf.cpp
1

2
#include <iostream>
3
#include <vector>
4
#include <string>
5

6
#include "trick/Executive.hh"
7
#include "trick/ExecutiveException.hh"
8
#include "trick/exec_proto.h"
9
#include "trick/exec_proto.hh"
10

11
/* Global singleton pointer to the executive */
12
extern Trick::Executive * the_exec ;
13

14
/**
15
 * @relates Trick::Executive
16
 * returns a pointer to the simulation executive
17
 * @return Executive
18
 */
19
Trick::Executive * exec_get_exec_cpp() {
182✔
20
    return ( the_exec ) ;
182✔
21
}
22

23
/*********************************************************/
24
/* These routines are the "C" interface to the executive */
25
/*********************************************************/
26

27
// -------------------------- GET ------------------------
28

29
/**
30
 * @relates Trick::Executive
31
 * @copydoc Trick::Executive::get_attach_debugger
32
 * C wrapper for Trick::Executive::get_attach_debugger
33
 */
34
extern "C" int exec_get_attach_debugger() {
×
35
    if ( the_exec != NULL ) {
×
36
        return (int)the_exec->get_attach_debugger() ;
×
37
    }
38
    return -1 ;
×
39
}
40

41
/**
42
 * @relates Trick::Executive
43
 * @copydoc Trick::Executive::get_debugger_command
44
 * C wrapper for Trick::Executive::get_debugger_command
45
 */
46
extern "C" const char * exec_get_debugger_command() {
×
47
    if ( the_exec != NULL ) {
×
48
        return the_exec->get_debugger_command().c_str() ;
×
49
    }
50
    return NULL ;
×
51
}
52

53
/**
54
 * @relates Trick::Executive
55
 * @copydoc Trick::Executive::get_enable_freeze
56
 * C wrapper for Trick::Executive::get_enable_freeze
57
 */
58
extern "C" int exec_get_enable_freeze() {
×
59
    if ( the_exec != NULL ) {
×
60
        return (int)the_exec->get_enable_freeze() ;
×
61
    }
62
    return -1 ;
×
63
}
64

65
/**
66
 * @relates Trick::Executive
67
 * @copydoc Trick::Executive::get_exec_command
68
 * C wrapper for Trick::Executive::get_exec_command
69
 */
70
extern "C" SIM_COMMAND exec_get_exec_command() {
3✔
71
    if ( the_exec != NULL ) {
3✔
72
        return the_exec->get_exec_command() ;
3✔
73
    }
74
    return NoCmd ;
×
75
}
76

77
/**
78
 * @relates Trick::Executive
79
 * @copydoc Trick::Executive::get_freeze_frame
80
 * C wrapper for Trick::Executive::get_freeze_frame
81
 */
82
extern "C" double exec_get_freeze_frame() {
×
83
    if ( the_exec != NULL ) {
×
84
        return the_exec->get_freeze_frame() ;
×
85
    }
86
    return 0.0 ;
×
87
}
88

89
/**
90
 * @relates Trick::Executive
91
 * @copydoc Trick::Executive::get_freeze_command
92
 * C wrapper for Trick::Executive::get_freeze_command
93
 */
94
extern "C" int exec_get_freeze_command() {
×
95
    if ( the_exec != NULL ) {
×
96
        return (int)the_exec->get_freeze_command() ;
×
97
    }
98
    return -1 ;
×
99
}
100

101
/**
102
 * @relates Trick::Executive
103
 * @copydoc Trick::Executive::get_freeze_on_frame_boundary
104
 * C wrapper for Trick::Executive::get_freeze_on_frame_boundary
105
 */
106
extern "C" int exec_get_freeze_on_frame_boundary() {
×
107
    if ( the_exec != NULL ) {
×
108
        return (int)the_exec->get_freeze_on_frame_boundary() ;
×
109
    }
110
    return -1 ;
×
111
}
112

113
/**
114
 * @relates Trick::Executive
115
 * @copydoc Trick::Executive::get_freeze_frame_tics
116
 * C wrapper for Trick::Executive::get_freeze_frame_tics
117
 */
118
extern "C" long long exec_get_freeze_frame_tics() {
×
119
    if ( the_exec != NULL ) {
×
120
        return the_exec->get_freeze_frame_tics() ;
×
121
    }
122
    return -1 ;
×
123
}
124

125
/**
126
 * @relates Trick::Executive
127
 * @copydoc Trick::Executive::get_freeze_frame_count
128
 * C wrapper for Trick::Executive::get_freeze_frame_count
129
 */
130
extern "C" long long exec_get_freeze_frame_count() {
×
131
    if ( the_exec != NULL ) {
×
132
        return the_exec->get_freeze_frame_count() ;
×
133
    }
134
    return -1 ;
×
135
}
136

137
/**
138
 * @relates Trick::Executive
139
 * @copydoc Trick::Executive::get_job_cycle
140
 * C wrapper for Trick::Executive::get_job_cycle
141
 */
142
extern "C" double exec_get_job_cycle(const char * job_name) {
90,003✔
143

144
    if ( the_exec != NULL ) {
90,003✔
145

146
        std::string job_string ;
90,003✔
147

148
        // Add handling for NULL string.
149
        if ( job_name == NULL ) {
90,003✔
150
            job_string.clear() ;
90,003✔
151
        } else {
152
            job_string = std::string(job_name) ;
×
153
        }
154
        return the_exec->get_job_cycle(job_string) ;
90,003✔
155
    }
156
    return -1.0 ;
×
157
}
158

159
/**
160
 * @relates Trick::Executive
161
 * @copydoc Trick::Executive::get_mode
162
 * C wrapper for Trick::Executive::get_mode
163
 */
164
extern "C" SIM_MODE exec_get_mode() {
1,987,384✔
165
    if ( the_exec != NULL ) {
1,987,384✔
166
        return the_exec->get_mode() ;
1,987,384✔
167
    }
168
    return Initialization ;
×
169
}
170

171
/**
172
 * @relates Trick::Executive
173
 * @copydoc Trick::Executive::get_num_threads
174
 * C wrapper for Trick::Executive::get_num_threads
175
 */
176
extern "C" unsigned int exec_get_num_threads() {
542✔
177
    if ( the_exec != NULL ) {
542✔
178
        return the_exec->get_num_threads() ;
542✔
179
    }
180
    return -1 ;
×
181
}
182

183
/**
184
 * @relates Trick::Executive
185
 * @copydoc Trick::Executive::get_time_tic_value
186
 * C wrapper for Trick::Executive::get_time_tic_value
187
 */
188
extern "C" int exec_get_old_time_tic_value() {
1✔
189
    if ( the_exec != NULL ) {
1✔
190
        return the_exec->get_old_time_tic_value() ;
1✔
191
    }
192
    return -1 ;
×
193
}
194

195
/**
196
 * @relates Trick::Executive
197
 * @copydoc Trick::Executive::get_process_id
198
 * C wrapper for Trick::Executive::get_process_id
199
 */
200
extern "C" unsigned int exec_get_process_id() {
33,660✔
201
    if ( the_exec != NULL ) {
33,660✔
202
        return the_exec->get_process_id() ;
33,660✔
203
    }
204
    return -1 ;
×
205
}
206

207
/**
208
 * @relates Trick::Executive
209
 * @copydoc Trick::Executive::get_rt_nap
210
 * C wrapper for Trick::Executive::get_rt_nap
211
 */
212
extern "C" int exec_get_rt_nap() {
82,575✔
213
    if ( the_exec != NULL ) {
82,575✔
214
        return (int)the_exec->get_rt_nap() ;
82,575✔
215
    }
216
    return -1 ;
×
217
}
218

219
/**
220
 * @relates Trick::Executive
221
 * @copydoc Trick::Executive::get_scheduled_start_index
222
 * C wrapper for Trick::Executive::get_scheduled_start_index
223
 */
224
extern "C" int exec_get_scheduled_start_index() {
27,772✔
225
    if ( the_exec != NULL ) {
27,772✔
226
        return the_exec->get_scheduled_start_index() ;
27,772✔
227
    }
228
    return -1 ;
×
229
}
230

231
/**
232
 * @relates Trick::Executive
233
 * @copydoc Trick::Executive::get_sim_time
234
 * C wrapper for Trick::Executive::get_sim_time
235
 */
236
extern "C" double exec_get_sim_time() {
10,719,896✔
237
    if ( the_exec != NULL ) {
10,719,896✔
238
        return the_exec->get_sim_time() ;
10,719,896✔
239
    }
240
    return -1.0 ;
×
241
}
242

243
/**
244
 * @relates Trick::Executive
245
 * @copydoc Trick::Executive::get_software_frame
246
 * C wrapper for Trick::Executive::get_software_frame
247
 */
248
extern "C" double exec_get_software_frame() {
365,503✔
249
    if ( the_exec != NULL ) {
365,503✔
250
        return the_exec->get_software_frame() ;
365,503✔
251
    }
252
    return -1.0 ;
×
253
}
254

255
/**
256
 * @relates Trick::Executive
257
 * @copydoc Trick::Executive::get_software_frame_tics
258
 * C wrapper for Trick::Executive::get_software_frame_tics
259
 */
260
extern "C" long long exec_get_software_frame_tics() {
×
261
    if ( the_exec != NULL ) {
×
262
        return the_exec->get_software_frame_tics() ;
×
263
    }
264
    return -1 ;
×
265
}
266

267
/**
268
 * @relates Trick::Executive
269
 * @copydoc Trick::Executive::get_frame_count
270
 * C wrapper for Trick::Executive::get_frame_count
271
 */
272
extern "C" long long exec_get_frame_count() {
5,253✔
273
    if ( the_exec != NULL ) {
5,253✔
274
        return the_exec->get_frame_count() ;
5,253✔
275
    }
276
    return -1 ;
×
277
}
278

279
/**
280
 * @relates Trick::Executive
281
 * @copydoc Trick::Executive::get_stack_trace
282
 * C wrapper for Trick::Executive::get_stack_trace
283
 */
284
extern "C" int exec_get_stack_trace() {
×
285
    if ( the_exec != NULL ) {
×
286
        return (int)the_exec->get_stack_trace() ;
×
287
    }
288
    return -1 ;
×
289
}
290

291
/**
292
 * @relates Trick::Executive
293
 * @copydoc Trick::Executive::get_terminate_time
294
 * C wrapper for Trick::Executive::get_terminate_time
295
 */
296
extern "C" double exec_get_terminate_time() {
1✔
297
    if ( the_exec != NULL ) {
1✔
298
        return the_exec->get_terminate_time() ;
1✔
299
    }
300
    return -1.0 ;
×
301
}
302

303
extern "C" double exec_get_thread_amf_cycle_time(unsigned int thread_id) {
×
304
    if ( the_exec != NULL ) {
×
305
        return the_exec->get_thread_amf_cycle_time(thread_id) ;
×
306
    }
307
    return -1.0 ;
×
308
}
309
/**
310
 * @relates Trick::Executive
311
 * @copydoc Trick::Executive::get_time_tic_value
312
 * C wrapper for Trick::Executive::get_time_tic_value
313
 */
314
extern "C" int exec_get_time_tic_value() {
107,018✔
315
    if ( the_exec != NULL ) {
107,018✔
316
        return the_exec->get_time_tic_value() ;
107,007✔
317
    }
318
    return -1 ;
11✔
319
}
320

321
/**
322
 * @relates Trick::Executive
323
 * @copydoc Trick::Executive::get_time_tics
324
 * C wrapper for Trick::Executive::get_time_tics
325
 */
326
extern "C" long long exec_get_time_tics() {
7,297,097✔
327
    if ( the_exec != NULL ) {
7,297,097✔
328
        return the_exec->get_time_tics() ;
7,297,097✔
329
    }
UNCOV
330
    return -1 ;
×
331
}
332

333
/**
334
 * @relates Trick::Executive
335
 * @copydoc Trick::Executive::get_freeze_time_tics
336
 * C wrapper for Trick::Executive::get_freeze_time_tics
337
 */
338
extern "C" long long exec_get_freeze_time_tics() {
2✔
339
    if ( the_exec != NULL ) {
2✔
340
        return the_exec->get_freeze_time_tics() ;
2✔
341
    }
342
    return -1 ;
×
343
}
344

345
/**
346
 * @relates Trick::Executive
347
 * @copydoc Trick::Executive::get_trap_sigbus
348
 * C wrapper for Trick::Executive::get_trap_sigbus
349
 */
350
extern "C" int exec_get_trap_sigbus() {
×
351
    if ( the_exec != NULL ) {
×
352
        return (int)the_exec->get_trap_sigbus() ;
×
353
    }
354
    return -1 ;
×
355
}
356

357
/**
358
 * @relates Trick::Executive
359
 * @copydoc Trick::Executive::get_trap_sigfpe
360
 * C wrapper for Trick::Executive::get_trap_sigfpe
361
 */
362
extern "C" int exec_get_trap_sigfpe() {
×
363
    if ( the_exec != NULL ) {
×
364
        return (int)the_exec->get_trap_sigfpe() ;
×
365
    }
366
    return -1 ;
×
367
}
368

369
/**
370
 * @relates Trick::Executive
371
 * @copydoc Trick::Executive::get_trap_sigsegv
372
 * C wrapper for Trick::Executive::get_trap_sigsegv
373
 */
374
extern "C" int exec_get_trap_sigsegv() {
×
375
    if ( the_exec != NULL ) {
×
376
        return (int)the_exec->get_trap_sigsegv() ;
×
377
    }
378
    return -1 ;
×
379
}
380

381
/**
382
 * @relates Trick::Executive
383
 * @copydoc Trick::Executive::get_trap_sigabrt
384
 * C wrapper for Trick::Executive::get_trap_sigabrt
385
 */
386
extern "C" int exec_get_trap_sigabrt() {
×
387
    if ( the_exec != NULL ) {
×
388
        return (int)the_exec->get_trap_sigabrt() ;
×
389
    }
390
    return -1 ;
×
391
}
392

393
/**
394
 * @relates Trick::Executive
395
 * @copydoc Trick::Executive::get_trap_sigchld
396
 * C wrapper for Trick::Executive::get_trap_sigchld
397
 */
398
extern "C" int exec_get_trap_sigchld() {
×
399
    if ( the_exec != NULL ) {
×
400
        return (int)the_exec->get_trap_sigchld() ;
×
401
    }
402
    return -1 ;
×
403
}
404

405
// -------------------------- SET ------------------------
406

407
/**
408
@relates Trick::Executive
409
@copybrief Trick::Executive::set_attach_debugger
410

411
@par Python Usage:
412
@code trick.exec_set_attach_debugger(<on_off>) @endcode
413

414
C wrapper for Trick::Executive::set_attach_debugger
415
 */
416
extern "C" int exec_set_attach_debugger( int on_off ) {
×
417
    if ( the_exec != NULL ) {
×
418
        return the_exec->set_attach_debugger((bool)on_off) ;
×
419
    }
420
    return -1 ;
×
421
}
422

423
/**
424
@relates Trick::Executive
425
@copydoc Trick::Executive::set_debugger_command
426

427
@par Python Usage:
428
@code trick.exec_set_debugger_command("<command>") @endcode
429

430
C wrapper for Trick::Executive::set_debugger_command
431
*/
432
extern "C" int exec_set_debugger_command( const char * command ) {
×
433
    if ( the_exec != NULL ) {
×
434
        return ( the_exec->set_debugger_command(std::string(command)) ) ;
×
435
    }
436
    return -1 ;
×
437
}
438

439
/**
440
 * @relates Trick::Executive
441
 * @copydoc Trick::Executive::set_enable_freeze
442
 * C wrapper for Trick::Executive::set_enable_freeze
443
 */
444
extern "C" int exec_set_enable_freeze( int on_off ) {
2✔
445
    if ( the_exec != NULL ) {
2✔
446
        return the_exec->set_enable_freeze((bool)on_off) ;
2✔
447
    }
448
    return -1 ;
×
449
}
450

451
/**
452
 * @relates Trick::Executive
453
 * @copydoc Trick::Executive::set_exec_command
454
 * C wrapper for Trick::Executive::set_exec_command
455
 */
456
// TODO:  I don't think we need this function, too dangerous. (Alex 3/2/12)
457
extern "C" int exec_set_exec_command(SIM_COMMAND in_command) {
×
458
    if ( the_exec != NULL ) {
×
459
        return the_exec->set_exec_command(in_command) ;
×
460
    }
461
    return -1 ;
×
462
}
463

464
/**
465
 * @relates Trick::Executive
466
 * @copydoc Trick::Executive::set_freeze_command
467
 * C wrapper for Trick::Executive::set_freeze_command
468
 */
469
extern "C" int exec_set_freeze_command( int on_off ) {
1✔
470
    if ( the_exec != NULL ) {
1✔
471
        return the_exec->set_freeze_command((bool)on_off) ;
1✔
472
    }
473
    return -1 ;
×
474
}
475

476
/**
477
 * @relates Trick::Executive
478
 * @copydoc Trick::Executive::set_freeze_on_frame_boundary
479
 * C wrapper for Trick::Executive::set_freeze_on_frame_boundary
480
 */
481
extern "C" int exec_set_freeze_on_frame_boundary( int on_off ) {
×
482
    if ( the_exec != NULL ) {
×
483
        return the_exec->set_freeze_on_frame_boundary((bool)on_off) ;
×
484
    }
485
    return -1 ;
×
486
}
487

488
/**
489
 * @relates Trick::Executive
490
 * @copydoc Trick::Executive::set_freeze_frame
491
 * C wrapper for Trick::Executive::set_freeze_frame
492
 */
493
extern "C" int exec_set_freeze_frame(double in_frame) {
8✔
494
    if ( the_exec != NULL ) {
8✔
495
        return the_exec->set_freeze_frame(in_frame) ;
8✔
496
    }
497
    return -1 ;
×
498
}
499

500
/**
501
 * @relates Trick::Executive
502
 * @copydoc Trick::Executive::set_rt_nap
503
 * C wrapper for Trick::Executive::set_rt_nap
504
 */
505
extern "C" int exec_set_rt_nap( int on_off ) {
×
506
    if ( the_exec != NULL ) {
×
507
        return the_exec->set_rt_nap((bool)on_off) ;
×
508
    }
509
    return -1 ;
×
510
}
511

512
/**
513
 * @relates Trick::Executive
514
 * @copydoc Trick::Executive::set_software_frame
515
 * C wrapper for Trick::Executive::set_software_frame
516
 */
517
extern "C" int exec_set_software_frame(double in_frame) {
3✔
518
    if ( the_exec != NULL ) {
3✔
519
        return the_exec->set_software_frame(in_frame) ;
3✔
520
    }
521
    return -1 ;
×
522
}
523

524
/**
525
 * @relates Trick::Executive
526
 * @copydoc Trick::Executive::set_stack_trace
527
 * C wrapper for Trick::Executive::set_stack_trace
528
 */
529
extern "C" int exec_set_stack_trace( int on_off ) {
×
530
    if ( the_exec != NULL ) {
×
531
        return the_exec->set_stack_trace((bool)on_off) ;
×
532
    }
533
    return -1 ;
×
534
}
535

536
/**
537
 * @relates Trick::Executive
538
 * @copydoc Trick::Executive::set_terminate_time
539
 * C wrapper for Trick::Executive::set_terminate_time
540
 */
541
extern "C" int exec_set_terminate_time(double time_value) {
17✔
542
    if ( the_exec != NULL ) {
17✔
543
        return the_exec->set_terminate_time(time_value) ;
17✔
544
    }
545
    return -1 ;
×
546
}
547

548
/**
549
 * @relates Trick::Executive
550
 * @copydoc Trick::Executive::set_time
551
 * C wrapper for Trick::Executive::set_time
552
 */
553
extern "C" int exec_set_time( double in_time ) {
×
554
    if ( the_exec != NULL ) {
×
555
        return the_exec->set_time(in_time) ;
×
556
    }
557
    return -1 ;
×
558
}
559

560
/**
561
 * @relates Trick::Executive
562
 * @copydoc Trick::Executive::set_time_tics
563
 * C wrapper for Trick::Executive::set_time_tics
564
 */
565
extern "C" int exec_set_time_tics( long long in_time_tics ) {
×
566
    if ( the_exec != NULL ) {
×
567
        return the_exec->set_time_tics(in_time_tics) ;
×
568
    }
569
    return -1 ;
×
570
}
571

572
/**
573
 * @relates Trick::Executive
574
 * @copydoc Trick::Executive::set_time_tic_value
575
 * C wrapper for Trick::Executive::set_time_tic_value
576
 */
577
extern "C" int exec_set_time_tic_value( int in_time_tics ) {
1✔
578
    if ( the_exec != NULL ) {
1✔
579
        return the_exec->set_time_tic_value(in_time_tics) ;
1✔
580
    }
581
    return -1 ;
×
582
}
583

584
/**
585
 * @relates Trick::Executive
586
 * @copydoc Trick::Executive::set_trap_sigbus
587
 * C wrapper for Trick::Executive::set_trap_sigbus
588
 */
589
extern "C" int exec_set_trap_sigbus( int on_off ) {
×
590
    if ( the_exec != NULL ) {
×
591
        return the_exec->set_trap_sigbus((bool)on_off) ;
×
592
    }
593
    return -1 ;
×
594
}
595

596
/**
597
 * @relates Trick::Executive
598
 * @copydoc Trick::Executive::set_trap_sigfpe
599
 * C wrapper for Trick::Executive::set_trap_sigfpe
600
 */
601
extern "C" int exec_set_trap_sigfpe( int on_off ) {
×
602
    if ( the_exec != NULL ) {
×
603
        return the_exec->set_trap_sigfpe((bool)on_off) ;
×
604
    }
605
    return -1 ;
×
606
}
607

608
/**
609
 * @relates Trick::Executive
610
 * @copydoc Trick::Executive::set_trap_sigsegv
611
 * C wrapper for Trick::Executive::set_trap_sigsegv
612
 */
613
extern "C" int exec_set_trap_sigsegv( int on_off ) {
×
614
    if ( the_exec != NULL ) {
×
615
        return the_exec->set_trap_sigsegv((bool)on_off) ;
×
616
    }
617
    return -1 ;
×
618
}
619

620
/**
621
 * @relates Trick::Executive
622
 * @copydoc Trick::Executive::set_trap_sigsegv
623
 * C wrapper for Trick::Executive::set_trap_sigsegv
624
 */
625
extern "C" int exec_set_trap_sigabrt( int on_off ) {
×
626
    if ( the_exec != NULL ) {
×
627
        return the_exec->set_trap_sigabrt((bool)on_off) ;
×
628
    }
629
    return -1 ;
×
630
}
631

632
/**
633
 * @relates Trick::Executive
634
 * @copydoc Trick::Executive::set_trap_sigsegv
635
 * C wrapper for Trick::Executive::set_trap_sigsegv
636
 */
637
extern "C" int exec_set_trap_sigchld( int on_off ) {
×
638
    if ( the_exec != NULL ) {
×
639
        return the_exec->set_trap_sigchld((bool)on_off) ;
×
640
    }
641
    return -1 ;
×
642
}
643

644
/**
645
 * @relates Trick::Executive
646
 * @copydoc Trick::Executive::set_job_onoff
647
 * C wrapper for Trick::Executive::set_job_onoff
648
 */
649
extern "C" int exec_set_job_onoff(const char * job_name , int instance , int on) {
7✔
650
    if ( the_exec != NULL ) {
7✔
651
        return the_exec->set_job_onoff( job_name , instance , on) ;
7✔
652
    }
653
    return -1 ;
×
654
}
655

656
/**
657
 * @relates Trick::Executive
658
 * @copydoc Trick::Executive::set_sim_object_onoff
659
 * C wrapper for Trick::Executive::set_sim_object_onoff
660
 */
661
extern "C" int exec_set_sim_object_onoff(const char * sim_object_name , int on) {
1✔
662
    if ( the_exec != NULL ) {
1✔
663
        return the_exec->set_sim_object_onoff( sim_object_name , on) ;
1✔
664
    }
665
    return -1 ;
×
666
}
667

668
/**
669
 * @relates Trick::Executive
670
 * @copydoc Trick::Executive::get_sim_object_onoff
671
 * C wrapper for Trick::Executive::get_sim_object_onoff
672
 */
673
extern "C" int exec_get_sim_object_onoff(const char * sim_object_name ) {
×
674
    if ( the_exec != NULL ) {
×
675
        return the_exec->get_sim_object_onoff( sim_object_name ) ;
×
676
    }
677
    return -1 ;
×
678
}
679

680
/**
681
 * @relates Trick::Executive
682
 * @copydoc Trick::Executive::set_sim_object_jobs_onoff
683
 * C wrapper for Trick::Executive::set_sim_object_jobs_onoff
684
 */
685
extern "C" int exec_set_sim_object_jobs_onoff(const char * sim_object_name , int on) {
×
686
    if ( the_exec != NULL ) {
×
687
        return the_exec->set_sim_object_jobs_onoff( sim_object_name , on) ;
×
688
    }
689
    return -1 ;
×
690
}
691

692
/**
693
 * @relates Trick::Executive
694
 * @copydoc Trick::Executive::set_version_date_tag
695
 * C wrapper for Trick::Executive::set_version_date_tag
696
 */
697
extern "C" int exec_set_version_date_tag(const char * tag) {
182✔
698
    if ( the_exec != NULL ) {
182✔
699
        return the_exec->set_version_date_tag(std::string(tag)) ;
182✔
700
    }
701
    return -1 ;
×
702
}
703

704
/**
705
 * @relates Trick::Executive
706
 * @copydoc Trick::Executive::set_build_date
707
 * C wrapper for Trick::Executive::set_build_date
708
 */
709
extern "C" int exec_set_build_date(const char * date) {
182✔
710
    if ( the_exec != NULL ) {
182✔
711
        return the_exec->set_build_date(std::string(date)) ;
182✔
712
    }
713
    return -1 ;
×
714
}
715

716
/**
717
 * @relates Trick::Executive
718
 * @copydoc Trick::Executive::set_current_version
719
 * C wrapper for Trick::Executive::set_current_version
720
 */
721
extern "C" int exec_set_current_version(const char * version) {
182✔
722
    if ( the_exec != NULL ) {
182✔
723
        return the_exec->set_current_version(std::string(version)) ;
182✔
724
    }
725
    return -1 ;
×
726
}
727

728
/**
729
 * @relates Trick::Executive
730
 * @copydoc Trick::Executive::set_current_version
731
 * C wrapper for Trick::Executive::set_current_version
732
 */
733
extern "C" const char * exec_get_current_version() {
185✔
734
    if ( the_exec != NULL ) {
185✔
735
        return the_exec->get_current_version().c_str() ;
185✔
736
    }
737
    return NULL ;
×
738
}
739

740
/**
741
 * @relates Trick::Executive
742
 * @userdesc Raise a signal on the main thread to terminate the simuation immediately.
743
 * This is not typically used by users.  Use exec_terminate instead.
744
 */
745
extern "C" void exec_signal_terminate() {
2✔
746
    // ret_code = 0 for this call.
747
    if ( the_exec != NULL ) {
2✔
748
        pthread_kill( the_exec->get_pthread_id(0) , SIGUSR1 ) ;
×
749
    }
750
}
2✔
751

752
/**
753
 * @relates Trick::Executive
754
 * @userdesc C wrapper to transition to Shutdown mode.  Throws Trick::ExecutiveException exception.  This version
755
 * @ is backwards compatible
756
 * @param file_name - file name of the caller to exec_terminate
757
 * @param error - error message to print
758
 */
759
extern "C" int exec_terminate(const char *file_name , const char *error ) {
×
760
    throw Trick::ExecutiveException(0 , file_name , 0 , error) ;
×
761
    // never reached
762
    return 0 ;
763
}
764

765
/**
766
 * @relates Trick::Executive
767
 * @userdesc C wrapper to transition to Shutdown mode.  Throws Trick::ExecutiveException exception
768
 * @param ret_code - return code to pass back to caller of init() or loop() ;
769
 * @param file_name - file name of the caller to exec_terminate
770
 * @param line - line number where exception occurred
771
 * @param error - error message to print
772
 * @return ret_code (but never reached)
773
 */
774
extern "C" int exec_terminate_with_return(int ret_code , const char *file_name , int line , const char *error ) {
188✔
775
    throw Trick::ExecutiveException(ret_code , file_name , line , error) ;
188✔
776
    // never reached
777
    return ret_code ;
778
}
779

780
/**
781
 * @relates Trick::Executive
782
 * @copydoc Trick::Executive::freeze
783
 * C wrapper for Trick::Executive::freeze
784
 */
785
extern "C" int exec_freeze() {
×
786
    if ( the_exec != NULL ) {
×
787
        return the_exec->freeze() ;
×
788
    }
789
    return -1 ;
×
790
}
791

792
/**
793
 * @relates Trick::Executive
794
 * @copydoc Trick::Executive::run
795
 * C wrapper for Trick::Executive::run
796
 */
797
extern "C" int exec_run() {
×
798
    if ( the_exec != NULL ) {
×
799
        return the_exec->run() ;
×
800
    }
801
    return -1 ;
×
802
}
803

804
/**
805
 * @relates Trick::Executive
806
   @userdesc C wrapper to add an instrumentation job before all initialization, integration,
807
    scheduled, shutdown, top_of_frame & end_of_frame jobs.
808
 * Calls Trick::Executive::instrument_job_before(job_name, "", NULL)
809
 * @param job_name - name of the job to instrument.  Name follows convention in RUN_<dir>/S_job_execution
810
 * @return number of times the job was inserted
811
 */
812
extern "C" int exec_instrument_before(const char * job_name) {
1✔
813
    if ( the_exec != NULL ) {
1✔
814
        return the_exec->instrument_job_before(job_name) ;
1✔
815
    }
816
    return -1 ;
×
817
}
818

819
/**
820
 * @relates Trick::Executive
821
   @userdesc C wrapper to add an instrumentation job after all initialization, integration,
822
    scheduled, shutdown, top_of_frame & end_of_frame jobs.
823
 * Calls Trick::Executive::instrument_job_after(job_name, "", NULL)
824
 * @param job_name - name of the job to instrument.  Name follows convention in RUN_<dir>/S_job_execution
825
 * @return number of times the job was inserted
826
 */
827
extern "C" int exec_instrument_after(const char * job_name) {
1✔
828
    if ( the_exec != NULL ) {
1✔
829
        return the_exec->instrument_job_after(job_name) ;
1✔
830
    }
831
    return -1 ;
×
832
}
833

834
/**
835
 * @relates Trick::Executive
836
   @userdesc C wrapper to remove all jobs with name job_name from all job queues.
837
 * Calls Trick::Executive::instrument_job_remove(job_name, NULL)
838
 * @param job_name - name of the job to remove.  Name follows convention in RUN_<dir>/S_job_execution
839
 * @return always 0
840
 */
841
extern "C" int exec_instrument_remove(const char * job_name) {
×
842
    if ( the_exec != NULL ) {
×
843
        return the_exec->instrument_job_remove(job_name) ;
×
844
    }
845
    return -1 ;
×
846
}
847

848
/**
849
 * @relates Trick::Executive
850
 * @copydoc Trick::Executive::set_thread_enabled
851
 * C wrapper for Trick::Executive::set_thread_enabled
852
 */
853
extern "C" int exec_set_thread_enabled( unsigned int thread_id , int yes_no ) {
×
854
    if ( the_exec != NULL ) {
×
855
        return the_exec->set_thread_enabled(thread_id , yes_no) ;
×
856
    }
857
    return -1 ;
×
858
}
859

860
/**
861
 * @relates Trick::Executive
862
 * @copydoc Trick::Executive::set_thread_amf_cycle_time
863
 * C wrapper for Trick::Executive::set_thread_amf_cycle_time
864
 */
865
extern "C" int exec_set_thread_amf_cycle_time( unsigned int thread_id , double cycle_time ) {
3✔
866
    return exec_set_thread_async_cycle_time(thread_id , cycle_time) ;
3✔
867
}
868

869
/**
870
 * @relates Trick::Executive
871
 * @copydoc Trick::Executive::set_thread_async_cycle_time
872
 * C wrapper for Trick::Executive::set_thread_async_cycle_time
873
 */
874
extern "C" int exec_set_thread_async_cycle_time( unsigned int thread_id , double cycle_time ) {
3✔
875
    if ( the_exec != NULL ) {
3✔
876
        return the_exec->set_thread_amf_cycle_time(thread_id , cycle_time) ;
3✔
877
    }
878
    return -1 ;
×
879
}
880

881
/**
882
 * @relates Trick::Executive
883
 * @copydoc Trick::Executive::set_thread_async_wait
884
 * C wrapper for Trick::Executive::set_thread_async_wait
885
 */
886
extern "C" int exec_set_thread_async_wait( unsigned int thread_id , int yes_no ) {
×
887
    if ( the_exec != NULL ) {
×
888
        return the_exec->set_thread_async_wait(thread_id , (bool)yes_no) ;
×
889
    }
890
    return -1 ;
×
891
}
892

893
/**
894
 * @relates Trick::Executive
895
 * @copydoc Trick::Executive::set_thread_rt_semaphores
896
 * C wrapper for Trick::Executive::set_thread_rt_semaphores
897
 */
898
extern "C" int exec_set_thread_rt_semaphores( unsigned int thread_id , int yes_no ) {
×
899
    if ( the_exec != NULL ) {
×
900
        return the_exec->set_thread_rt_semaphores(thread_id , (bool)yes_no) ;
×
901
    }
902
    return -1 ;
×
903
}
904

905
/**
906
 * @relates Trick::Executive
907
 * @copydoc Trick::Executive::set_thread_cpu_affinity
908
 * C wrapper for Trick::Executive::set_thread_cpu_affinity
909
 */
910
extern "C" int exec_set_thread_cpu_affinity(unsigned int thread_id , int cpu_num) {
×
911
    if ( the_exec != NULL ) {
×
912
        return the_exec->set_thread_cpu_affinity(thread_id, cpu_num) ;
×
913
    }
914
    return -1 ;
×
915
}
916

917
/**
918
 * @relates Trick::Executive
919
 * @copydoc Trick::Executive::set_thread_priority
920
 * C wrapper for Trick::Executive::set_thread_priority
921
 */
922
extern "C" int exec_set_thread_priority(unsigned int thread_id , unsigned int req_priority) {
×
923
    if ( the_exec != NULL ) {
×
924
        return the_exec->set_thread_priority(thread_id, req_priority) ;
×
925
    }
926
    return -1 ;
×
927
}
928

929
/**
930
 * @relates Trick::Executive
931
 * @copydoc Trick::Executive::set_thread_process_type
932
 * C wrapper for Trick::Executive::set_thread_process_type
933
 */
934
extern "C" int exec_set_thread_process_type( unsigned int thread_id , int process_type ) {
5✔
935
    if ( the_exec != NULL ) {
5✔
936
        return the_exec->set_thread_process_type(thread_id , process_type) ;
5✔
937
    }
938
    return -1 ;
×
939
}
940

941
/**
942
 * @relates Trick::Executive
943
 * @copydoc Trick::Executive::set_job_cycle
944
 * C wrapper for Trick::Executive::set_job_cycle
945
 */
946
extern "C" int exec_set_job_cycle(const char * job_name, int instance, double in_cycle) {
1✔
947

948
    if ( the_exec != NULL ) {
1✔
949
        std::string job_string ;
1✔
950

951
        // Add handling for NULL string.
952
        if ( job_name == NULL ) {
1✔
953
            job_string.clear() ;
×
954
        } else {
955
            job_string = std::string(job_name) ;
1✔
956
        }
957
        return the_exec->set_job_cycle(job_string, instance, in_cycle) ;
1✔
958
    }
959
    return -1 ;
×
960
}
961

962
/**
963
 * @relates Trick::Executive
964
 * @copydoc Trick::Executive::add_depends_on_job
965
 * C wrapper for Trick::Executive::add_depends_on_job
966
 */
967
extern "C" int exec_add_scheduled_job_class(const char * in_name) {
3,423✔
968
    if ( the_exec != NULL ) {
3,423✔
969
        return the_exec->add_scheduled_job_class(std::string(in_name)) ;
3,423✔
970
    }
971
    return -1 ;
×
972
}
973

974
/**
975
 * @relates Trick::Executive
976
 * @copydoc Trick::Executive::add_depends_on_job
977
 * C wrapper for Trick::Executive::add_depends_on_job
978
 */
979
extern "C" int exec_add_depends_on_job(const char * target_job_string , unsigned int t_instance , const char * depend_job_string , unsigned int d_instance ) {
2✔
980
    if ( the_exec != NULL ) {
2✔
981
        return the_exec->add_depends_on_job(std::string(target_job_string) , t_instance , std::string(depend_job_string) , d_instance ) ;
2✔
982
    }
983
    return -1 ;
×
984
}
985

986
/*********************************************************/
987
/* These are executive access functions that stay C++    */
988

989
/**
990
 * @relates Trick::Executive
991
 * @copydoc Trick::Executive::add_sim_object
992
 * C wrapper for Trick::Executive::add_sim_object
993
 */
994
int exec_add_sim_object( Trick::SimObject * in_object , const char * in_name ) {
4,219✔
995
    if ( the_exec != NULL ) {
4,219✔
996
        return the_exec->add_sim_object(in_object , in_name) ;
4,219✔
997
    }
998
    return -1 ;
×
999
}
1000

1001
/**
1002
 * @relates Trick::Executive
1003
 * @copydoc Trick::Executive::add_sim_object
1004
 * C wrapper for Trick::Executive::add_sim_object
1005
 */
1006
int exec_remove_sim_object( Trick::SimObject * in_object ) {
×
1007
    if ( the_exec != NULL ) {
×
1008
        return the_exec->delete_sim_object(in_object) ;
×
1009
    }
1010
    return -1 ;
×
1011
}
1012

1013
/**
1014
 * @relates Trick::Executive
1015
 * @copydoc Trick::Executive::get_sim_objects
1016
 * Wrapper for Trick::Executive::get_sim_objects
1017
 */
1018
int exec_get_sim_objects(std::vector<Trick::SimObject *>& in_sim_objects ) {
16✔
1019
    if ( the_exec != NULL ) {
16✔
1020
        return the_exec->get_sim_objects(in_sim_objects) ;
16✔
1021
    }
1022
    return -1 ;
×
1023
}
1024

1025

1026
/**
1027
 * @relates Trick::Executive
1028
 * @copydoc Trick::Executive::get_sim_objects
1029
 * Wrapper for Trick::Executive::get_sim_objects
1030
 */
1031
Trick::SimObject * exec_get_sim_object_by_name(std::string sim_object_name) {
×
1032
    if ( the_exec != NULL ) {
×
1033
        return the_exec->get_sim_object_by_name(sim_object_name) ;
×
1034
    }
1035
    return NULL ;
×
1036
}
1037

1038

1039
/**
1040
 * @relates Trick::Executive
1041
 * @copydoc Trick::Executive::get_job
1042
 * Wrapper for Trick::Executive::get_job
1043
 */
1044
Trick::JobData * exec_get_job(const char * job_name , unsigned int j_instance) {
372✔
1045
    if ( the_exec != NULL ) {
372✔
1046
        return the_exec->get_job(std::string(job_name), j_instance) ;
372✔
1047
    }
1048
    return NULL ;
×
1049
}
1050

1051
/**
1052
 * @relates Trick::Executive
1053
 * @copydoc Trick::Executive::get_curr_job
1054
 * Wrapper for Trick::Executive::get_curr_job
1055
 */
1056
Trick::JobData * exec_get_curr_job() {
7,048,945✔
1057
    if ( the_exec != NULL ) {
7,048,945✔
1058
        return the_exec->get_curr_job() ;
7,048,945✔
1059
    }
1060
    return NULL ;
×
1061
}
1062

1063
/**
1064
 * @relates Trick::Executive
1065
 * @copydoc Trick::Executive::get_thread
1066
 * C wrapper for Trick::Executive::get_thread
1067
 */
1068
Trick::Threads * exec_get_thread( unsigned int thread_id ) {
×
1069
    if ( the_exec != NULL ) {
×
1070
        return the_exec->get_thread(thread_id) ;
×
1071
    }
1072
    return NULL ;
×
1073
}
1074

1075
/**
1076
 * @relates Trick::Executive
1077
 * @copydoc Trick::Executive::get_all_jobs_vector
1078
 * Wrapper for Trick::Executive::get_all_jobs_vector
1079
 */
1080
int exec_get_all_jobs_vector(std::vector<Trick::JobData *> & in_jobs_vector) {
191✔
1081
    if ( the_exec != NULL ) {
191✔
1082
        return the_exec->get_all_jobs_vector(in_jobs_vector) ;
191✔
1083
    }
1084
    return 0 ;
×
1085
}
1086

1087
/**
1088
 * @relates Trick::Executive
1089
 * @copydoc Trick::Executive::register_scheduler
1090
 * Wrapper for Trick::Executive::register_scheduler
1091
 */
1092
int exec_register_scheduler( Trick::Scheduler * scheduler ) {
582✔
1093
    if ( the_exec != NULL ) {
582✔
1094
        return the_exec->register_scheduler(scheduler) ;
582✔
1095
    }
1096
    return -1 ;
×
1097
}
1098

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

© 2025 Coveralls, Inc