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



#include <omtReader/omtReader.h>
#include <vlutil/vlString.h>
#ifdef DtUSE_UTILITIES_NAMESPACE
namespace DtUSE_UTILITIES_NAMESPACE
{
#endif
//! Basically a struct with a destructor, a string tree is a collection
//! of indexed strings used to hold more complex attributes or parameters
//! \ingroup omtReader
class DT_DLL_OMTREADER DtStringTree
{
public:
   
   //! Default Constructor
   DtStringTree();
   
   //! Destructor
   virtual ~DtStringTree();
   
   //! Copy Constructor
   DtStringTree(const DtStringTree& orig);
   
   //! Assignment Operator
   DtStringTree& operator=(const DtStringTree& rhs);

   //! Place a string tree in the tail of this string tree
   virtual void appendToArray(DtStringTree* backTree);

   //! Go through the tree to find a specific key
   virtual const DtStringTree* findKey(const DtString& key) const;

   //! Accessors
   inline void setValue(DtString newValue) {myValue = newValue;};
   inline const DtString& value() const {return myValue;};
   inline void setKey(DtString newValue) {myKey = newValue;};
   inline const DtString& key() const {return myKey;};
   inline void setDatatype(DtString newValue) {myDatatype = newValue;};
   inline const DtString& datatype() const {return myDatatype;};
   inline void setOffset(unsigned int newValue) {myOffset = newValue;};
   inline unsigned int offset() const {return myOffset;} ;

   //! The next items in the tree.
   DtStringTree* myNext;
   DtStringTree* myChild;
   DtStringTree* myArray;

protected: 
   
   DtString myValue;
   DtString myKey;
   DtString myDatatype;
   unsigned int myOffset;  //Offset from the start of the byte stream where you may find this value
};

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