// File: xjrueda[P]fixprime/src/Protocol.cpp
// Function: fprime::Protocol::loadFields()
void Protocol::loadFields() {
        try {
            if (protocolSpec["Fields"].empty()) {
                std::runtime_error("No fields specified for current  protocol ");

            } else {

                // Gets the fields members of the protocol
                std::vector<string> fieldCodes = protocolSpec["Fields"].getMemberNames();

                // process the fields
                for (std::vector<string>::iterator itr = fieldCodes.begin(); itr != fieldCodes.end(); itr++) {
                    try {
                        fprime::Field::FieldPtr field(new fprime::Field(boost::lexical_cast<unsigned int>(*itr)));
                        // completes the field properties
                        field->setName(protocolSpec["Fields"][*itr]["name"].asString());
                        field->setDataType(protocolSpec["Fields"][*itr]["dataType"].asString());

                        //Load valid values
                        try {
                            if (protocolSpec["Fields"][*itr]["validValues"].empty()) {
                                std::vector<string> validValues = protocolSpec["Fields"][*itr]["validValues"].getMemberNames();
                                for (std::vector<string>::iterator itValues = validValues.begin(); itValues != validValues.end(); itValues++) {
                                    field->addValidValue(string(*itValues), protocolSpec["Fields"][*itr]["validValues"][*itValues].asString());
                                }
                            }
                            addField(field);
                        } catch (exception& e) {
                            throw std::runtime_error("error loading valid values: " + string(e.what()));
                        }
                    } catch (exception e) {
                        throw std::runtime_error("Exception loading field " + *itr + ": " + e.what());
                    }
                }

            }
        } catch (exception& e) {
            throw std::runtime_error("at Protocol.loadField:" + string(e.what()));
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x248(%rbp)
addq $0x28, %rdi
leaq 0x31a84(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x240(%rbp)
jmp 0xd1bb3
movq -0x240(%rbp), %rdi
callq 0xa3a40
movb %al, -0x249(%rbp)
jmp 0xd1bc7
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0xd1bd3
jmp 0xd1c04
leaq 0x31a56(%rip), %rsi     # 0x103630
leaq -0x28(%rbp), %rdi
callq 0x99380
jmp 0xd1be5
leaq -0x28(%rbp), %rdi
callq 0xa4f20
jmp 0xd2546
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2471
movq -0x248(%rbp), %rdi
addq $0x28, %rdi
leaq 0x31a13(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x258(%rbp)
jmp 0xd1c24
movq -0x258(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x9c0a0
jmp 0xd1c36
leaq -0x40(%rbp), %rdi
callq 0xa2870
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xa2b40
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa0020
testb $0x1, %al
jne 0xd1c66
jmp 0xd245a
movl $0xb0, %edi
callq 0x9dc00
movq %rax, -0x260(%rbp)
jmp 0xd1c79
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq %rax, %rdi
callq 0x99560
movl %eax, -0x264(%rbp)
jmp 0xd1c92
movl -0x264(%rbp), %esi
movq -0x260(%rbp), %rdi
callq 0x9f1e0
jmp 0xd1ca6
movq -0x260(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa1bb0
jmp 0xd1cb8
leaq -0x60(%rbp), %rdi
callq 0x9d390
movq -0x248(%rbp), %rdi
movq %rax, -0x278(%rbp)
addq $0x28, %rdi
leaq 0x3194f(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x270(%rbp)
jmp 0xd1ce8
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq -0x270(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x280(%rbp)
jmp 0xd1d09
movq -0x280(%rbp), %rdi
leaq 0x32bb7(%rip), %rsi     # 0x1048ce
callq 0x99470
movq %rax, -0x288(%rbp)
jmp 0xd1d25
movq -0x288(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xa3d30
jmp 0xd1d37
movq -0x278(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xa1100
jmp 0xd1d49
leaq -0x80(%rbp), %rdi
callq 0xa4f00
leaq -0x60(%rbp), %rdi
callq 0x9d390
movq -0x248(%rbp), %rdi
movq %rax, -0x298(%rbp)
addq $0x28, %rdi
leaq 0x318b5(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x290(%rbp)
jmp 0xd1d82
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq -0x290(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x2a0(%rbp)
jmp 0xd1da3
movq -0x2a0(%rbp), %rdi
leaq 0x318aa(%rip), %rsi     # 0x10365b
callq 0x99470
movq %rax, -0x2a8(%rbp)
jmp 0xd1dbf
movq -0x2a8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xa3d30
jmp 0xd1dd4
movq -0x298(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x9d140
jmp 0xd1de9
leaq -0xa0(%rbp), %rdi
callq 0xa4f00
movq -0x248(%rbp), %rdi
addq $0x28, %rdi
leaq 0x31822(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x2b0(%rbp)
jmp 0xd1e15
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq -0x2b0(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x2b8(%rbp)
jmp 0xd1e36
movq -0x2b8(%rbp), %rdi
leaq 0x31820(%rip), %rsi     # 0x103664
callq 0x99470
movq %rax, -0x2c0(%rbp)
jmp 0xd1e52
movq -0x2c0(%rbp), %rdi
callq 0xa3a40
movb %al, -0x2c1(%rbp)
jmp 0xd1e66
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0xd1e75
jmp 0xd211f
movq -0x248(%rbp), %rdi
addq $0x28, %rdi
leaq 0x317a2(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x2d0(%rbp)
jmp 0xd1e95
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq -0x2d0(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x2d8(%rbp)
jmp 0xd1eb6
movq -0x2d8(%rbp), %rdi
leaq 0x317a0(%rip), %rsi     # 0x103664
callq 0x99470
movq %rax, -0x2e0(%rbp)
jmp 0xd1ed2
movq -0x2e0(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x9c0a0
jmp 0xd1ee7
leaq -0xb8(%rbp), %rdi
callq 0xa2870
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xa2b40
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xa0020
testb $0x1, %al
jne 0xd1f29
jmp 0xd2103
leaq -0x60(%rbp), %rdi
callq 0x9d390
movq %rax, -0x2e8(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xa4310
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x998d0
jmp 0xd1f56
movq -0x248(%rbp), %rdi
addq $0x28, %rdi
leaq 0x316c1(%rip), %rsi     # 0x103629
callq 0x99470
movq %rax, -0x2f0(%rbp)
jmp 0xd1f76
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq -0x2f0(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x2f8(%rbp)
jmp 0xd1f97
movq -0x2f8(%rbp), %rdi
leaq 0x316bf(%rip), %rsi     # 0x103664
callq 0x99470
movq %rax, -0x300(%rbp)
jmp 0xd1fb3
leaq -0xc0(%rbp), %rdi
callq 0xa4310
movq -0x300(%rbp), %rdi
movq %rax, %rsi
callq 0xa4480
movq %rax, -0x308(%rbp)
jmp 0xd1fd7
movq -0x308(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0xa3d30
jmp 0xd1fec
movq -0x2e8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x108(%rbp), %rdx
callq 0xa1990
jmp 0xd2008
leaq -0x108(%rbp), %rdi
callq 0xa4f00
leaq -0xe8(%rbp), %rdi
callq 0xa4f00
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
callq 0x99220
movq %rax, -0x110(%rbp)
jmp 0xd1efa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd22cc
movq -0x260(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x9d660
jmp 0xd22cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd22c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xa4f00
jmp 0xd22c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xa4f00
jmp 0xd22c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2174
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2111
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd20f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xa4f00
leaq -0xe8(%rbp), %rdi
callq 0xa4f00
jmp 0xd2111
leaq -0xb8(%rbp), %rdi
callq 0x9ba40
jmp 0xd211f
leaq -0xb8(%rbp), %rdi
callq 0x9ba40
jmp 0xd2174
leaq -0x120(%rbp), %rdi
movq %rdi, -0x310(%rbp)
leaq -0x60(%rbp), %rsi
callq 0xa06b0
movq -0x248(%rbp), %rdi
movq -0x310(%rbp), %rsi
callq 0x9f970
jmp 0xd214b
leaq -0x120(%rbp), %rdi
callq 0xa2ae0
jmp 0xd22b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xa2ae0
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd22c3
movq -0x10(%rbp), %rdi
callq 0x99540
movq %rax, -0x128(%rbp)
movb $0x1, -0x16a(%rbp)
movl $0x10, %edi
callq 0x99e80
movq %rax, -0x328(%rbp)
movq -0x128(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x320(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0xa35e0
movq -0x320(%rbp), %rsi
movq -0x318(%rbp), %rdx
leaq -0x168(%rbp), %rdi
callq 0xa0510
jmp 0xd21f2
leaq 0x31477(%rip), %rsi     # 0x103670
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0xa2cb0
jmp 0xd220e
movq -0x328(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0xa2430
jmp 0xd2223
movq -0x328(%rbp), %rdi
movb $0x0, -0x16a(%rbp)
movq 0x60da0(%rip), %rsi     # 0x132fd8
movq 0x60b61(%rip), %rdx     # 0x132da0
callq 0xa2fe0
jmp 0xd25ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd227d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x148(%rbp), %rdi
callq 0xa4f00
leaq -0x168(%rbp), %rdi
callq 0xa4f00
leaq -0x169(%rbp), %rdi
callq 0x9e350
testb $0x1, -0x16a(%rbp)
jne 0xd22a0
jmp 0xd22ac
movq -0x328(%rbp), %rdi
callq 0x9b9c0
callq 0xa2520
jmp 0xd22b3
jmp 0xd22c3
leaq -0x60(%rbp), %rdi
callq 0xa2ae0
jmp 0xd2441
leaq -0x60(%rbp), %rdi
callq 0xa2ae0
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd2468
movq -0x10(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x9f770
movq %rax, %rsi
leaq -0x178(%rbp), %rdi
callq 0xa3740
movq -0x338(%rbp), %rdi
callq 0x99540
movb $0x1, -0x1d9(%rbp)
movl $0x10, %edi
callq 0x99e80
movq %rax, -0x330(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xa4310
movq %rax, %rdx
leaq 0x3135b(%rip), %rsi     # 0x10368d
leaq -0x1d8(%rbp), %rdi
callq 0x9cf50
jmp 0xd2340
leaq 0x31252(%rip), %rdx     # 0x103599
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x98100
jmp 0xd235c
leaq -0x178(%rbp), %rdi
callq 0xa4b80
movq %rax, %rdx
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x98100
jmp 0xd2380
movq -0x330(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0xa2430
jmp 0xd2395
movq -0x330(%rbp), %rdi
movb $0x0, -0x1d9(%rbp)
movq 0x60c2e(%rip), %rsi     # 0x132fd8
movq 0x609ef(%rip), %rdx     # 0x132da0
callq 0xa2fe0
jmp 0xd25ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2415
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2409
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd23fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xa4f00
leaq -0x1b8(%rbp), %rdi
callq 0xa4f00
leaq -0x1d8(%rbp), %rdi
callq 0xa4f00
testb $0x1, -0x1d9(%rbp)
jne 0xd2420
jmp 0xd242c
movq -0x330(%rbp), %rdi
callq 0x9b9c0
leaq -0x178(%rbp), %rdi
callq 0xa4bd0
callq 0xa2520
jmp 0xd243f
jmp 0xd2468
jmp 0xd2443
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x99220
movq %rax, -0x1e8(%rbp)
jmp 0xd1c43
leaq -0x40(%rbp), %rdi
callq 0x9ba40
jmp 0xd2546
leaq -0x40(%rbp), %rdi
callq 0x9ba40
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd25bd
movq -0x10(%rbp), %rdi
callq 0x99540
movq %rax, -0x1f0(%rbp)
movb $0x1, -0x232(%rbp)
movl $0x10, %edi
callq 0x99e80
movq %rax, -0x350(%rbp)
movq -0x1f0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x348(%rbp)
leaq -0x231(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0xa35e0
movq -0x348(%rbp), %rsi
movq -0x340(%rbp), %rdx
leaq -0x230(%rbp), %rdi
callq 0xa0510
jmp 0xd24ef
leaq 0x311b0(%rip), %rsi     # 0x1036a6
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rdx
callq 0xa2cb0
jmp 0xd250b
movq -0x350(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0xa2430
jmp 0xd2520
movq -0x350(%rbp), %rdi
movb $0x0, -0x232(%rbp)
movq 0x60aa3(%rip), %rsi     # 0x132fd8
movq 0x60864(%rip), %rdx     # 0x132da0
callq 0xa2fe0
jmp 0xd25ce
jmp 0xd25b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd2588
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xd257c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x210(%rbp), %rdi
callq 0xa4f00
leaq -0x230(%rbp), %rdi
callq 0xa4f00
leaq -0x231(%rbp), %rdi
callq 0x9e350
testb $0x1, -0x232(%rbp)
jne 0xd259f
jmp 0xd25ab
movq -0x350(%rbp), %rdi
callq 0x9b9c0
callq 0xa2520
jmp 0xd25b2
jmp 0xd25bd
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0xa3520
movq %rax, %rdi
callq 0xa6900
nop