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



#include <omtReader/omtReader.h>
#include <vlutil/vlString.h>
#include <mtl/mtl.h> 
#ifdef DtUSE_UTILITIES_NAMESPACE
namespace DtUSE_UTILITIES_NAMESPACE
{
#endif
class DtOMTTree;
class DtComplexComponentNode;
class DtEnumerationNode;
class DtAttributeFedNode;
class DtParameterFedNode;
class DtExerciseConn;
class DtObjectClassFedNode;
class DtInteractionClassFedNode;

class DT_DLL_OMTREADER DtOMTFileReader
{

public: 

   //! default constructor
   DtOMTFileReader();
   
   //! destructor
   virtual ~DtOMTFileReader();

   //! This creates an OMT tree from a file
   //! Ownership of this tree is passed to the person
   //! who called this function
   virtual DtOMTTree* readFile(const DtString& str, DtExerciseConn* ex = 0);

   virtual const DtString& getLastError();
   virtual void clearLastError();

protected:
   
   virtual DtOMTTree* processObjectModel(DtlObjPtr& ptr);

   virtual void processName(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processVersionNo(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processType(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processPurpose(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processApplicationDomain(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processSponsorOrgName(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processModificationDate(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processMOMVersion(DtlObjPtr& ptr, DtOMTTree*);   
   virtual void processComplexDataType(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processEnumeratedDataType(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processNote(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processObjectClass(DtlObjPtr& ptr, DtOMTTree*);
   virtual void processInteractionClass(DtlObjPtr& ptr, DtOMTTree*);

   DtComplexComponentNode* processComplexComponent(DtlObjPtr& ptr);
   DtEnumerationNode* processEnumeration(DtlObjPtr& ptr);
   DtAttributeFedNode* processAttribute(DtlObjPtr& ptr);
   DtParameterFedNode* processParameter(DtlObjPtr& ptr);

protected:

   //! Once the lists are all put in, walk through the object class list to
   // get the object class and attribute handles and link the children nodes with their parents.
   virtual void buildObjectClassTree(DtOMTTree* omtTree);

   //! Once the lists are all put in, walk through the interaction class list to
   // get the interaction class and parameter handles and link the children nodes with their parents.
   virtual void buildInteractionClassTree(DtOMTTree* omtTree);

   //Helper function for build tree
   virtual void setAttributeHandles(DtObjectClassFedNode* objNode);
   virtual void setParameterHandles(DtInteractionClassFedNode* objNode);

protected:
   DtString myLastError;
   DtExerciseConn* myExConn;

private:
   
   //! Copy Constructor
   DtOMTFileReader(const DtOMTFileReader& orig);
   
   //! Assignment Operator
   DtOMTFileReader& operator=(const DtOMTFileReader& rhs);




};


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