Exemplo n.º 1
0
C4Network2Res::Ref C4Network2ResList::AddByCore(const C4Network2ResCore &Core, bool fLoad) // by main thread
{
	// already in list?
	C4Network2Res::Ref pRes = getRefRes(Core.getID());
	if (pRes) return pRes;
#ifdef C4NET2RES_LOAD_ALL
	// load without check (if possible)
	if (Core.isLoadable()) return AddLoad(Core);
#endif
	// create new
	pRes = new C4Network2Res(this);
	// try set by core
	if (!pRes->SetByCore(Core, true))
	{
		pRes.Clear();
		// try load (if specified)
		return fLoad ? AddLoad(Core) : NULL;
	}
	// log
	Application.InteractiveThread.ThreadLogS("Network: Found identical %s. Not loading.", pRes->getCore().getFileName());
	// add to list
	Add(pRes);
	// ok
	return pRes;
}
Exemplo n.º 2
0
void Workspace::AddUses(Package& p, bool match, const Vector<String>& flag)
{
	int q = package.GetCount();
	for(int i = 0; i < p.uses.GetCount(); i++) {
		String uses = UnixPath(p.uses[i].text);
		if((!match || MatchWhen(p.uses[i].when, flag)) && package.Find(uses) < 0)
			AddLoad(uses, match, flag);
	}
	for(int i = q; i < package.GetCount(); i++)
		AddUses(package[i], match, flag);
}
int MBSObjectFactory::AddObject(MBSObjectFactoryClass objectClass, int objectTypeId)
{
	switch(objectClass)
	{
	case OFCElement: return AddElement(objectTypeId);		// AddElement is generated automatically
	case OFCSensor: return AddSensor(objectTypeId);
	case OFCNode: return AddNode(objectTypeId); 
	case OFCLoad: return AddLoad(objectTypeId);
	case OFCMaterial:	return AddMaterial(objectTypeId);
	case OFCBeamProperties:	return AddBeamProperties(objectTypeId);
	case OFCGeomElement: return AddGeomElement(objectTypeId);
	}
	assert(0);
	return -1;
}
Exemplo n.º 4
0
void Workspace::Scan(const char *prjname, const Vector<String>& flag) {
	package.Clear();
	AddLoad(prjname, true, flag);
	AddUses(package[0], true, flag);
}
Exemplo n.º 5
0
void Workspace::Scan(const char *prjname) {
	package.Clear();
	AddLoad(prjname, false, Vector<String>());
	AddUses(package[0], false, Vector<String>());
}