/*******************************************************************************
** Copyright (c) 1992-2026 MAK Technologies, Inc
** All rights reserved.
*******************************************************************************/
//! \file longDatatypeRep.h
//! \ingroup omtReader
#pragma once



#include "numberDatatypeRep.h"

#include <vlutil/vlString.h>
#ifdef DtUSE_UTILITIES_NAMESPACE
namespace DtUSE_UTILITIES_NAMESPACE
{
#endif
class DtNetU64;

//! OMT Datatype of type Long - in network format which means
//! Big Endian representation
//! \ingroup omtReader
class DT_DLL_OMTREADER DtLongDatatypeRep : public DtNumberDatatypeRep
{
public:
   
   //! Default Constructor
   DtLongDatatypeRep(bool useImplicitPadding, bool unsign = false);
   
   //! Destructor
   virtual ~DtLongDatatypeRep();
   
   //! Copy Constructor
   DtLongDatatypeRep(const DtLongDatatypeRep& orig);
   
   //! Assignment Operator
   DtLongDatatypeRep& operator=(const DtLongDatatypeRep& rhs);
   
   //! @return "long"
   virtual const char* datatype() const;
   
   //! @return the long val of this item
   virtual long long longVal(const void*) const;
   
   //! @return the unsigned long val of this item
   virtual unsigned long long unsignedLongVal(const void*) const;
   
   //! @return an exact copy of the byte stream
   virtual DtString stringRep(const void* ptr, int* size = 0) const;

   //! @return the number version of the byte stream
   virtual double numberRep(const void* ptr, int* size = 0) const;

   //! @return the number of bytes needed for the data representation
   virtual int sizeNeeded(const void* ptr) const;

   //! Set whether the representation is signed (false) or unsigned (true)
   virtual void setUnsigned(bool);

   //! @return the reverse of string rep
   virtual std::vector<char> valueFromStringRep(const DtString& stringRep) const;

   //! The alignment size in bytes for this representation.
   virtual int byteAlignment() const { return 8; };

protected:

   //! Align pointer if necessary and if provided pass back size of data and any added padding
   const DtNetU64* netValPtr(const void*  ptr, int* size=0) const;

protected:
   bool myIsUnsigned;
};

#ifdef DtUSE_UTILITIES_NAMESPACE
} // end of namespace DtUSE_UTILITIES_NAMESPACE
#endif
