/******************************************************************************
** Copyright (c) 2009 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/

//! \file DtModelSetRealizationsRecord.h
//! \brief Contains makArchives::DtModelSetRealizationsRecord class.
//! \ingroup makArchives

#pragma once

#include <makArchives/makArchives.h>
#include <makArchives/DtModelSetRealizationRecord.h>

#include <vector>

namespace makArchives
{
   //! \brief DtModelSetRealizationsRecord is the serializable record used to
   //! read and write a vector of modelSet / flag pairs that indicate whether or not
   //! a model set is realized
   //! \ingroup makArchives
   class DT_DLL_MAKARCHIVES DtModelSetRealizationsRecord
   {
   public:
   
      // A list of visual mode records
      typedef std::vector<DtModelSetRealizationRecord> ModelSetRealizationRecords;      

      //! \brief CTOR
      DtModelSetRealizationsRecord();
      
      //! \brief Copy constructor
      DtModelSetRealizationsRecord( const DtModelSetRealizationsRecord& orig );
      
      //! \brief DTOR
      virtual ~DtModelSetRealizationsRecord();  
      
      //! \brief Assignment operator
      DtModelSetRealizationsRecord& operator=( const DtModelSetRealizationsRecord& orig );
      
      const ModelSetRealizationRecords& modelSetRealizations() const;
      
      void addModelSetRealization( int modelSet, bool realized );

        
   protected:
      friend class boost::serialization::access;
      
      template <typename Archive>
      void serialize(Archive& ar,unsigned int version)
      {
         if(version == 0)
         {
            std::list<DtModelSetRealizationRecord> tmp;
            ar & boost::serialization::make_nvp("myModelSetRealizations", tmp);
            myModelSetRealizations.clear();
            std::copy(tmp.begin(),tmp.end(),std::back_inserter(myModelSetRealizations));
         }
         if(version >= 1)
         {
            ar & BOOST_SERIALIZATION_NVP(myModelSetRealizations);
         }
      }
      
   protected:
      // A vector, by ObserverMode, of ModelSetLists
      ModelSetRealizationRecords myModelSetRealizations;
   };
}

BOOST_CLASS_VERSION(makArchives::DtModelSetRealizationsRecord,1)


