<NME> ossimDtedAcc.cpp
<BEF> //*******************************************************************
//
// License:  See top level LICENSE.txt file.
//
// Author: Ken Melero
// 
// Description:  This class gives access to the Accuracy Description
//               (ACC) of a DTED Level 1 file.
//
//********************************************************************
// $Id: ossimDtedAcc.cpp 23276 2015-04-24 21:01:51Z rashadkm $

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

#include <ossim/support_data/ossimDtedAcc.h>
#include <ossim/base/ossimNotify.h>
#include <ossim/base/ossimIoStream.h>
#include <ossim/base/ossimProperty.h>
#include <ossim/base/ossimStringProperty.h>
#include <ossim/base/ossimIosStream.h>

ossimDtedAcc::ossimDtedAcc()
{
ossimDtedAcc::ossimDtedAcc()
{
   
}

ossimDtedAcc::ossimDtedAcc(std::shared_ptr<ossim::istream>& str, ossim_int64 offset)
{
   if(str)
   {
      str->seekg(offset);
      parse(*str); 
   }
   else
   {
      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
   }
}

void ossimDtedAcc::clearFields()
{
   memset(theRecSen, '\0', FIELD1_SIZE+1);
   memset(theAbsoluteCE, '\0',FIELD2_SIZE+1);
   memset(theAbsoluteLE, '\0',FIELD3_SIZE+1);
   memset(theRelativeCE, '\0',FIELD4_SIZE+1);
   memset(theRelativeLE, '\0',FIELD5_SIZE+1);
   memset(theField6, '\0',FIELD6_SIZE+1);
   memset(theField7, '\0',FIELD7_SIZE+1);
   memset(theField8, '\0',FIELD8_SIZE+1);
   memset(theField9, '\0',FIELD9_SIZE+1);
   memset(theField10, '\0',FIELD10_SIZE+1);
   memset(theField11, '\0',FIELD11_SIZE+1);
   memset(theField12, '\0',FIELD12_SIZE+1);
   memset(theField13, '\0',FIELD13_SIZE+1);
   memset(theField14, '\0',FIELD14_SIZE+1);
   memset(theField15, '\0',FIELD15_SIZE+1);
   memset(theField16, '\0',FIELD16_SIZE+1);
   memset(theField17, '\0',FIELD17_SIZE+1);
   
   theStartOffset = 0;
   theStopOffset = 0;
}
//**************************************************************************
// ossimDtedAcc::parse()
//**************************************************************************
void ossimDtedAcc::parse(std::istream& in)
{
   clearErrorStatus();
	clearFields();
	theStartOffset = in.tellg();
   theStopOffset  = theStartOffset;
   // Parse theRecSen
   in.read(theRecSen, FIELD1_SIZE);
   theRecSen[FIELD1_SIZE] = '\0';

   if(!(strncmp(theRecSen, "ACC", 3) == 0))
   {
      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
      in.seekg(theStartOffset);
      return;
   }
   
   // Parse theAbsoluteCE
   in.read(theAbsoluteCE, FIELD2_SIZE);
   theAbsoluteCE[FIELD2_SIZE] = '\0';
   
   // Parse theAbsoluteLE
   in.read(theAbsoluteLE, FIELD3_SIZE);
   theAbsoluteLE[FIELD3_SIZE] = '\0';
   
   // Parse theRelativeCE
   in.read(theRelativeCE, FIELD4_SIZE);
   theRelativeCE[FIELD4_SIZE] = '\0';
   
   // Parse theRelativeLE
   in.read(theRelativeLE, FIELD5_SIZE);
   theRelativeLE[FIELD5_SIZE] = '\0';
   
   // Parse Field 6
   in.read(theField6, FIELD6_SIZE);
   theField6[FIELD6_SIZE] = '\0';
   
   // Parse Field 7
   in.read(theField7, FIELD7_SIZE);
   theField7[FIELD7_SIZE] = '\0';
   
   // Parse Field 8
   in.read(theField8, FIELD8_SIZE);
   theField8[FIELD8_SIZE] = '\0';
   
   // Parse Field 9
   in.read(theField9, FIELD9_SIZE);
   theField9[FIELD9_SIZE] = '\0';
   
   // Parse Field 10
   in.read(theField10, FIELD10_SIZE);
   theField10[FIELD10_SIZE] = '\0';
   
   // Parse Field 11
   in.read(theField11, FIELD11_SIZE);
   theField11[FIELD11_SIZE] = '\0';
   
   // Parse Field 12
   in.read(theField12, FIELD12_SIZE);
   theField12[FIELD12_SIZE] = '\0';
   
   // Parse Field 13
   in.read(theField13, FIELD13_SIZE);
   theField13[FIELD13_SIZE] = '\0';
   
   // Parse Field 14
   in.read(theField14, FIELD14_SIZE);
   theField14[FIELD14_SIZE] = '\0';
   
   // Parse Field 15
   in.read(theField15, FIELD15_SIZE);
   theField15[FIELD15_SIZE] = '\0';
   
   // Parse Field 16
   in.read(theField16, FIELD16_SIZE);
   theField16[FIELD16_SIZE] = '\0';
   
   // Parse Field 17
   in.read(theField17, FIELD17_SIZE);
   theField17[FIELD17_SIZE] = '\0';

   in.ignore(FIELD18_SIZE);
   // Set the stop offset.
   theStopOffset = theStartOffset + ACC_LENGTH;
}

ossimRefPtr<ossimProperty> ossimDtedAcc::getProperty(
   const ossimString& name) const
{
   ossimRefPtr<ossimProperty> result = 0;
   if (name == "recognition_sentinel")
   {
      result = new ossimStringProperty(name, theRecSen);
      
   }
   else if (name == "absolute_ce")
   {
      result = new ossimStringProperty(name, theAbsoluteCE);
   }
   else if (name == "absolute_le")
   {
      result = new ossimStringProperty(name, theAbsoluteLE); 
   }
   else if (name == "relative_ce")
   {
      result = new ossimStringProperty(name, theRelativeCE);
   }
   else if (name == "relative_le")
   {
      result = new ossimStringProperty(name, theRelativeLE);
   }
   return result;
}

void ossimDtedAcc::getPropertyNames(
   std::vector<ossimString>& propertyNames) const
{
   propertyNames.push_back(ossimString("recognition_sentinel"));
   propertyNames.push_back(ossimString("absolute_ce"));
   propertyNames.push_back(ossimString("absolute_le"));
   propertyNames.push_back(ossimString("relative_ce"));
   propertyNames.push_back(ossimString("relative_le"));
}

std::ostream& ossimDtedAcc::print(std::ostream& out,
                                  const std::string& prefix) const
{
   std::string pfx = prefix;
   pfx += "acc.";

   out << setiosflags(ios::left)
       << pfx << setw(28) << "recognition_sentinel:" << theRecSen << "\n"
       << pfx << setw(28) << "absolute_ce:"  << theAbsoluteCE << "\n"
       << pfx << setw(28) << "absolute_le:"  << theAbsoluteLE << "\n"
       << pfx << setw(28) << "relative ce:"  << theRelativeCE << "\n"
       << pfx << setw(28) << "relative le:"  << theRelativeLE << "\n"
       << pfx << setw(28) << "start_offset:" << theStartOffset << "\n"
       << pfx << setw(28) << "stop_offset:"  << theStopOffset
       << std::endl;
   return out;
}

ossim_int32 ossimDtedAcc::absCE() const
{
   return atoi(theAbsoluteCE);
}

ossim_int32 ossimDtedAcc::absLE() const
{
   return atoi(theAbsoluteLE);
}

ossim_int32 ossimDtedAcc::relCE() const
{
   return atoi(theRelativeCE);
}

ossim_int32 ossimDtedAcc::relLE() const
{
   return atoi(theRelativeLE);
}
   
ossim_int32 ossimDtedAcc::startOffset() const
{
   return theStartOffset;
}

ossim_int32 ossimDtedAcc::stopOffset()  const
{
   return theStopOffset;
}



//**************************************************************************
// operator <<
//**************************************************************************
std::ostream& operator<<( std::ostream& os, const ossimDtedAcc& acc)
{
   std::string prefix;
   return acc.print(os, prefix);
}

ossimDtedAcc::ossimDtedAcc(const ossimDtedAcc& /* source */)
{
      clearFields();
}

const ossimDtedAcc& ossimDtedAcc::operator=(const ossimDtedAcc& rhs)
{
   return rhs;
}

<MSG> Merge pull request #68 from ossimlabs/aws-test

Fixing incoude problems on linux
<DFF> @@ -21,7 +21,7 @@
 #include <ossim/base/ossimIoStream.h>
 #include <ossim/base/ossimProperty.h>
 #include <ossim/base/ossimStringProperty.h>
-#include <ossim/base/ossimIosStream.h>
+#include <ossim/base/ossimIoStream.h>
 
 ossimDtedAcc::ossimDtedAcc()
 {

{'commit': 'diff --git a/include/ossim/support_data/ossimDemUtil.h b/include/ossim/support_data/ossimDemUtil.h\nindex c39eb906..06fd5b0a 100644\n--- a/include/ossim/support_data/ossimDemUtil.h\n+++ b/include/ossim/support_data/ossimDemUtil.h\n@@ -18,6 +18,7 @@\n \n #include <ossim/base/ossimIosFwd.h>\n #include <string>\n+#include <memory>\n \n class ossimFilename;\n \ndiff --git a/src/support_data/ossimDemUtil.cpp b/src/support_data/ossimDemUtil.cpp\nindex 5085e7da..ee740358 100644\n--- a/src/support_data/ossimDemUtil.cpp\n+++ b/src/support_data/ossimDemUtil.cpp\n@@ -21,7 +21,6 @@\n #include <ossim/base/ossimStreamFactoryRegistry.h>\n #include <cstring>\n #include <iostream>\n-#include <memory>\n \n static const char DEM_TYPE_KW[] = "dem_type";\n static const char USGS_DEM_KW[] = "usgs_dem";\ndiff --git a/src/support_data/ossimDtedAcc.cpp b/src/support_data/ossimDtedAcc.cpp\nindex 922bb7ca..04819297 100644\n--- a/src/support_data/ossimDtedAcc.cpp\n+++ b/src/support_data/ossimDtedAcc.cpp\n@@ -21,7 +21,7 @@\n #include <ossim/base/ossimIoStream.h>\n #include <ossim/base/ossimProperty.h>\n #include <ossim/base/ossimStringProperty.h>\n-#include <ossim/base/ossimIosStream.h>\n+#include <ossim/base/ossimIoStream.h>\n \n ossimDtedAcc::ossimDtedAcc()\n {\n', 'commit_subject': 'Merge pull request #68 from ossimlabs/aws-test', 'repo_name': 'ossimlabs/ossim', 'committer': {'name': 'GitHub', 'email': '1505422b2465e9a84f6fdfaa161078890c593f06@github.com', 'time_sec': '1480432779', 'tz_offset': '-300', 'date': {'seconds': '1480432779'}}, 'commit_tree': '8ddfd7c35380d581b9508a8eca1843334a07b39c', 'commit_message': 'Merge pull request #68 from ossimlabs/aws-test\n\nFixing incoude problems on linux', 'language_name': 'C', 'license': 'mit', 'hunks': '@@ -21,7 +21,7 @@\n #include <ossim/base/ossimIoStream.h>\n #include <ossim/base/ossimProperty.h>\n #include <ossim/base/ossimStringProperty.h>\n-#include <ossim/base/ossimIosStream.h>\n+#include <ossim/base/ossimIoStream.h>\n \n ossimDtedAcc::ossimDtedAcc()\n {\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/src/support_data/ossimDtedAcc.cpp', 'tgt_file': 'b/src/support_data/ossimDtedAcc.cpp', 'file_extension': '.cpp', 'before_file': '//*******************************************************************\n//\n// License:  See top level LICENSE.txt file.\n//\n// Author: Ken Melero\n// \n// Description:  This class gives access to the Accuracy Description\n//               (ACC) of a DTED Level 1 file.\n//\n//********************************************************************\n// $Id: ossimDtedAcc.cpp 23276 2015-04-24 21:01:51Z rashadkm $\n\n#include <cstdlib>\n#include <iostream>\n#include <iomanip>\n#include <fstream>\n#include <string>\n\n#include <ossim/support_data/ossimDtedAcc.h>\n#include <ossim/base/ossimNotify.h>\n#include <ossim/base/ossimIoStream.h>\n#include <ossim/base/ossimProperty.h>\n#include <ossim/base/ossimStringProperty.h>\n#include <ossim/base/ossimIosStream.h>\n\nossimDtedAcc::ossimDtedAcc()\n{\nossimDtedAcc::ossimDtedAcc()\n{\n   \n}\n\nossimDtedAcc::ossimDtedAcc(std::shared_ptr<ossim::istream>& str, ossim_int64 offset)\n{\n   if(str)\n   {\n      str->seekg(offset);\n      parse(*str); \n   }\n   else\n   {\n      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;\n   }\n}\n\nvoid ossimDtedAcc::clearFields()\n{\n   memset(theRecSen, \'\\0\', FIELD1_SIZE+1);\n   memset(theAbsoluteCE, \'\\0\',FIELD2_SIZE+1);\n   memset(theAbsoluteLE, \'\\0\',FIELD3_SIZE+1);\n   memset(theRelativeCE, \'\\0\',FIELD4_SIZE+1);\n   memset(theRelativeLE, \'\\0\',FIELD5_SIZE+1);\n   memset(theField6, \'\\0\',FIELD6_SIZE+1);\n   memset(theField7, \'\\0\',FIELD7_SIZE+1);\n   memset(theField8, \'\\0\',FIELD8_SIZE+1);\n   memset(theField9, \'\\0\',FIELD9_SIZE+1);\n   memset(theField10, \'\\0\',FIELD10_SIZE+1);\n   memset(theField11, \'\\0\',FIELD11_SIZE+1);\n   memset(theField12, \'\\0\',FIELD12_SIZE+1);\n   memset(theField13, \'\\0\',FIELD13_SIZE+1);\n   memset(theField14, \'\\0\',FIELD14_SIZE+1);\n   memset(theField15, \'\\0\',FIELD15_SIZE+1);\n   memset(theField16, \'\\0\',FIELD16_SIZE+1);\n   memset(theField17, \'\\0\',FIELD17_SIZE+1);\n   \n   theStartOffset = 0;\n   theStopOffset = 0;\n}\n//**************************************************************************\n// ossimDtedAcc::parse()\n//**************************************************************************\nvoid ossimDtedAcc::parse(std::istream& in)\n{\n   clearErrorStatus();\n\tclearFields();\n\ttheStartOffset = in.tellg();\n   theStopOffset  = theStartOffset;\n   // Parse theRecSen\n   in.read(theRecSen, FIELD1_SIZE);\n   theRecSen[FIELD1_SIZE] = \'\\0\';\n\n   if(!(strncmp(theRecSen, "ACC", 3) == 0))\n   {\n      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;\n      in.seekg(theStartOffset);\n      return;\n   }\n   \n   // Parse theAbsoluteCE\n   in.read(theAbsoluteCE, FIELD2_SIZE);\n   theAbsoluteCE[FIELD2_SIZE] = \'\\0\';\n   \n   // Parse theAbsoluteLE\n   in.read(theAbsoluteLE, FIELD3_SIZE);\n   theAbsoluteLE[FIELD3_SIZE] = \'\\0\';\n   \n   // Parse theRelativeCE\n   in.read(theRelativeCE, FIELD4_SIZE);\n   theRelativeCE[FIELD4_SIZE] = \'\\0\';\n   \n   // Parse theRelativeLE\n   in.read(theRelativeLE, FIELD5_SIZE);\n   theRelativeLE[FIELD5_SIZE] = \'\\0\';\n   \n   // Parse Field 6\n   in.read(theField6, FIELD6_SIZE);\n   theField6[FIELD6_SIZE] = \'\\0\';\n   \n   // Parse Field 7\n   in.read(theField7, FIELD7_SIZE);\n   theField7[FIELD7_SIZE] = \'\\0\';\n   \n   // Parse Field 8\n   in.read(theField8, FIELD8_SIZE);\n   theField8[FIELD8_SIZE] = \'\\0\';\n   \n   // Parse Field 9\n   in.read(theField9, FIELD9_SIZE);\n   theField9[FIELD9_SIZE] = \'\\0\';\n   \n   // Parse Field 10\n   in.read(theField10, FIELD10_SIZE);\n   theField10[FIELD10_SIZE] = \'\\0\';\n   \n   // Parse Field 11\n   in.read(theField11, FIELD11_SIZE);\n   theField11[FIELD11_SIZE] = \'\\0\';\n   \n   // Parse Field 12\n   in.read(theField12, FIELD12_SIZE);\n   theField12[FIELD12_SIZE] = \'\\0\';\n   \n   // Parse Field 13\n   in.read(theField13, FIELD13_SIZE);\n   theField13[FIELD13_SIZE] = \'\\0\';\n   \n   // Parse Field 14\n   in.read(theField14, FIELD14_SIZE);\n   theField14[FIELD14_SIZE] = \'\\0\';\n   \n   // Parse Field 15\n   in.read(theField15, FIELD15_SIZE);\n   theField15[FIELD15_SIZE] = \'\\0\';\n   \n   // Parse Field 16\n   in.read(theField16, FIELD16_SIZE);\n   theField16[FIELD16_SIZE] = \'\\0\';\n   \n   // Parse Field 17\n   in.read(theField17, FIELD17_SIZE);\n   theField17[FIELD17_SIZE] = \'\\0\';\n\n   in.ignore(FIELD18_SIZE);\n   // Set the stop offset.\n   theStopOffset = theStartOffset + ACC_LENGTH;\n}\n\nossimRefPtr<ossimProperty> ossimDtedAcc::getProperty(\n   const ossimString& name) const\n{\n   ossimRefPtr<ossimProperty> result = 0;\n   if (name == "recognition_sentinel")\n   {\n      result = new ossimStringProperty(name, theRecSen);\n      \n   }\n   else if (name == "absolute_ce")\n   {\n      result = new ossimStringProperty(name, theAbsoluteCE);\n   }\n   else if (name == "absolute_le")\n   {\n      result = new ossimStringProperty(name, theAbsoluteLE); \n   }\n   else if (name == "relative_ce")\n   {\n      result = new ossimStringProperty(name, theRelativeCE);\n   }\n   else if (name == "relative_le")\n   {\n      result = new ossimStringProperty(name, theRelativeLE);\n   }\n   return result;\n}\n\nvoid ossimDtedAcc::getPropertyNames(\n   std::vector<ossimString>& propertyNames) const\n{\n   propertyNames.push_back(ossimString("recognition_sentinel"));\n   propertyNames.push_back(ossimString("absolute_ce"));\n   propertyNames.push_back(ossimString("absolute_le"));\n   propertyNames.push_back(ossimString("relative_ce"));\n   propertyNames.push_back(ossimString("relative_le"));\n}\n\nstd::ostream& ossimDtedAcc::print(std::ostream& out,\n                                  const std::string& prefix) const\n{\n   std::string pfx = prefix;\n   pfx += "acc.";\n\n   out << setiosflags(ios::left)\n       << pfx << setw(28) << "recognition_sentinel:" << theRecSen << "\\n"\n       << pfx << setw(28) << "absolute_ce:"  << theAbsoluteCE << "\\n"\n       << pfx << setw(28) << "absolute_le:"  << theAbsoluteLE << "\\n"\n       << pfx << setw(28) << "relative ce:"  << theRelativeCE << "\\n"\n       << pfx << setw(28) << "relative le:"  << theRelativeLE << "\\n"\n       << pfx << setw(28) << "start_offset:" << theStartOffset << "\\n"\n       << pfx << setw(28) << "stop_offset:"  << theStopOffset\n       << std::endl;\n   return out;\n}\n\nossim_int32 ossimDtedAcc::absCE() const\n{\n   return atoi(theAbsoluteCE);\n}\n\nossim_int32 ossimDtedAcc::absLE() const\n{\n   return atoi(theAbsoluteLE);\n}\n\nossim_int32 ossimDtedAcc::relCE() const\n{\n   return atoi(theRelativeCE);\n}\n\nossim_int32 ossimDtedAcc::relLE() const\n{\n   return atoi(theRelativeLE);\n}\n   \nossim_int32 ossimDtedAcc::startOffset() const\n{\n   return theStartOffset;\n}\n\nossim_int32 ossimDtedAcc::stopOffset()  const\n{\n   return theStopOffset;\n}\n\n\n\n//**************************************************************************\n// operator <<\n//**************************************************************************\nstd::ostream& operator<<( std::ostream& os, const ossimDtedAcc& acc)\n{\n   std::string prefix;\n   return acc.print(os, prefix);\n}\n\nossimDtedAcc::ossimDtedAcc(const ossimDtedAcc& /* source */)\n{\n      clearFields();\n}\n\nconst ossimDtedAcc& ossimDtedAcc::operator=(const ossimDtedAcc& rhs)\n{\n   return rhs;\n}\n', 'message': 'Merge pull request #68 from ossimlabs/aws-test\n\nFixing incoude problems on linux', 'author_name': 'GitHub', 'lang': 'cpp'}