//--------------------------------------------------------------------------------
// <copyright file="SensorProgramSettings_Version.cpp" company="LiquidRobotics">
//
// Copyright (c) 2014 Liquid Robotics, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This software is associated with a release.  Liquid Robotics makes no
// representation that the design, interfaces or component distribution will
// remain unchanged in future releases.
//
// </copyright>
//
// <summary>
//   Implementation of SensorProgramSettings::Version class, a serializable entity
//	 that holds the settings for a reported version number.
// </summary>
//
// <owner>Mike Cookson</owner>
//--------------------------------------------------------------------------------

#include "SensorProgramSettings.h"
#include <sstream>

using namespace std;
using namespace LiquidRobotics::SMACFramework;
using namespace LiquidRobotics::EventLib;

namespace LiquidRobotics {
namespace EventLib {

SensorProgramSettings::Version::Version()
: majorVer(0)
, minorVer(0)
, subminorVer(0)
{
}

SensorProgramSettings::Version::Version(const SensorProgramSettings::Version& rhs)
: majorVer(rhs.majorVer)
, minorVer(rhs.minorVer)
, subminorVer(rhs.subminorVer)
{
}

SensorProgramSettings::Version& SensorProgramSettings::Version::operator=(const Version& rhs)
{
	if (this != &rhs)
	{
		majorVer = rhs.majorVer;
		minorVer = rhs.minorVer;
		subminorVer = rhs.subminorVer;
	}

	return *this;
}

int SensorProgramSettings::Version::GetMajor() const
{
	return majorVer;
}

void SensorProgramSettings::Version::SetMajor(int newValue)
{
	majorVer = newValue;
}

int SensorProgramSettings::Version::GetMinor() const
{
	return minorVer;
}

void SensorProgramSettings::Version::SetMinor(int newValue)
{
	minorVer = newValue;
}

int SensorProgramSettings::Version::GetSubMinor() const
{
	return subminorVer;
}

void SensorProgramSettings::Version::SetSubMinor(int newValue)
{
	subminorVer = newValue;
}

string SensorProgramSettings::Version::ToString() const
{
	stringstream msg;
	msg << majorVer << "." << minorVer << "." << subminorVer;

	return msg.str();
}

}
}
