1 #include <boost/lambda/lambda.hpp>
3 #include <fdet/FModelsXMLManager.h>
4 #include <fwk/CentralConfig.h>
5 #include <det/VManager.h>
6 #include <utl/ErrorLogger.h>
7 #include <utl/Reader.h>
8 #include <fdet/FManagerRegister.h>
14 using namespace boost::lambda;
32 FModelsXMLManager::GetModelData(T& returnData,
33 const string& componentProperty,
34 const string& componentName,
40 FindBranch(componentProperty, componentName, componentIndex);
43 return VManager::eNotFound;
49 return VManager::eFound;
55 const string& componentProperty,
56 const string& componentName,
62 FindBranch(componentProperty, componentName, componentIndex);
65 return VManager::eNotFound;
72 return VManager::eNotFound;
73 vector<double> abscissaVector;
74 abscissaBranch.
GetData(abscissaVector);
78 return VManager::eNotFound;
79 vector<double> ordinateVector;
80 ordinateBranch.
GetData(ordinateVector);
87 for_each(ordinateVector.begin(), ordinateVector.end(), _1 *= scaleY);
90 for (
unsigned int i = 0; i < abscissaVector.size(); ++i)
91 tabulatedReturnData.
PushBack(abscissaVector[i], ordinateVector[i]);
93 return VManager::eFound;
103 FModelsXMLManager::FindBranch(
const string& componentProperty,
104 const string& modelType,
123 const IndexMap::const_iterator iterTel = componentIndex.find(
"telescopeId");
124 const IndexMap::const_iterator iterEye = componentIndex.find(
"eyeId");
127 if (iterTel == componentIndex.end() ||
128 iterEye == componentIndex.end()) {
130 if (IsReportingErrors()) {
131 INFO(
string(
"Request with two indices, "
132 "none of them specifies 'telescopeId' and 'eyeId'; ") +
133 QueryInfoMessage(componentProperty, modelType, componentIndex));
139 telescopeId = iterEye->second +
" " + iterTel->second;
144 const IndexMap::const_iterator iterMirrorSeg = componentIndex.find(
"mirrorSegmentId");
145 if (iterMirrorSeg != componentIndex.end())
146 componentAtts[
"mirrorSegmentId"] = iterMirrorSeg->second;
148 const IndexMap::const_iterator iterCorrectorId = componentIndex.find(
"correctorId");
149 if (iterCorrectorId != componentIndex.end())
150 componentAtts[
"size"] = iterCorrectorId->second;
153 const map<string, IndexMap>::const_iterator iModelMap = fTelescopeModelMap.find(telescopeId);
154 if (iModelMap != fTelescopeModelMap.end())
155 modelMap = iModelMap->second;
158 const IndexMap::const_iterator iModelId = modelMap.find(modelType);
159 if (iModelId != modelMap.end())
160 modelId = iModelId->second;
164 atts[
"id"] = modelId;
187 dataB = modelB.
GetChild(componentProperty, componentAtts);
194 FModelsXMLManager::FillMaps()
212 modelMap[modelB.GetName()] = atts.find(
"id")->second;
222 const string eyeIdString = atts.find(
"id")->second;
230 const string telescopeIdString =
231 eyeIdString +
" " + atts2.find(
"id")->second;
234 fTelescopeModelMap[telescopeIdString] = modelMap;
Class to hold collection (x,y) points and provide interpolation between them.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
void PushBack(const double x, const double y)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
AttributeMap GetAttributes() const
Get a map<string, string> containing all the attributes of this Branch.
Branch GetNextSibling() const
Get next sibling of this branch.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
#define REGISTER_F_MANAGER(_name_, _Type_)
std::map< std::string, std::string > IndexMap
Branch GetFirstChild() const
Get first child of this Branch.
Status
Specifies success or (eventually) various possible failure modes.
Manager for FD description in XML "model" files.