LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Params.cc
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
27 
28 namespace lsst {
29 namespace meas {
30 namespace algorithms {
31 namespace shapelet {
32 
33  void PrintFlags(const std::vector<long>& flags, std::ostream& os)
34  {
35  const int nObj = flags.size();
36 
37  std::vector<long> nFlagCount(NFLAGS,0);
38  long nNoFlag = 0;
39 
40  for(int i=0;i<nObj;++i) {
41  long flag = flags[i];
42  if (!flag) ++nNoFlag;
43  for(long flagNum = 0; flagNum < NFLAGS; ++flagNum) {
44  if (flag & (1 << flagNum)) ++nFlagCount[flagNum];
45  }
46  }
47  os<<" Total N = "<<nObj<<std::endl;
48  os<<" # with no flags = "<<nNoFlag<<std::endl;
49  for(long flagNum = 0; flagNum < NFLAGS; ++flagNum) {
50  if (nFlagCount[flagNum]) {
51  os<<" # with "<<flagName[flagNum]<<" = "<<
52  nFlagCount[flagNum]<<std::endl;
53  }
54  }
55  }
56 
57  // Errors specific to the weak lensing code
58  const char* Text(const ExitCode& code)
59  {
60  switch (code) {
61  case SUCCESS :
62  return "SUCCESS";
63  case FAILURE :
64  return "FAILURE";
66  return "FAILURE_FILE_NOT_FOUND";
68  return "FAILURE_PARAMETER_ERROR";
69  case FAILURE_READ_ERROR :
70  return "FAILURE_READ_ERROR";
71  case FAILURE_WRITE_ERROR :
72  return "FAILURE_WRITE_ERROR";
74  return "FAILURE_PROCESSING_ERROR";
75  default :
76  return "UNKNOWN";
77  }
78  }
79 
80  int Status(ExitCode code, const ConfigFile& params)
81  {
82  switch (code) {
83  case SUCCESS :
84  return params.read("success_status",2);
85  case FAILURE :
86  return params.read("failure_status",4);
88  return params.read("file_not_found_status",5);
90  return params.read("parameter_error_status",5);
91  case FAILURE_READ_ERROR :
92  return params.read("read_error_status",5);
93  case FAILURE_WRITE_ERROR :
94  return params.read("write_error_status",4);
96  return params.read("processing_error_status",4);
97  default :
98  return 0;
99  }
100  }
101 }}}}
const char * Text(const ExitCode &code)
Definition: Params.cc:58
int Status(ExitCode code, const ConfigFile &params)
Definition: Params.cc:80
void PrintFlags(const std::vector< long > &flags, std::ostream &os)
Definition: Params.cc:33