示例#1
0
void routine::removeGroup(tileGroup* g) {
	int index = getGroupIndex(g);
    list<tileGroup>::iterator it = groups.begin();
	if (index >= 0) {
		advance(it, index);
		groups.erase(it);
	}
}
	ImageIndexInfo ResourceImageSet::getIndexInfo(const IntSize & _group, size_t _index)
	{
		size_t index_group = getGroupIndex(_group);
		if (index_group != ITEM_NONE) {
			GroupImage & group = mGroups[index_group];
			if (_index < group.indexes.size()) {
				IndexImage & index = group.indexes[_index];
				return ImageIndexInfo(group.texture, group.size, index.rate, index.frames);
			}
		}
		return ImageIndexInfo(mTextureEmpty, mSizeEmpty, 0, mFramesEmpty);
	}
示例#3
0
void DataEventMemBase::bindData()
{
	m_poData1 = NULL;
	m_poData2 = NULL;
	m_poIndex1 = NULL;	
	m_poIndex2 = NULL;
	m_poIns1 = NULL;
	m_poIns2 = NULL;
	
	//数据e8及商务领航帐号
	if (m_iGroupID == E8_USER_MEM_GRP)
	{
		m_poE8AccountIns = (DataE8AccountInfo *)(*m_poE8AccountData);
		return;
	}
	
	//4008、800等ext_serv
	if (m_iGroupID == EXT_SERV_MEM_GRP)
	{
		m_poExtServIns = (ExtServ *)(*m_poExtServData);
		return;
	}
	
	//宽带话单拆分
	getGroupIndex();
	m_poIns1 = (DataEventDiv *)(*m_poData1);
	m_poIns2 = (DataEventDiv *)(*m_poData2);

	

/*	//第一组
	if (m_iGroupID == 1)
	{
		m_poDataEventDivIns11 = (DataEventDiv *)(*m_poDataEventDivData11);
		m_poDataEventDivIns12 = (DataEventDiv *)(*m_poDataEventDivData12);
	}
	
	//第二组
	if (m_iGroupID == 2)
	{
		m_poDataEventDivIns21 = (DataEventDiv *)(*m_poDataEventDivData21);
		m_poDataEventDivIns22 = (DataEventDiv *)(*m_poDataEventDivData22);
	}

	//第三组
	if (m_iGroupID == 3)
	{
		m_poDataEventDivIns31 = (DataEventDiv *)(*m_poDataEventDivData31);
		m_poDataEventDivIns32 = (DataEventDiv *)(*m_poDataEventDivData32);
	}
*/
}
	ImageIndexInfo ResourceImageSet::getIndexInfo(const std::string & _group, const std::string & _index)
	{
		size_t index_group = getGroupIndex(_group);
		if (index_group != ITEM_NONE) {
			GroupImage & group = mGroups[index_group];
			size_t index_image = getImageIndex(group, _index);
			if (index_image != ITEM_NONE) {
				IndexImage & index = group.indexes[index_image];
				return ImageIndexInfo(group.texture, group.size, index.rate, index.frames);
			}
		}
		return ImageIndexInfo(mTextureEmpty, mSizeEmpty, 0, mFramesEmpty);
	}
		bool delete_control_group_cb(dynamic_gazebo_models::DeleteGroup::Request &req, dynamic_gazebo_models::DeleteGroup::Response &res)
		{
			int groupIndex = getGroupIndex(req.group_name);

			if (groupIndex == INDEX_NOT_FOUND) {
				ROS_WARN("Delete Group Service: The specified group does not exist");
				return false;
			}

			groups.erase(groups.begin() + groupIndex);

			return true;
		}
	ImageIndexInfo ResourceImageSet::getIndexInfo(const std::string& _group, size_t _index)
	{
		size_t index_group = getGroupIndex(_group);
		if (index_group != ITEM_NONE)
		{
			GroupImage& group = mGroups[index_group];
			if (_index < group.indexes.size())
			{
				IndexImage& index = group.indexes[_index];
				return ImageIndexInfo(group.texture, group.size, index.rate, index.frames);
			}
		}
		return ImageIndexInfo(Constants::getEmptyString(), Constants::getZeroIntSize(), 0, mFramesEmpty);
	}
		bool add_control_group_cb(dynamic_gazebo_models::AddGroup::Request &req, dynamic_gazebo_models::AddGroup::Response &res)
		{	
			GroupType type = parseGroupType(req.group.type);

			if (type == INVALID) {
				ROS_ERROR("Add Group Service Failed: Invalid group type");
				return false;
			}

			// Check if there is an exiting group with the same name, which might cause conflicts:			
			int groupIndex = getGroupIndex(req.group.group_name);
			if (groupIndex != INDEX_NOT_FOUND) {
				ROS_ERROR("Add Group Service Failed: The specified group name already exists");
				return false;				
			}

			ControlGroup group(req.group.group_name, type, req.group.active_units);
			groups.push_back(group);

			return true;
		}
		bool activateElevators(std::string group_name)
		{
			int groupIndex = getGroupIndex(group_name);

			if (groupIndex == INDEX_NOT_FOUND) {
				ROS_ERROR("Elevator Service Failed: The specified group does not exist");
				return false;
			}

			ControlGroup currGroup = groups.at(groupIndex);

			if (currGroup.getType() != ELEVATOR) {
				ROS_ERROR("Elevato Service Failed: This group type doesn't support this call");
				return false;
			}

			std_msgs::UInt32MultiArray active_elevs = uintVectorToStdMsgs(currGroup.getActiveUnits());
			elev_active_pub.publish(active_elevs);

			return true;
		}
示例#9
0
void DataEventMemBase::freeAll()
{
	#define FREE(X) \
		if (X) { \
		delete X; \
		X = 0; \
		}

	//数据e8及商务领航帐号
	FREE(m_poE8AccountData);
	FREE(m_poE8AccountIndex);
	
	//宽带话单分拆
	getGroupIndex();
	FREE(m_poData1);
	FREE(m_poData2);
	FREE(m_poIndex1);
	FREE(m_poIndex2);

	FREE(m_poExtServData);
	FREE(m_poExtServIndex);
/*	//第一组
	FREE(m_poDataEventDivData11);
	FREE(m_poDataEventDivIndex11);
	FREE(m_poDataEventDivData12);
	FREE(m_poDataEventDivIndex12);

	//第二组
	FREE(m_poDataEventDivData21);
	FREE(m_poDataEventDivIndex21);
	FREE(m_poDataEventDivData22);
	FREE(m_poDataEventDivIndex22);

	//第三组
	FREE(m_poDataEventDivData31);
	FREE(m_poDataEventDivIndex31);
	FREE(m_poDataEventDivData32);
	FREE(m_poDataEventDivIndex32);
*/	
}
		bool activateDoors(std::string group_name)
		{
			int groupIndex = getGroupIndex(group_name);

			if (groupIndex == INDEX_NOT_FOUND) {
				ROS_ERROR("Door Service Failed: The specified group does not exist");
				return false;
			}

			ControlGroup currGroup = groups.at(groupIndex);

			if (currGroup.getType() != DOOR) {
				ROS_ERROR("Door Service Failed: This group type doesn't support this call");
				return false;
			}

			// Publish the IDs of the active doors in the group
			std_msgs::UInt32MultiArray active_doors = uintVectorToStdMsgs(currGroup.getActiveUnits());
			door_active_pub.publish(active_doors);

			return true;
		}