//-------------------------------------------------------------------------------------------------
// <copyright file="SEControllerSettings.h" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved. 
// </copyright>
//
// <summary>
// 	Declarations for SEControllerSettings, a serializable entity that holds the
//  settings for an example sensor controller class.
// </summary>
//
// <owner>Mike Cookson</owner>
//-------------------------------------------------------------------------------------------------

#ifndef __SEControllerSettings_h__
#define __SEControllerSettings_h__

#include "LqrSMACSerialListenerSettings.h"
#include "LqrSMACSerialPortSettings.h"
#include "LqrSMACSharedLib.h"
#include <map>
#include <string>
#include <boost/serialization/access.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/version.hpp>

namespace LiquidRobotics {
namespace SensorExample {

class SHARED_LIB_PUBLIC SEControllerSettings
{
public:

	typedef LiquidRobotics::SMACFramework::SerialListenerSettings SerialListenerSettings;
	typedef LiquidRobotics::SMACFramework::SerialPortSettings SerialPortSettings;
	typedef std::string string;

	SEControllerSettings();
	SEControllerSettings(const SEControllerSettings& rhs);

	SEControllerSettings& operator=(const SEControllerSettings& rhs);

	const SerialListenerSettings& GetSerialListenerSettings() const;
	void SetSerialListenerSettings(const SerialListenerSettings& newValue);

	const SerialPortSettings& GetSerialPortSettings() const;
	void SetSerialPortSettings(const SerialPortSettings& newValue);

	void Load(const string& fileName, bool withMD5 = false);
	void Save(const string& fileName, bool withMD5 = false) const;

private:

	friend class boost::serialization::access;

	template<class Archive>
	void load(Archive & ar, const unsigned int version)
	{
		ar >> BOOST_SERIALIZATION_NVP(listenerSettings);
		ar >> BOOST_SERIALIZATION_NVP(serialPortSettings);
	}

	template<class Archive>
	void save(Archive & ar, const unsigned int version) const
	{
		ar << BOOST_SERIALIZATION_NVP(listenerSettings);
		ar << BOOST_SERIALIZATION_NVP(serialPortSettings);
	}

	BOOST_SERIALIZATION_SPLIT_MEMBER()

	SerialListenerSettings listenerSettings;
	SerialPortSettings serialPortSettings;
};

}
}

BOOST_CLASS_VERSION(LiquidRobotics::SensorExample::SEControllerSettings, 1)

#endif
