LSSTApplications  19.0.0+10,19.0.0+80,19.0.0-1-g20d9b18+31,19.0.0-1-g49a97f9+4,19.0.0-1-g8c57eb9+31,19.0.0-1-g9a028c0+13,19.0.0-1-ga72da6b+3,19.0.0-1-gb77924a+15,19.0.0-1-gbfe0924+66,19.0.0-1-gc3516c3,19.0.0-1-gefe1d0d+49,19.0.0-1-gf8cb8b4+3,19.0.0-14-g7511ce4+6,19.0.0-16-g3dc1a33c+6,19.0.0-17-g59f0e8a+4,19.0.0-17-g9c22e3c+9,19.0.0-18-g35bb99870+2,19.0.0-19-g2772d4a+9,19.0.0-2-g260436e+53,19.0.0-2-g31cdcee,19.0.0-2-g9675b69+3,19.0.0-2-gaa2795f,19.0.0-2-gbcc4de1,19.0.0-2-gd6f004e+6,19.0.0-2-gde8e5e3+5,19.0.0-2-gff6972b+15,19.0.0-21-ge306cd8,19.0.0-21-gf122e69+2,19.0.0-3-g2d43a51+2,19.0.0-3-gf3b1435+6,19.0.0-4-g56feb96,19.0.0-4-gac56cce+17,19.0.0-49-gce872c1+1,19.0.0-5-g66946eb+6,19.0.0-5-gd8897ba+6,19.0.0-51-gfc4a647e,19.0.0-7-g686a884+5,19.0.0-7-g886f805+5,19.0.0-8-g305ff64,w.2020.17
LSSTDataManagementBasePackage
SupportedFormats.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008, 2009, 2010 LSST Corporation.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
31 #include "lsst/pex/exceptions.h"
32 
33 namespace lsst {
34 namespace pex {
35 namespace policy {
36 
39 
42 }
43 
48  if (factory.get() == 0)
50  std::string("attempt to register null ") + "PolicyParserFactory pointer");
51 
52  _formats[factory->getFormatName()] = factory;
53 }
54 
62  Lookup::const_iterator f;
63  for (f = _formats.begin(); f != _formats.end(); ++f) {
64  if (f->second->isRecognized(leaders)) return f->second->getFormatName();
65  }
66 
68 }
69 
75  SupportedFormats* me = const_cast<SupportedFormats*>(this);
76 
77  Lookup::iterator found = me->_formats.find(name);
78  return ((found != me->_formats.end()) ? found->second : PolicyParserFactory::Ptr());
79 }
80 
81 } // namespace policy
82 } // namespace pex
83 } // namespace lsst
void registerFormat(const PolicyParserFactory::Ptr &factory)
register a factory method for policy format parsers
a class for creating PAFParser objects
static const std::string UNRECOGNIZED
an empty string representing an unrecognized format
T end(T... args)
STL class.
definition of the PAFParserFactory class
const std::string & recognizeType(const std::string &leaders) const
analyze the given string assuming contains the leading characters from the data stream and return tru...
A base class for image defects.
an abstract factory class for creating PolicyParser instances.
definition of the SupportedFormats class
T get(T... args)
T find(T... args)
static void initDefaultFormats(SupportedFormats &sf)
initialize a given SupportFormats instance with the formats known by default.
Definition: __init__.py:1
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
T begin(T... args)
a list of supported Policy formats.
PolicyParserFactory::Ptr getFactory(const std::string &name) const
get a pointer to a factory with a given name.
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104