Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/inst_pos_8cc_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 01:15:21 2016
Кодировка:
lsst.tcc: src/instPos.cc Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
instPos.cc
Go to the documentation of this file.
1 #include <sstream>
2 #include <stdexcept>
3 #include "tcc/instPos.h"
4 
5 namespace tcc {
6  InstPosition::InstPosition(std::string const &name) {
7  setName(name);
8  }
9 
10  void InstPosition::setName(std::string const &name) {
11  std::map<std::string, double>::const_iterator orientIter = _nameAngMap.find(name);
12  if (orientIter == _nameAngMap.end()) {
13  std::ostringstream os;
14  os << "No instrument position with name: " << name;
15  throw std::runtime_error(os.str());
16  }
17  _name = name;
18  _rotAzMechConst = orientIter->second;
19  }
20 
21 }
22 
23 // once using C++11 one can make _nameAngMap a static const and initialize it as follows
24 // std::map<std::string, double> tcc::InstPosition::_nameAngMap = {
25 // {"PF1", -90.0},
26 // ....
27 // };
28 namespace {
29  std::map<std::string, double> createNameConstMap() {
30  std::map<std::string, double> nameAngMap;
31  nameAngMap["PF1"] = -90.0;
32  nameAngMap["CA1"] = -90.0;
33  nameAngMap["BC1"] = +90.0;
34  nameAngMap["BC2"] = -90.0;
35  nameAngMap["NA1"] = -90.0;
36  nameAngMap["NA2"] = -90.0;
37  nameAngMap["TR1"] = +45.0;
38  nameAngMap["TR2"] = +135.0;
39  nameAngMap["TR3"] = -135.0;
40  nameAngMap["TR4"] = -45.0;
41  nameAngMap["SK1"] = 0.0;
42  nameAngMap["SK2"] = 180.0;
43  nameAngMap["SK3"] = 0.0;
44  nameAngMap["SK4"] = 180.0;
45  nameAngMap["MB1"] = 0.0;
46  nameAngMap["MB2"] = 180.0;
47  nameAngMap["MB3"] = 0.0;
48  nameAngMap["MB4"] = 180.0;
49  nameAngMap["?"] = 0.0;
50  return nameAngMap;
51  }
52 }
53 
54 std::map<std::string, double> const tcc::InstPosition::_nameAngMap = createNameConstMap();
InstPosition(std::string const &name="?")
Definition: instPos.cc:6
void setName(std::string const &name)
Definition: instPos.cc:10