src/tools/yarp-service/LocalNameServer.cpp
int services::take_ref(const YARPString &name, YARPString &ip, int *type, PORT_LIST &ports)
{
	SVC_IT it(*this);
	if(find_service(name, it) != -1)
	{
		bool ref = true;
		// ref = it->take_ref();	// use ref count
		ip = (*it).ip;
		ports = (*it).ports;
		*type = (*it).type;

		if (ref)
			return 1;	// found, resources avaiable
		else
			return 0;	// found, no more resources
	}
	else
	{
		return -1;		// not found
	}
	
}
// check if reference exits; return ip and ports associated with a particular name
// increase reference count returns:
// > 0, found, resources av.
// 0, found, resoursec not av.
// < 0, not found
check if reference exits; return ip and ports associated with a particular name
increase reference count returns:
> 0, found, resources av.
0, found, resoursec not av.
< 0, not found
check if reference exits ; return ip and ports associated with a particular name increase reference count returns : > 0 found resources av . 0 found resoursec not av . < 0 not found
int services::take_ref(const YARPString &name, YARPString &ip, int *type, PORT_LIST &ports)
{
	SVC_IT it(*this);
	if(find_service(name, it) != -1)
	{
		bool ref = true;
		ip = (*it).ip;
		ports = (*it).ports;
		*type = (*it).type;
		if (ref)
			return 1;	
		else
			return 0;	
	}
	else
	{
		return -1;		
	}
}
int services :: take_ref ( const YARPString & name , YARPString & ip , int * type , PORT_LIST & ports ) { SVC_IT it ( * this ) ; if ( find_service ( name , it ) != -1 ) { bool ref = true ; ip = ( * it ) . ip ; ports = ( * it ) . ports ; * type = ( * it ) . type ; if ( ref ) return 1 ; else return 0 ; } else { return -1 ; } }
check if reference exits; return ip and ports associated with a particular name
increase reference count returns:
> 0, found, resources av.
check if reference exits ; return ip and ports associated with a particular name increase reference count returns : > 0 found resources av .
// ref = it->take_ref();	// use ref count // found, resources avaiable // found, no more resources // not found