Exemplo n.º 1
0
// An entry has associated with it an operation that can be performed locally
// for an id.  The operation to be taken is lazily determined.  Initially
// the operation is 0. Every Id has at least one 'home' node that can be 
// determined via the id's 'home' function.  The home function is also lazily resolved
// via a default home lookup function.   The operation can be replicated from it's home
// node by the value's replicated function.  All functions may choose to cache
// a NULL or actually value to control if the assoicated function should be taken 
// repeately.  
replicate(id_t id, value_t v) 
{
  // home nodes shouls always have a non-zero replicate field
  if (v->w3.replicated) return v->w3.replicate(id, v, myNode());
  else {
    node_t h;
    if (v->w2.home) h = v->w2.home(id, v);
    else h = defhome(id, v);
    // now that we have a home ask it to replicate the value
    return remoteReplicate(h, id, v, myNode());
  }
}
Exemplo n.º 2
0
void OgrWriter::writePartial(const boost::shared_ptr<const hoot::Node>& newNode)
{
  // Add to the element cache
  ConstElementPtr myNode(newNode);
  _elementCache->addElement(myNode);
  ElementProviderPtr cacheProvider(_elementCache);

  // It's a base datatype, so can write immediately

  //LOG_DEBUG("Writing node " << newNode->getId() << " as it's in our range");

  _writePartial(cacheProvider, newNode);
}
Exemplo n.º 3
0
/**
 * Wrapper function, that does the ack. Other functions also use the
 * inner function to build message trees, so we don't want it to emit
 * multiple acks.
 */
void Shell::handleAddMsg( const Eref& e,
	string msgType, ObjId src, string srcField, 
	ObjId dest, string destField, unsigned int msgIndex )
{
		// Node 0 will have already called innerAddMsg to get the msgIndex
	if ( myNode() != 0 )
		innerAddMsg( msgType, src, srcField, dest, destField, msgIndex );
	/*
	if ( innerAddMsg( msgType, src, srcField, dest, destField ) )
		ack()->send( Eref( shelle_, 0 ), Shell::myNode(), OkStatus );
	else
		ack()->send( Eref( shelle_, 0), Shell::myNode(), ErrorStatus );
	*/
}
Exemplo n.º 4
0
void OgrWriter::writePartial(const boost::shared_ptr<const hoot::Node>& newNode)
{
  // Add to the element cache
  ConstElementPtr myNode(newNode);
  _elementCache->addElement(myNode);
  ElementProviderPtr cacheProvider(_elementCache);

  // It's a base datatype, so can write immediately

  //LOG_DEBUG("Writing node: \n" << newNode->toString());

  // DEBUG ONLY REMOVE -- if we're not Queen Anne's county, MD, bail
  /*
  if ( newNode->getId() > -642 || newNode->getId() < -733)
  {
    return;
  }
  */

  //LOG_INFO("Writing node " << newNode->getId() << " as it's in our range");

  _writePartial(cacheProvider, newNode);
}
Exemplo n.º 5
0
void BeHappy::SearchAddOns()
{
	// on vide les listes
	{
		BPath *p;
		while ((p=(BPath*)addOnsPaths.RemoveItem((int32)0))!=NULL)
			delete p;
			
		BString *s;
		while ((s=(BString*)addOnsNames.RemoveItem((int32)0))!=NULL)
			delete s;
	}
		
	// d'abord on cherche le dossier
	app_info myInfo;
	be_app->GetAppInfo(&myInfo);
	BEntry appEntry(&(myInfo.ref));
	BDirectory addOnsDir;
	appEntry.GetParent(&addOnsDir);
	
	// parcours de tous les fichiers du dossier
	if (addOnsDir.SetTo(&addOnsDir,"Add-ons")==B_OK)
	{
		BEntry addOn;
		while (addOnsDir.GetNextEntry(&addOn,true) == B_OK)
		{
			BPath *addOnPath = new BPath;
			addOn.GetPath(addOnPath);
			// extraction du type MIME
			{
				BNode myNode(&addOn);
								
				BNodeInfo myNodeInfo(&myNode);
				char mimeType[256];
				myNodeInfo.GetType(mimeType);
				if (BString("application/x-vnd.Be-elfexecutable") != mimeType)
					continue;
			}
			
			// on est sûrs que c'est un Add-on
			BString *projName = new BString;
			if (CheckAddOn(addOnPath->Path(),true,projName))
			{
				addOnsPaths.AddItem(addOnPath);
				addOnsNames.AddItem(projName);
			}
			else
			{
				delete addOnPath;
				delete projName;
			}
			
			// si c'est la première fois que SearchAddOns est appelé, on doit activer le node monitor
			if (!addOnsSearched)
			{
				addOnsSearched = true;
				
				node_ref myRef;
				addOnsDir.GetNodeRef(&myRef);
				watch_node(&myRef,B_WATCH_DIRECTORY,be_app_messenger);
			}
		}
	}
	else
	{
		BAlert *myAlert = new BAlert("BeHappy",T("Can't find Add-ons folder"),
			"Quit",NULL,NULL,B_WIDTH_AS_USUAL,B_STOP_ALERT);
		
		myAlert->Go();
		PostMessage(B_QUIT_REQUESTED);
	}
}