Esempio n. 1
0
//--------------------------------------------------------------
static void release(ofLight & light){
	int id = light.getLightID();
	if(id==-1) return;
	bool lastRef=false;
	if(getIds().find(id)!=getIds().end()){
		getIds()[id]--;
		if(getIds()[id]==0){
			lastRef=true;
			getIds().erase(id);
		}
	}else{
		ofLog(OF_LOG_WARNING,"ofLight: releasing id not found, this shouldn't be happening releasing anyway");
		lastRef=true;
	}
	if(lastRef){
		light.setAmbientColor(ofColor(0,0,0,255));
		if(id>0){
			light.setDiffuseColor(ofColor(0,0,0,255));
			light.setSpecularColor(ofColor(0,0,0,255));
		}else{
			light.setDiffuseColor(ofColor(255,255,255,255));
			light.setSpecularColor(ofColor(255,255,255,255));
		}
		GLfloat cc[] = {0,0,1, 0};
		glLightfv(GL_LIGHT0 + id, GL_POSITION, cc);

		light.disable();
		getActiveLights()[id] = false;
	}
}
//--------------------------------------------------------------
static void retain(GLuint id){
	if(id==0) return;
	if(getIds().find(id)!=getIds().end()){
		getIds()[id]++;
	}else{
		getIds()[id]=1;
	}
}
Esempio n. 3
0
//--------------------------------------------------------------
static void retain(int id){
	if(id==-1) return;
	getActiveLights()[id] = true;
	if(getIds().find(id)!=getIds().end()){
		getIds()[id]++;
	}else{
		getIds()[id]=1;
	}
}
Esempio n. 4
0
//--------------------------------------------------------------
static void release(GLuint id){
	if(getIds().find(id)!=getIds().end()){
		getIds()[id]--;
		if(getIds()[id]==0){
			glDeleteBuffers(1, &id);
			getIds().erase(id);
		}
	}else{
		ofLogWarning("ofVbo") << "release(): something's wrong here, releasing unkown vertex buffer object id " << id;
		glDeleteBuffers(1, &id);
	}
}
//--------------------------------------------------------------
static void release(GLuint id){
	if(getIds().find(id)!=getIds().end()){
		getIds()[id]--;
		if(getIds()[id]==0){
			glDeleteBuffers(1, &id);
			getIds().erase(id);
		}
	}else{
		ofLog(OF_LOG_WARNING,"ofVbo: releasing id not found, this shouldn't be happening releasing anyway");
		glDeleteBuffers(1, &id);
	}
}
void IdentityRequest::onRequestOntologyIds(std::shared_ptr<Message> const &message)
{
  if (this->stateIR == IdentityRequestState::IRS_UNKNOWN)
  {
    _log->warn("Received ids message in wrong state '%v' from '%v'", this->stateIR, entity->toString());
    return;
  }

  // duplicated message
  if (this->stateIR == IdentityRequestState::IRS_REQUEST_ONT_IRI && false == this->timeFactory->checkTimeout(this->timestampLastActive, 100))
  {
    _log->debug("Received duplicated ids message from '%v'", entity->toString());
    return;
  }

  _log->info("Sending ontology ids to %v", this->entity->toString());
  this->updateActiveTime();
  this->stateIR = IdentityRequestState::IRS_RESPONS_ONT_IRI;

  // create and send system specification
  auto msg = std::make_shared<OntologyIdMessage>();
  this->ontologyInterface->getOntologyIDs(msg->getIds());

  this->send(msg);
}
Esempio n. 7
0
void Camera::print()
{
    cout << "- Camera - Base" << endl;
    cout << "| ID: " << getID() << endl;
    cout << "| ids: " << getIds() << endl;
    cout << "| near: " << getZNear() << endl;
    cout << "| far: " << getZFar() << endl;
}
Esempio n. 8
0
void CommunicationInterface::onRequestIds(std::shared_ptr<Entity> const &entity)
{
  _log->info("Sending Ids to '%v'", entity->toString());
  auto m = std::make_shared<IdMessage>();
  m->setEntity(entity);
  this->self->pushIds(m->getIds());

  this->pushMessage(m);
}
Esempio n. 9
0
void MaxEntTrainer::Add_Event(EventSet &events, const char *name, const char *data)
{
	const string delims(" ");

	MaxEntEvent	*event	= new MaxEntEvent;
	getIds(data, *event, delims);
	event->classId(getClassId(name));
	event->count(1);
	events.push_back(event);
}
Esempio n. 10
0
  void		shoot(IEntity *entity)
  {
	Ship	*tmp;

	if (entity->getType() == SHIP)
	  {
	tmp = (Ship *)entity;
		if (tmp->isShooting() == true)
		  add(new Weapon(entity, getIds()));
	  }
  }
Esempio n. 11
0
void CNodeDefManager::mapNodeboxConnections()
{
	for (ContentFeatures &f : m_content_features) {
		if (f.drawtype != NDT_NODEBOX || f.node_box.type != NODEBOX_CONNECTED)
			continue;

		for (const std::string &name : f.connects_to) {
			getIds(name, f.connects_to_ids);
		}
	}
}
Esempio n. 12
0
void Perspective::print()
{
    cout << "- Camera - Perspective" << endl;
    cout << "| ID: " << getID() << endl;
    cout << "| ids: " << getIds() << endl;
    cout << "| pos: {" << getPos()[0] << ", "<< getPos()[1]<< ", " << getPos()[2] << "}" << endl;
    cout << "| near: " << getZNear() << endl;
    cout << "| far: " << getZFar() << endl;
    cout << "| angle: " << getAngle() << endl;
    cout << "| target: {" << getTarget()[0] << ", "<< getTarget()[1] << ", " << getTarget()[2] << "}" << endl;
}
Esempio n. 13
0
void CNodeDefManager::mapNodeboxConnections()
{
	for (u32 i = 0; i < m_content_features.size(); i++) {
		ContentFeatures *f = &m_content_features[i];
		if ((f->drawtype != NDT_NODEBOX) || (f->node_box.type != NODEBOX_CONNECTED))
			continue;
		for (std::vector<std::string>::iterator it = f->connects_to.begin();
				it != f->connects_to.end(); ++it) {
			getIds(*it, f->connects_to_ids);
		}
	}
}
Esempio n. 14
0
void MaxEntTrainer::readEvents(istream& istrm, EventSet& events)
{
  string line, cls;
  const string delims(" ");
  while ((istrm>>cls) && getline(istrm, line)) {
    MaxEntEvent* event = new MaxEntEvent;
    getIds(line, *event, delims);
    event->classId(getClassId(cls));
    event->count(1);
    events.push_back(event);
  }
}
Esempio n. 15
0
// See comment on Cluster::setMgmtStatus
void Cluster::updateMgmtMembership(Lock& l) {
    if (!mgmtObject) return;
    std::vector<Url> urls = getUrls(l);
    mgmtObject->set_clusterSize(urls.size());
    string urlstr;
    for(std::vector<Url>::iterator i = urls.begin(); i != urls.end(); i++ ) {
        if (i != urls.begin()) urlstr += ";";
        urlstr += i->str();
    }
    std::vector<string> ids = getIds(l);
    string idstr;
    for(std::vector<string>::iterator i = ids.begin(); i != ids.end(); i++ ) {
        if (i != ids.begin()) idstr += ";";
        idstr += *i;
    }
    mgmtObject->set_members(urlstr);
    mgmtObject->set_memberIDs(idstr);
}
Esempio n. 16
0
    bool AddressbookHandler::readSyncee(KSync::AddressBookSyncee *mAddressBookSyncee, bool firstSync)
    {
        bool ret = false;

        getIds();

        KABC::Addressee::List modifiedList;
        if (firstSync) {
            this->setMaximumSteps((ids.changedIds.size() + ids.unchangedIds.size()));
            if (!getAddresseeListFromDevice(modifiedList, PocketPCCommunication::UNCHANGED | PocketPCCommunication::CHANGED)) {
                setError("Can not retrieve unchanged Contacts from the Device");
                goto error;
            }
        } else {
            this->setMaximumSteps(ids.changedIds.size());
            if (!getAddresseeListFromDevice(modifiedList, PocketPCCommunication::CHANGED)) {
                setError("Can not retrieve changed Contacts from the Device");
                goto error;
            }

            KABC::Addressee::List removedList;
            if (!getAddresseeListFromDevice(removedList, PocketPCCommunication::DELETED)) {
                setError("Can not retrieve deleted Contacts from the Device");
                goto error;
            }
            insertIntoAddressBookSyncee(mAddressBookSyncee, removedList, KSync::SyncEntry::Removed);
        }
        insertIntoAddressBookSyncee(mAddressBookSyncee, modifiedList, KSync::SyncEntry::Modified);

        mAddressBookSyncee->setTitle("SynCEAddressbook");
        mAddressBookSyncee->setIdentifier(m_pdaName + "-Addressbook");

        ret = true;

    error:
        return ret;
    }
Esempio n. 17
0
void IdentityRequest::onRequestIds(std::shared_ptr<Message> const &message)
{
  if (this->stateIR != IdentityRequestState::IRS_UNKNOWN && this->stateIR != IdentityRequestState::IRS_REQUEST_IDS)
  {
    // received message in wrong state
    _log->warn("Received requestIds message in wrong state '%v' from '%v'", this->stateIR, entity->toString());
    return;
  }
  else if (this->stateIR == IdentityRequestState::IRS_REQUEST_IDS &&
      false == this->timeFactory->checkTimeout(this->timestampLastActive, 100))
  {
    // duplicated message
    _log->debug("Received duplicated requestIds message from '%v'", entity->toString());
    return;
  }

  _log->info("Sending Ids to '%v'", entity->toString());
  this->updateActiveTime();
  this->stateIR = IdentityRequestState::IRS_RESPONS_IDS;

  auto m = std::make_shared<IdMessage>();
  this->self->pushIds(m->getIds());
  this->send(m);
}
std::vector<std::string> LLVMModelDataSymbols::getBoundarySpeciesIds() const
{
    return getIds(boundarySpeciesMap);
}
std::vector<std::string> LLVMModelDataSymbols::getReactionIds() const
{
    return getIds(reactionsMap);
}
std::vector<std::string> LLVMModelDataSymbols::getGlobalParameterIds() const
{
    return getIds(globalParametersMap);
}
std::vector<std::string> LLVMModelDataSymbols::getFloatingSpeciesIds() const
{
    return getIds(floatingSpeciesMap);
}
Esempio n. 22
0
inline int GenabelPhenoData::nb_samples() const { return getIds().size(); }
std::vector<std::string> LLVMModelDataSymbols::getCompartmentIds() const
{
    return getIds(compartmentsMap);
}
Esempio n. 24
0
std::vector<string> Cluster::getIds() const {
    Lock l(lock);
    return getIds(l);
}