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

nasa / trick / 25456501308

06 May 2026 07:29PM UTC coverage: 55.935% (-0.8%) from 56.7%
25456501308

Pull #2011

github

web-flow
Merge 7ad262960 into 7054e405e
Pull Request #2011: Single-file CI and code style adoption

14612 of 26123 relevant lines covered (55.94%)

462107.16 hits per line

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

0.0
/trick_source/sim_services/Sie/EnumAttributesMap.cpp
1
#include <iostream>
2
#include <fstream>
3
#include <algorithm>
4
#include "trick/EnumAttributesMap.hh"
5
#include "trick/attributes.h"
6
#include "trick/command_line_protos.h"
7

8
// Instantiate static variables for template types for ATTRIBUTES * and ENUM_ATTR *
9
namespace Trick {
10
EnumAttributesMap * EnumAttributesMap::pInstance = NULL ;
11
}
12

13
void Trick::EnumAttributesMap::print_xml(std::ofstream & sie_out ) {
×
14
    std::map<std::string, ENUM_ATTR *>::iterator it ;
×
15
    ENUM_ATTR * enum_attr ;
16

17
    for ( it = name_to_attr_map.begin() ; it != name_to_attr_map.end() ; ++it ) {
×
18
        enum_attr = (*it).second ;
×
19

20
        if ( enum_attr != NULL ) {
×
21
            std::string name = it->first;
×
22
            std::replace(name.begin(), name.end(), ':', '_');
×
23
            sie_out << "  <enumeration name=\"" << name << "\">\n" ;
×
24
            while ( enum_attr->label[0] != '\0' ) {
×
25
                sie_out << "      <pair label=\"" << enum_attr->label << "\"" ;
×
26
                sie_out << " value=\"" << enum_attr->value << "\"/>\n" ;
×
27
                enum_attr++ ;
×
28
            }
29
            sie_out << "  </enumeration>\n\n" ;
×
30
        }
×
31
    }
32
}
×
33

34
void Trick::EnumAttributesMap::print_json(std::ofstream & sie_out ) {
×
35
    std::map<std::string, ENUM_ATTR *>::iterator it ;
×
36
    ENUM_ATTR * enum_attr ;
37
    sie_out << "  \"enumerations\": [\n" ; 
×
38
    for ( it = name_to_attr_map.begin() ; it != name_to_attr_map.end() ; ++it ) {
×
39
        enum_attr = (*it).second ;
×
40

41
        if ( enum_attr != NULL ) {
×
42
            sie_out << "    {\n";
×
43
            std::string name = it->first;
×
44
            std::replace(name.begin(), name.end(), ':', '_');
×
45
            sie_out << "      \"name\": \"" <<  name << "\",\n" ;
×
46
            sie_out << "      \"pairs\": [\n";
×
47
            while ( enum_attr->label[0] != '\0' ) {
×
48
                sie_out << "        {\n" ;
×
49
                sie_out << "          \"label\": \"" << enum_attr->label << "\",\n" ;
×
50
                sie_out << "          \"value\": \"" << enum_attr->value << "\"\n" ;
×
51
                sie_out << "        }" ;
×
52
                if((enum_attr + 1)->label[0] != '\0') {
×
53
                    sie_out << ',';
×
54
                }
55
                sie_out << "\n";
×
56
                enum_attr++ ;
×
57
            }
58
            sie_out << "      ]\n" ;
×
59
            sie_out << "    }" ;
×
60
            if(std::next(it, 1) != name_to_attr_map.end()) {
×
61
                sie_out << ',' ;
×
62
            }
63
            sie_out << '\n';
×
64
        }
×
65
    }
66
    sie_out << "  ],\n";
×
67
}
×
68

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