#include <ProtocolMap.h>
Public Member Functions | |
ProtocolMapping () | |
~ProtocolMapping () | |
void | parseProtocolMapping (const char *s) |
int | outputGateForProtocol (int protocol) |
Private Types | |
typedef std::vector< Entry > | Entries |
Private Attributes | |
Entries | entries |
Classes | |
struct | Entry |
typedef std::vector<Entry> ProtocolMapping::Entries [private] |
int ProtocolMapping::outputGateForProtocol | ( | int | protocol | ) |
void ProtocolMapping::parseProtocolMapping | ( | const char * | s | ) |
00025 { 00026 while (isspace(*s)) s++; 00027 00028 while (*s) 00029 { 00030 Entry entry; 00031 00032 if (!isdigit(*s)) 00033 throw new cException("syntax error: protocol number expected"); 00034 entry.protocolNumber = atoi(s); 00035 while (isdigit(*s)) s++; 00036 00037 if (*s++!=':') 00038 throw new cException("syntax error: colon expected"); 00039 00040 while (isspace(*s)) s++; 00041 if (!isdigit(*s)) 00042 throw new cException("syntax error in script: output gate index expected"); 00043 entry.outGateIndex = atoi(s); 00044 while (isdigit(*s)) s++; 00045 00046 // add 00047 entries.push_back(entry); 00048 00049 // skip delimiter 00050 while (isspace(*s)) s++; 00051 if (!*s) break; 00052 if (*s++!=',') 00053 throw new cException("syntax error: comma expected"); 00054 while (isspace(*s)) s++; 00055 } 00056 00057 }
Entries ProtocolMapping::entries [private] |