Bitstream Interpretation Library (BIL)  0.1
NetType.cpp
Go to the documentation of this file.
1 
6 #include <cstring>
8 #include <xdl/model/NetType.hpp>
9 
10 using namespace bil;
11 
12 const char* const NetType::WIRE_STRING = "wire";
13 const char* const NetType::VCC_STRING = "vcc";
14 const char* const NetType::VDD_STRING = "vdd";
15 const char* const NetType::POWER_STRING = "power";
16 const char* const NetType::GND_STRING = "gnd";
17 const char* const NetType::GROUND_STRING = "ground";
18 
19 
20 const char* NetType::toString(net_t type)
21 {
22  switch (type)
23  {
24  case WIRE: return WIRE_STRING;
25  case VCC: return VCC_STRING;
26  case GND: return GND_STRING;
27  default: return 0;
28  }
29 }
30 
31 
33 {
34  if (0 == strcmp(s, WIRE_STRING)) return WIRE;
35  if (0 == strcmp(s, VCC_STRING)) return VCC;
36  if (0 == strcmp(s, VDD_STRING)) return VCC;
37  if (0 == strcmp(s, POWER_STRING)) return VCC;
38  if (0 == strcmp(s, GND_STRING)) return GND;
39  if (0 == strcmp(s, GROUND_STRING)) return GND;
40  throw Exception();
41 }