Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
ProfileManager.cpp
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "cheetah/generators/pulse_profile/ProfileManager.h"
25 #include "cheetah/generators/pulse_profile/src/ProfileManagerInitialiser.h"
26 #include "cheetah/generators/pulse_profile/PulsarProfileConfig.h"
27 #include <panda/Error.h>
28 
29 
30 namespace ska {
31 namespace cheetah {
32 namespace generators {
33 
34 
35 ProfileManager::ProfileManager()
36 {
37  // pulls in boilerplate generated by the ADD_PROFILE cmake macros
38  pulse_profile::ProfileManagerInitialiser(*this);
39 }
40 
41 ProfileManager::~ProfileManager()
42 {
43 }
44 
46 {
47  _profiles.insert(std::make_pair(id, profile));
48 }
49 
51 {
52  {
53  // find in exisiting profile data set in memory
54  auto it=_profiles.find(id);
55  if(it != _profiles.end()) {
56  return it->second;
57  }
58  }
59  // find in registered profile catalogues
60  auto it=std::find(_pulsar_id.cbegin(), _pulsar_id.cend(), id);
61  if (it==_pulsar_id.cend())
62  throw panda::Error("unknown pulse profile requested");
63 
64  // TODO fetch details of pulsar from the server
65  throw panda::Error("Not yet implemented");
66 
67 }
68 
70  return profile(config.profile_id());
71 }
72 
73 /*
74 std::list<PulsarProfileId> const& ProfileManager::profile_list() const
75 {
76  if(!_pulsar_id.size()) {
77  // TODO refresh known profile list
78  }
79  return _pulsar_id;
80 }
81 */
82 
83 } // namespace generators
84 } // namespace cheetah
85 } // namespace ska
PulsarProfileId const & profile_id() const
returns the db URI of an actual pulsar profile
PulsarProfile profile(PulsarProfileId const &) const
return a profile of a known pulsar
A simple intensity profile representing a pulse shape.
Definition: PulsarProfile.h:43
void add(PulsarProfileId id, PulsarProfile profile)
return the list of known pulsar profiles std::list<PulsarProfileId> const& profile_list() const; ...
Some limits and constants for FLDO.
Definition: Brdz.h:35
placeholder for specifying pulsar profile database URI
define pulsar profiles in a config