36 #include "boost/format.hpp" 52 namespace formatters {
70 for (
auto const & fullName : paramNames) {
72 auto name = (lastPeriod == std::string::npos) ? fullName : fullName.substr(lastPeriod + 1);
77 if (
name.size() > 8) {
78 out +=
"HIERARCH = " +
name;
80 out = (boost::format(
"%-8s= ") %
name).str();
83 if (type ==
typeid(
bool)) {
84 out += prop.get<
bool>(
name) ?
"1" :
"0";
85 }
else if (type ==
typeid(
int)) {
86 out += (boost::format(
"%20d") % prop.get<
int>(
name)).str();
87 }
else if (type ==
typeid(
double)) {
88 out += (boost::format(
"%20.15g") % prop.get<
double>(
name)).str();
89 }
else if (type ==
typeid(
float)) {
90 out += (boost::format(
"%20.15g") % prop.get<
float>(
name)).str();
95 int const len = out.
size();
111 if (properties->isArray(
"sliceId")) {
114 int sliceId = properties->getAsInt(
"sliceId");
118 if (properties->exists(
"universeSize") && !properties->isArray(
"universeSize")) {
119 int universeSize = properties->getAsInt(
"universeSize");
120 if (sliceId >= universeSize) {
128 if (properties->isArray(
"visitId")) {
131 int visitId = properties->getAsInt(
"visitId");
139 if (properties->isArray(
"fpaExposureId")) {
142 int64_t fpaExposureId = properties->getAsInt64(
"fpaExposureId");
143 if (fpaExposureId < 0) {
146 if ((fpaExposureId & 0xfffffffe00000000LL) != 0
LL) {
149 return fpaExposureId;
153 if (properties->isArray(
"ccdId")) {
156 int ccdId = properties->getAsInt(
"ccdId");
163 return static_cast<int>(ccdId);
167 if (properties->isArray(
"ampId")) {
170 int ampId = properties->getAsInt(
"ampId");
181 if (properties->isArray(
"ccdExposureId")) {
184 int64_t ccdExposureId = properties->getAsInt64(
"ccdExposureId");
185 if (ccdExposureId < 0) {
188 return ccdExposureId;
192 if (properties->isArray(
"ampExposureId")) {
195 int64_t ampExposureId = properties->getAsInt64(
"ampExposureId");
196 if (ampExposureId < 0) {
199 return ampExposureId;
206 if (properties->isArray(
"itemName")) {
209 return properties->getAsString(
"itemName");
213 if (properties && properties->exists(name)) {
214 return properties->getAsBool(name);
222 return LogicalLocation(policy->getString(itemName +
".tableNamePattern"), properties).locString();
228 std::string pattern(policy->getString(itemName +
".tableNamePattern"));
230 if (properties->exists(itemName +
".numSlices")) {
231 numSlices = properties->getAsInt(itemName +
".numSlices");
233 if (numSlices <= 0) {
239 for (
int i = 0; i < numSlices; ++i) {
240 props->set(
"sliceId", i);
251 std::string model(policy->getString(itemName +
".templateTableName"));
255 db.createTableFromTemplate(name, model);
272 return formatFitsPropertiesImpl(paramNames, prop);
278 for (
auto const &
name: prop) {
283 return formatFitsPropertiesImpl(paramNames, prop);
293 auto shape = ndarray::makeVector(nbytes);
294 auto strides = ndarray::makeVector(1);
297 ndarray::Array<std::uint8_t const, 1, 1> localArray = ndarray::external(byteCArr, shape, strides);
298 return ndarray::copy(localArray);
303 char const* charCArr =
reinterpret_cast<char const*
>(bytes.getData());
table::Key< std::string > name
virtual void setPersistLocation(LogicalLocation const &location)
std::vector< std::string > paramNames(bool topLevelOnly=true) const
lsst::daf::base::PropertySet PropertySet
A base class for image defects.
#define LSST_EXCEPT(type,...)
virtual void dropTable(std::string const &tableName)