/*******************************************************************************
** Copyright (c) 2003 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/

//! \file lcTotalState.h 
//! \brief Contains DtLgrTotalStatePdu

#pragma once

#include "lcPdu.h"


//! Network representation of logger state data
typedef struct DtLgrStateDesc
{
   DtNetFloat64 lgrTime;
   DtNetFloat64 lgrIdealTime;
   DtNetFloat64 lgrScale;
   DtNetFloat64 lgrFileLength;
   DtNetFloat64 lgrHeartbeat;
   DtNetFloat64 lgrTimeout;
   DtNetU32 totalSize;
   DtNetU32 lgrDataScaling;
   DtNetU32 lgrFilePosition;
   DtNetU32 lgrMode;
   DtNetU32 lgrPlayAction;
   DtNetU32 lgrRecordAction;
   DtNetU32 lgrEofAction;
   DtNetU32 lgrCtrlFlags;
   DtNetU32 lgrFileOff;
   DtNetU32 lgrFileLen;
   DtNetU32 annFileOff;
   DtNetU32 annFileLen;
   // DtNetU8 lgrFileName[];
   // DtNetU8 annFileName[];
} DtLgrStateDesc, *PDtLgrStateDesc;


//! Instances of DtLgrTotalStatePdu are used to convey to a remote logger-
//! controller the total current state of a logger instance
//! \ingroup loggerControlToolkit
class DT_DLL_LOGGERCONTROL DtLgrTotalStatePdu : public DtLgrControlPdu
{
public:

   //! (default) constructor
   DtLgrTotalStatePdu(
      DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER );

   //! Construct from network representation.
   DtLgrTotalStatePdu( const DtNetLgrControlPdu*,
      DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0 );

   //! Construct and prepare for send.
   DtLgrTotalStatePdu( const DtEntityIdentifier& sender,
      const DtEntityIdentifier& receiver,
      DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER );

   //! Destructor
   virtual ~DtLgrTotalStatePdu();

   //! Copy constructor
   DtLgrTotalStatePdu( const DtLgrTotalStatePdu& );

   //! Assignment operator
   DtLgrTotalStatePdu& operator=( const DtLgrTotalStatePdu& );

   virtual DtTime time() const;
   virtual void setTime( DtTime tm );

   virtual DtTime idealTime() const;
   virtual void setIdealTime( DtTime tm );

   virtual double scale() const;
   virtual void setScale( double sc );

   virtual DtTime fileLength() const;
   virtual void setFileLength( DtTime tm );

   virtual DtTime heartbeat() const;
   virtual void setHeartbeat( DtTime tm );

   virtual DtTime timeout() const;
   virtual void setTimeout( DtTime tm );

   virtual bool dataScaling() const;
   virtual void setDataScaling( bool onOff );

   virtual DtLgrFilePosition filePos() const;
   virtual void setFilePos( DtLgrFilePosition pos );

   virtual DtLgrMode mode() const;
   virtual void setMode( DtLgrMode md );

   virtual DtLgrMode playAction() const;
   virtual void setPlayAction( DtLgrMode md );

   virtual DtLgrMode recordAction() const;
   virtual void setRecordAction( DtLgrMode md );

   virtual DtLgrMode eofAction() const;
   virtual void setEofAction( DtLgrMode md );

   virtual bool timeConstrained() const;
   virtual void setTimeConstrained( bool onOff );

   virtual bool timeRegulated() const;
   virtual void setTimeRegulated( bool onOff );

   virtual bool usingOwnFedAmb() const;
   virtual void setUsingOwnFedAmb( bool onOff );

   virtual const char* lgrFile() const;
   virtual void setLgrFile( const DtString& name );

   virtual const char* annotationsFile() const;
   virtual void setAnnotationsFile( const DtString& name );

   //! Print contents.
   virtual void printDataToStream(std::ostream& stream) const;

protected:
   //! Used by constructors and such...
   void initData();

   //! Return correctly casted parameters pointer; see lgrControlP.h.
   virtual DtLgrStateDesc* params() const;
};


