Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync externals #332

Merged
merged 4 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion externals/coda-oss/.clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BasedOnStyle: Google
AccessModifierOffset: '0'
AccessModifierOffset: '-4'
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
Expand Down
46 changes: 23 additions & 23 deletions externals/coda-oss/modules/c++/sys/include/sys/Err.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* =========================================================================
* This file is part of sys-c++
* This file is part of sys-c++
* =========================================================================
*
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* sys-c++ is free software; you can redistribute it and/or modify
Expand All @@ -14,8 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; If not,
* You should have received a copy of the GNU Lesser General Public
* License along with this program; If not,
* see <http://www.gnu.org/licenses/>.
*
*/
Expand All @@ -25,11 +25,11 @@
#define __SYS_ERR_H__

/*!
* \file Err.h
* \file Err.h
* \brief Errno like object
*
*
* This object is very much like errno or the GetLastError() function
* in Win32. It doesnt do anything dazzling. It just reports the
* in Win32. It doesnt do anything dazzling. It just reports the
* last error. This class is sometimes useful, because it understands
* that its error id maps to a system string error, and it knows how
* to obtain the error
Expand All @@ -45,13 +45,13 @@ const static int __last_err__ = 0;
/*!
* \class Err
* \brief Errno like object
*
*
* This object is very much like errno or the GetLastError() function
* in Win32. It doesnt do anything dazzling. It just reports the
* last error. This class is sometimes useful, because it understands
* that its error id maps to a system string error, and it knows how
* to obtain the error.
*
*
*/

class Err
Expand All @@ -66,7 +66,7 @@ class Err
{
mErrId = err.getErrID();
}

/*!
* Constructor from int error id
* \param errNum The error to initialize with. Defaults to last
Expand All @@ -75,7 +75,7 @@ class Err
{
setThis(errNum);
}

/*!
* Assignment operator
* \param err The err to take
Expand All @@ -88,13 +88,13 @@ class Err
}
return *this;
}

//! Destructor
virtual ~Err() {}

/*!
* This is the equivalent of strerror, done in a cross-platform
* manner, wrapped in this class. Prints this object to
* manner, wrapped in this class. Prints this object to
* its error string
* \return a string representation of this error
*
Expand All @@ -112,10 +112,10 @@ class Err
mErrId = getLast();
}
}

//! Return the last error
virtual int getLast() const;

int getErrID() const { return mErrId; }

protected:
Expand All @@ -140,21 +140,21 @@ class SocketErr : public Err
* \param err An error to initialize from
*
*/
SocketErr(const SocketErr& err)
SocketErr(const SocketErr& err) :
Err(err.getErrID())
{
mErrId = err.getErrID();
}

/*!
* Constructor
* \param errNum An int to initialize from
*
*/
*/
SocketErr(int errNum = __last_err__)
{
setThis(errNum);
}

/*!
* Assignment operator
* \param err The err to take
Expand All @@ -168,10 +168,10 @@ class SocketErr : public Err
}
return *this;
}

//! Destructor
virtual ~SocketErr() {}

//! Redefined for socket errors
virtual int getLast() const;

Expand Down
19 changes: 13 additions & 6 deletions externals/nitro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,16 @@ of fixing it later, which will make me eternally grateful.

NITF Library Users: General Issues
----------------------------------
If you want to use the default TRE plugins that come with the library,
NITRO already knows where they are installed, and you don't have to
do anything.

If you want to override this behavior, you can set the
`NITF_PLUGIN_PATH` environment variable to your preferred location.
NITRO handles TREs by loading dynamic libraries at runtime. Therefore, you need
to make sure NITRO can find them.

* If you are building from source, the location will be compiled in, and
you don't have to do anything extra.

* If you are working from a binary release, you will have to tell
NITRO where the plugins are by setting the `NITF_PLUGIN_PATH`
enviornment variable.
This should look something like `<install>/share/nitf/plugins`.

* If you wish to use a custom TRE location, you can also specify that
with `NITF_PLUGIN_PATH`.
90 changes: 45 additions & 45 deletions externals/nitro/modules/c++/nitf/include/nitf/TRE.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,43 @@
#ifndef __NITF_TRE_HPP__
#define __NITF_TRE_HPP__

#include "nitf/TRE.h"
#include "nitf/System.hpp"
#include <string>
#include "nitf/Field.hpp"
#include "nitf/Pair.hpp"
#include "nitf/Object.hpp"
#include <string>
#include "nitf/Pair.hpp"
#include "nitf/System.hpp"
#include "nitf/TRE.h"

/*!
* \file TRE.hpp
* \brief Contains wrapper implementation for TRE
*/
namespace nitf
{

/*!
* \class FieldIterator
* \brief The C++ wrapper for the nitf_TREEnumerator
*/
class TREFieldIterator : public nitf::Object<nitf_TREEnumerator>
{
public:
public:
TREFieldIterator() : mPair(NULL)
{
setNative(NULL);
}

~TREFieldIterator(){}
~TREFieldIterator()
{
}

//! Copy constructor
TREFieldIterator(const TREFieldIterator & x)
TREFieldIterator(const TREFieldIterator& x)
{
setNative(x.getNative());
}

//! Assignment Operator
TREFieldIterator & operator=(const TREFieldIterator & x)
TREFieldIterator& operator=(const TREFieldIterator& x)
{
if (&x != this)
{
Expand All @@ -69,21 +70,21 @@ class TREFieldIterator : public nitf::Object<nitf_TREEnumerator>
}

//! Set native object
TREFieldIterator(nitf_TREEnumerator * x) : mPair(NULL)
TREFieldIterator(nitf_TREEnumerator* x) : mPair(NULL)
{
setNative(x);
getNativeOrThrow();
increment();
}

TREFieldIterator(NITF_DATA * x)
TREFieldIterator(NITF_DATA* x)
{
setNative((nitf_TREEnumerator*)x);
getNativeOrThrow();
increment();
}

TREFieldIterator & operator=(NITF_DATA * x)
TREFieldIterator& operator=(NITF_DATA* x)
{
setNative((nitf_TREEnumerator*)x);
getNativeOrThrow();
Expand All @@ -98,8 +99,8 @@ class TREFieldIterator : public nitf::Object<nitf_TREEnumerator>
*/
bool operator==(const nitf::TREFieldIterator& it2)
{
//need to do this double-check so that the last iteration of an iterator
//doesn't get skipped
// need to do this double-check so that the last iteration of an
// iterator doesn't get skipped
if (getNative() == it2.getNative())
return mPair == it2.mPair;
return false;
Expand All @@ -120,11 +121,11 @@ class TREFieldIterator : public nitf::Object<nitf_TREEnumerator>
mPair = enumerator->next(enumerator, &error);
else
mPair = NULL;
setNative(enumerator); //always reset, in case it got destroyed
setNative(enumerator); // always reset, in case it got destroyed
}

//! Increment the iterator (postfix)
void operator++(int )
void operator++(int)
{
increment();
}
Expand All @@ -148,43 +149,40 @@ class TREFieldIterator : public nitf::Object<nitf_TREEnumerator>
nitf_TREEnumerator* enumerator = getNative();
if (enumerator && isValid())
{
const char* desc = enumerator->getFieldDescription(enumerator,
&error);
const char* desc =
enumerator->getFieldDescription(enumerator, &error);
if (desc)
return std::string(desc);
}
return "";
}

private:
private:
nitf_Error error;
nitf_Pair *mPair;
nitf_Pair* mPair;
};



/*!
* \class TRE
* \brief The C++ wrapper for the nitf_TRE
*/
DECLARE_CLASS(TRE)
{
public:

typedef nitf::TREFieldIterator Iterator;
public:
typedef nitf::TREFieldIterator Iterator;

//! Copy constructor
TRE(const TRE & x);
TRE(const TRE& x);

//! Assignment Operator
TRE & operator=(const TRE & x);
TRE& operator=(const TRE& x);

//! Set native object
TRE(nitf_TRE * x);

TRE(NITF_DATA * x);

TRE & operator=(NITF_DATA * x);
TRE& operator=(NITF_DATA* x);

//! Without the const char* constructors, in VS if you do something like
// TRE("my_tre_tag")
Expand Down Expand Up @@ -220,26 +218,30 @@ typedef nitf::TREFieldIterator Iterator;
*/
nitf::Field getField(const std::string& key);

nitf::Field operator[] (const std::string& key);
nitf::Field operator[](const std::string& key);

/*!
* Returns a List of Fields that match the given pattern.
*/
nitf::List find(const std::string& pattern);

/*!
* Sets the field with the given value. The input value
* is converted to a std::string, and the string-ized value
* is then used as the value input for the TRE field.
*/
template <typename T> void setField(std::string key, T value)
/*!
* Sets the field with the given value. The input value
* is converted to a std::string, and the string-ized value
* is then used as the value input for the TRE field.
*/
template <typename T>
void setField(std::string key, T value)
{
std::string s = str::toString<T>(value);
if (!nitf_TRE_setField(getNative(),
key.c_str(),
(NITF_DATA*)s.c_str(),
s.size(),
&error) );
std::string s = str::toString<T>(value);
if (!nitf_TRE_setField(getNative(),
key.c_str(),
(NITF_DATA*)s.c_str(),
s.size(),
&error))
{
throw NITFException(&error);
}
}

/*!
Expand All @@ -255,7 +257,7 @@ typedef nitf::TREFieldIterator Iterator;
std::string getTag() const;

//! Set the tag
void setTag(const std::string & value);
void setTag(const std::string& value);

/**
* Get the TRE identifier. This is NOT the tag, however it may be the
Expand All @@ -265,10 +267,8 @@ typedef nitf::TREFieldIterator Iterator;
*/
std::string getID() const;


private:
private:
nitf_Error error;
};

}
#endif
Loading