/*!
 * \file CategoryInfo.cpp
 * \brief
 * \author Gapchich Vladislav
 * \date 23/10/11
 */

#include "vislearning/cbaselib/CategoryInfo.h"

using namespace OBJREC;
using namespace std;

//! A constructor
CategoryInfo::CategoryInfo()
{
	category_name_.clear();
	id_ = -1;
	color_ = 0;
	is_main_ = 0;
}

//! A copy-constructur
CategoryInfo::CategoryInfo(const CategoryInfo &copy)
{
	category_name_ = copy.categoryName();
	color_ = copy.color();
	id_ = copy.id();
	is_main_ = copy.isMain();
}

//! A desctructor
CategoryInfo::~CategoryInfo()
{
	
}

//! Sets category name(label)
/*!
 * \param[in] aCategoryName should not be empty otherwise member does nothing. 
 */
void 
CategoryInfo::setCategoryName(const std::string &aCategoryName)
{
	if (aCategoryName.empty()) {
		return;
		/* NOTREACHED */
	}
	
	category_name_ = aCategoryName;
}

//! Sets category ID(label ID)
/*!
 * \param[in] anID should not be negative otherwise id_ becomes -1
 */
void 
CategoryInfo::setID(const int &anID)
{
	if (anID < 0) {
		id_ = -1;
		return;
		/* NOTREACHED */
	}
	
	id_ = anID;
}

//! Sets the color of a category
/*!
 * \param[in] aColor is unsigned in which can be translated into ARGB
 * like 0xAARRBBGG
 */
void 
CategoryInfo::setColor(const unsigned int &aColor)
{
	color_ = aColor;
}

//! Sets category priority
/*!
 * \param[in] aMain is a flag indicating whether current label is main or not
 */
void 
CategoryInfo::setMain(bool aMain)
{
	is_main_ = aMain;
}

//! returns category name(label name)
std::string
CategoryInfo::categoryName() const
{
	return category_name_;
}

//!  returns category ID(label ID)
int 
CategoryInfo::id() const
{
	return id_;
}

//! \brief returns unsigned int indicating category color which can 
//! be translated into ARGB like 0xAARRBBGG
unsigned int 
CategoryInfo::color() const
{
	return color_;
}

//! returns is_main_ flag
bool 
CategoryInfo::isMain() const
{
	return is_main_;
}

/*
 * 
 */
