#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 |
|
|
|
|
|
00043 {}
|
|
|
00044 {}
|
|
|
00060 {
00061 for (Entries::iterator i=entries.begin();i!=entries.end();++i)
00062 if (i->protocolNumber==protocol)
00063 return i->outGateIndex;
00064 opp_error("No output gate defined in protocolMapping for protocol number %d", protocol);
00065 return -1;
00066 }
|
|
|
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 }
|
|
|
|
1.4.1