Exemplo n.º 1
0
static void addStock(const stock& s)
{
	unsigned int	usedIndex, hashIndex, symbolHash, chainLgth;

	if (hm.put(s, symbolHash, hashIndex, usedIndex, chainLgth)) {
		cout << "added " << left << setw(8) << s.getSymbol();
		printAdditional(symbolHash, hashIndex, usedIndex, chainLgth);
		}
	else
		cout << s.getSymbol() << " not added" << endl;
}
Exemplo n.º 2
0
void ResourceProviderManagerProcess::subscribe(
    const HttpConnection& http,
    const Call::Subscribe& subscribe)
{
  ResourceProviderInfo resourceProviderInfo =
    subscribe.resource_provider_info();
  resourceProviderInfo.mutable_id()->CopyFrom(newResourceProviderId());

  ResourceProvider resourceProvider(resourceProviderInfo, http);

  Event event;
  event.set_type(Event::SUBSCRIBED);
  event.mutable_subscribed()->mutable_provider_id()->CopyFrom(
      resourceProvider.info.id());

  if (!resourceProvider.http.send(event)) {
    LOG(WARNING) << "Unable to send event to resource provider "
                 << stringify(resourceProvider.info.id())
                 << ": connection closed";
  }

  resourceProviders.put(resourceProviderInfo.id(), std::move(resourceProvider));
}