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



#pragma warning(disable : 4100)

#include "fedNode.h"
#include "attributeFedNode.h"

#ifdef DtHLA
#ifndef DtUSE_UTILITIES_NAMESPACE
#include <vl/fom.h>
#include <vl/objClassDesc.h>
#include <vl/rtiNamespace.h>
#endif
#endif

#include <vlutil/vlString.h>
#include <list>
#include <map>
#ifdef DtUSE_UTILITIES_NAMESPACE
namespace DtUSE_UTILITIES_NAMESPACE
{
#endif
class DT_DLL_OMTREADER DtDatatypeRep;


//! defines an object class inside our Fed Tree
//! \ingroup omtReader
class DT_DLL_OMTREADER DtObjectClassFedNode : public DtFedNode
{
public:
   
   //! A list of DtObjectClassFedNode pointers.
   typedef std::list<DtObjectClassFedNode*> ObjectClassFedNodeList;

   //! A list of AttributeFedNode pointers
   typedef std::list<DtAttributeFedNode*> AttributeFedNodeList;
   typedef std::map<DtString, DtAttributeFedNode*> AttributeFedNodeByName;
#ifdef DtHLA
#ifndef DtUSE_UTILITIES_NAMESPACE
   typedef std::map<RTI::AttributeHandle, DtAttributeFedNode*> AttributeFedNodeByHandle;
#endif
#endif

   //! Default Constructor
   DtObjectClassFedNode();
   
   //! Constructor that includes a parent node
   explicit DtObjectClassFedNode(DtFedNode*);
   
   //! Destructor
   virtual ~DtObjectClassFedNode();
   
   //! Copy Constructor
   DtObjectClassFedNode(const DtObjectClassFedNode& orig);
   
   //! Assignment Operator
   DtObjectClassFedNode& operator=(const DtObjectClassFedNode& rhs);
   
   //! Add a new attribute to this class
   virtual void addAttribute(DtAttributeFedNode* attribute);

   //! Associate attribute with its attribute handle (assumed to have been set in attribute)
   virtual void associateAttribute(DtAttributeFedNode* attribute);
   
   //! Add a new child object to this class
   virtual void addChildObject(DtObjectClassFedNode* child);
   
   //! Go down the tree until I find the object with the following name
   virtual DtObjectClassFedNode* findChildObject(const char * name) ;

   //! Get the attribute with the given name
   virtual DtAttributeFedNode* findAttribute(const char * attribute) const;

#if DtHLA
#ifndef DtUSE_UTILITIES_NAMESPACE
   //! Get the attribute with the given handle
   virtual DtAttributeFedNode* findAttribute(RTI::AttributeHandle attribute) const;
#endif
#endif

   //! Get the list of Child objects 
   virtual const ObjectClassFedNodeList& getChildObjects() const;

   //! Get the list of Attributes
   virtual const AttributeFedNodeList& getAttributes() const;
   
   virtual void setDescriptor(const DtString&);
   virtual const DtString& getDescriptor() const;

#ifdef DtHLA
#ifndef DtUSE_UTILITIES_NAMESPACE
   virtual void setParentClassHandle(RTI::ObjectClassHandle);
   virtual RTI::ObjectClassHandle getParentClassHandle();

   virtual void setClassHandle(RTI::ObjectClassHandle);
   virtual RTI::ObjectClassHandle getClassHandle();
#endif
#endif

   virtual void setSharing(const DtString&);
   virtual const DtString& getSharing() const;

   virtual void setIdentifier(int);
   virtual int getIdentifier();
   virtual void setParentIdentifier(int);
   virtual int getParentIdentifier();

protected:
   virtual void removeAttributes();

protected:
   AttributeFedNodeList myAttributes;
   AttributeFedNodeByName myAttributesByName;
   ObjectClassFedNodeList myChildObjects;

#ifdef DtHLA
#ifndef DtUSE_UTILITIES_NAMESPACE
   AttributeFedNodeByHandle myAttributesByHandle;

   //! The following values are used only when 
   //! this node is filled with OMT information
   RTI::ObjectClassHandle myParentClassValue;
   RTI::ObjectClassHandle myClassValue;
#endif
#endif

   DtString myDescriptor;

   // 1516(E) only
   DtString mySharing;

   // 1.3 only
   int myIdentifier;
   int myParentIdentifier;
};


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