Changeset 12848 for trunk/FACT++/src/Fits.cc
- Timestamp:
- 02/06/12 09:27:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Fits.cc
r12710 r12848 23 23 #include <cstdio> // for file rename 24 24 #include <cerrno> 25 26 #include <boost/algorithm/string/predicate.hpp> 25 27 26 28 using namespace std; … … 63 65 fDataPointer = dataPointer; 64 66 65 //we will copy this information here. It duplicates the data, which is not great, but it is the easiest way of doing it right now 66 if ((desc.size() == dataFormat.size()+1) || //regular service 67 (desc.size() == dataFormat.size()+2))//service with ending string. skipped in fits 68 {//services have one (or two) more description than columns. skip the first entry while copying as it describes the table itself. 67 //we will copy this information here. It duplicates the data, which is not great, 68 // but it is the easiest way of doing it right now 69 if ( 70 (desc.size() == dataFormat.size()+1) || // regular service 71 (desc.size() == dataFormat.size()+2) // service with ending string. skipped in fits 72 ) 73 { 74 //services have one (or two) more description than columns. skip the first entry while copying as it describes the table itself. 75 69 76 fDataColDesc.clear(); 77 70 78 fTableDesc = desc[0].comment; 71 79 if (fTableDesc.size() > 68) 72 80 { 73 out->Warn("Table description \"" + fTableDesc + "\" too long. truncating it (68 char max.)");81 out->Warn("Table description '" + fTableDesc + "' exceeds 68 chars... truncated."); 74 82 fTableDesc = fTableDesc.substr(0,68); 75 83 } 76 for (unsigned int i=0;i<dataFormat.size(); i++) 84 85 for (unsigned int i=0; i<dataFormat.size(); i++) 77 86 { 78 87 string name = desc[i+1].name; 79 88 if (name.length() > 68) 80 89 { 81 out->Warn("Column name " + name + "too long. truncating it (68 char max.)");90 out->Warn("Column name '" + name + "' exceeds 68 chars... truncated."); 82 91 name = name.substr(0, 68); 83 92 } 93 84 94 string comment = desc[i+1].comment; 85 if ( (comment.length() + name.length()) > 71)95 if (comment.length() + name.length() > 71) 86 96 { 87 out->Warn("Column " + name + " added to \"" + comment + "\" too long. truncating to fit 68 chars.");97 out->Warn("Column '" + name + " / " + comment + "' exceeds 68 chars... truncated."); 88 98 comment = comment.substr(0,68); 89 99 } 100 90 101 string unit = desc[i+1].unit; 91 if (unit.length() > 68) unit = comment.substr(0,68); 102 if (unit.length() > 68) 103 { 104 out->Warn("Unit '" + name + "' exceeds 68 chars... truncated."); 105 unit = comment.substr(0,68); 106 } 107 108 const size_t p = fDataFormats[i].find_last_of('B'); 109 if ((boost::iequals(unit, "text") || boost::iequals(unit, "string")) && p!=string::npos) 110 { 111 out->Info("Column '" + name + "' detected to be an ascii string (FITS format 'A')."); 112 fDataFormats[i].replace(p, 1, "A"); 113 } 114 92 115 fDataColDesc.push_back(Description(name, comment, unit)); 93 116 }
Note:
See TracChangeset
for help on using the changeset viewer.