Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
radar.cpp
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2 
3 #include <cassert>
4 #include <stdexcept>
5 #include "sensor.h"
6 #include "radar.h"
7 #include "null_display.h"
8 #include "sphere_display.h"
9 #include "bubble_display.h"
10 #include "plane_display.h"
11 
12 namespace Radar
13 {
14 
15 std::auto_ptr<Display> Factory(Type::Value type)
16 {
17  switch (type)
18  {
19  case Type::NullDisplay:
20  return std::auto_ptr<Display>(new NullDisplay);
21 
23  return std::auto_ptr<Display>(new SphereDisplay);
24 
26  return std::auto_ptr<Display>(new BubbleDisplay);
27 
28  case Type::PlaneDisplay:
29  return std::auto_ptr<Display>(new PlaneDisplay);
30 
31  default:
32  assert(false);
33  throw std::invalid_argument("Unknown radar type");
34  }
35 }
36 
37 } // namespace Radar