Bitstream Interpretation Library (BIL)  0.1
PIPDirection.cpp
Go to the documentation of this file.
1 
6 #include <cstring>
9 
10 using namespace bil;
11 
12 const char* const PIPDirection::MONODI_BUF_STRING = "->";
13 const char* const PIPDirection::BIDI_UNBUF_STRING = "==";
14 const char* const PIPDirection::BIDI_ONEBUF_STRING = "=>";
15 const char* const PIPDirection::BIDI_TWOBUF_STRING = "=-";
16 
17 
19 {
20  switch (dir)
21  {
22  case MONODI_BUF: return MONODI_BUF_STRING;
23  case BIDI_UNBUF: return BIDI_UNBUF_STRING;
24  case BIDI_ONEBUF: return BIDI_ONEBUF_STRING;
25  case BIDI_TWOBUF: return BIDI_TWOBUF_STRING;
26  default: return 0;
27  }
28 }
29 
30 
32 {
33  if (0 == strcmp(s, MONODI_BUF_STRING)) return MONODI_BUF;
34  if (0 == strcmp(s, BIDI_UNBUF_STRING)) return BIDI_UNBUF;
35  if (0 == strcmp(s, BIDI_ONEBUF_STRING)) return BIDI_ONEBUF;
36  if (0 == strcmp(s, BIDI_TWOBUF_STRING)) return BIDI_TWOBUF;
37  throw Exception();
38 }