예제 #1
0
파일: struct.c 프로젝트: denis-sh/dmd
void AggregateDeclaration::semantic3(Scope *sc)
{
    //printf("AggregateDeclaration::semantic3(%s)\n", toChars());
    if (members)
    {
        sc = sc->push(this);
        for (size_t i = 0; i < members->dim; i++)
        {
            Dsymbol *s = (*members)[i];
            s->semantic3(sc);
        }
        sc->pop();

        if (!getRTInfo)
        {   // Evaluate: gcinfo!type
            Objects *tiargs = new Objects();
            tiargs->push(type);
            TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
            ti->semantic(sc);
            ti->semantic2(sc);
            ti->semantic3(sc);
            Dsymbol *s = ti->toAlias();
            Expression *e = new DsymbolExp(0, s, 0);
            e = e->semantic(ti->tempdecl->scope);
            e = e->ctfeInterpret();
            getRTInfo = e;
        }
    }
}
/* -----------------------------------------------------------------------------
 * Detection (FAKE)
 */
void SampleDetector::detect( const Mat& rgb, const Mat& depth, Objects& objects, int FLAGS )
{
    objects.clear();

    // Set a bounding box of a FAKE detection
    Object detection;
    detection.m_bb.x = 100 + (rand() % 20); 
    detection.m_bb.y = 100 + (rand() % 20); 
    detection.m_bb.width = 100 + (rand() % 5);
    detection.m_bb.height = 100 + (rand() % 5);
    
    detection.m_pos_2D.x = detection.m_bb.x + (detection.m_bb.width / 2);
    detection.m_pos_2D.y = detection.m_bb.y + (detection.m_bb.height / 2);
    
    detection.m_class = unknown;
    detection.m_score = 0;
detection.m_angle = 0;

detection.m_mask = Mat(cvSize(0, 0), CV_8U);

detection.m_timestamp = 0;
detection.m_speed = cv::Point3f(0,0,0);



    
    objects.push_back(detection);
}
예제 #3
0
파일: struct.c 프로젝트: hariomrana/dmd
void AggregateDeclaration::semantic3(Scope *sc)
{
    //printf("AggregateDeclaration::semantic3(%s) type = %s, errors = %d\n", toChars(), type->toChars(), errors);
    if (!members)
        return;

    StructDeclaration *sd = isStructDeclaration();
    if (!sc)    // from runDeferredSemantic3 for TypeInfo generation
    {
        assert(sd);
        sd->semanticTypeInfoMembers();
        return;
    }

    Scope *sc2 = sc->push(this);
    sc2->stc &= STCsafe | STCtrusted | STCsystem;
    sc2->parent = this;
    if (isUnionDeclaration())
        sc2->inunion = 1;
    sc2->protection = Prot(PROTpublic);
    sc2->explicitProtection = 0;
    sc2->structalign = STRUCTALIGN_DEFAULT;
    sc2->userAttribDecl = NULL;

    for (size_t i = 0; i < members->dim; i++)
    {
        Dsymbol *s = (*members)[i];
        s->semantic3(sc2);
    }

    sc2->pop();

    // don't do it for unused deprecated types
    // or error types
    if (!getRTInfo && Type::rtinfo &&
        (!isDeprecated() || global.params.useDeprecated) &&
        (type && type->ty != Terror))
    {
        // Evaluate: RTinfo!type
        Objects *tiargs = new Objects();
        tiargs->push(type);
        TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
        ti->semantic(sc);
        ti->semantic2(sc);
        ti->semantic3(sc);
        Dsymbol *s = ti->toAlias();
        Expression *e = new DsymbolExp(Loc(), s, 0);

        Scope *sc3 = ti->tempdecl->scope->startCTFE();
        sc3->tinst = sc->tinst;
        e = e->semantic(sc3);
        sc3->endCTFE();

        e = e->ctfeInterpret();
        getRTInfo = e;
    }

    if (sd)
        sd->semanticTypeInfoMembers();
}
예제 #4
0
파일: opover.c 프로젝트: odis-project/ldc
/*******************************************
 * Helper function to turn operator into template argument list
 */
Objects *opToArg(Scope *sc, enum TOK op)
{
    /* Remove the = from op=
     */
    switch (op)
    {
        case TOKaddass: op = TOKadd; break;
        case TOKminass: op = TOKmin; break;
        case TOKmulass: op = TOKmul; break;
        case TOKdivass: op = TOKdiv; break;
        case TOKmodass: op = TOKmod; break;
        case TOKandass: op = TOKand; break;
        case TOKorass:  op = TOKor;  break;
        case TOKxorass: op = TOKxor; break;
        case TOKshlass: op = TOKshl; break;
        case TOKshrass: op = TOKshr; break;
        case TOKushrass: op = TOKushr; break;
        case TOKcatass: op = TOKcat; break;
        case TOKpowass: op = TOKpow; break;
    }
    Expression *e = new StringExp(0, (char *)Token::toChars(op));
    e = e->semantic(sc);
    Objects *targsi = new Objects();
    targsi->push(e);
    return targsi;
}
예제 #5
0
파일: RDFS.cpp 프로젝트: ventosus/ingen
Objects
instances(World* world, const URISet& types)
{
	LilvNode* rdf_type = lilv_new_uri(
		world->lilv_world(), LILV_NS_RDF "type");

	Objects result;
	for (const auto& t : types) {
		LilvNode*  type    = lilv_new_uri(world->lilv_world(), t.c_str());
		LilvNodes* objects = lilv_world_find_nodes(
			world->lilv_world(), NULL, rdf_type, type);
		LILV_FOREACH(nodes, o, objects) {
			const LilvNode* object = lilv_nodes_get(objects, o);
			if (!lilv_node_is_uri(object)) {
				continue;
			}
			const std::string label = RDFS::label(world, object);
			result.insert(
				std::make_pair(label,
				               Raul::URI(lilv_node_as_string(object))));
		}
		lilv_node_free(type);
	}

	lilv_node_free(rdf_type);
	return result;
}
예제 #6
0
파일: sole.hpp 프로젝트: guker/flipsta
        /** \brief
        Force the pointer for the object in store to be a specific pointer.

        This can be useful for singleton values.
        These usually must be removed from the store explicitly.

        \pre No object with this value is already in the store.
        */
        void set (std::shared_ptr <Value const> pointer) {
            // The value must not be in the store yet.
            assert (objects_.find (*pointer,
                boost::hash <Value>(), EqualToWeakPtr()) == objects_.end());

            objects_.insert (std::move (pointer));
        }
예제 #7
0
void
ObjectDeleteCommandImpl::execute()
{
  for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
  {
    object_layer.delete_object(*i);
  }
}
예제 #8
0
void
ObjectDeleteCommandImpl::undo()
{
  for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
  {
    object_layer.add_object(*i);
  }
}
void
ObjectMoveCommandImpl::undo()
{
  for(ObjectMoveCommandImpl::Objects::iterator i = objects.begin(); 
      i != objects.end();
      ++i)
  {
    i->obj.set_pos(i->old_pos);
  }
}
예제 #10
0
void SEQFile::clearAnims() {
	Objects objects = getOrderedObjects();

	// Remove the animation frames, in reverse drawing order
	for (Objects::iterator o = objects.legacy_reverse_begin(); o != objects.end(); --o) {
		int16 left, top, right, bottom;

		if (o->object->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
			_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
	}
}
	void drawCalibratedObjects(gluit::Graphics& g) const
	{
		Objects transformed = objects;
		for (Objects::Iterator object = transformed.begin(); object != transformed.end(); ++object) {
			(*object)->transform(*transformer);

			gluit::Point position = convert((*object)->getPosition());

			g.setColor(0xFF6666CC);
			g.drawEllipse(gluit::Rectangle(gluit::Size(40)).centerOn(position), true);
		}
	}
예제 #12
0
파일: frame.cpp 프로젝트: silversthem/2f
void Frame::drawAll()
{
	clear(sf::Color::Black);
	Objects toDraw = objectsInBounds(sf::FloatRect(sf::Vector2f(0,0),_bounds));
	Objects::iterator it = toDraw.begin();
	for(;it != toDraw.end();it++)
	{
		(*it)->onDisplay();
		draw(*(*it)->getDrawable());
	}
	display();
}
예제 #13
0
void SEQFile::drawAnims() {
	Objects objects = getOrderedObjects();

	// Draw the animation frames and advance the animation
	for (Objects::iterator o = objects.begin(); o != objects.end(); ++o) {
		int16 left, top, right, bottom;

		if (o->object->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
			_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);

		o->object->advance();
	}
}
예제 #14
0
	// remove all contained objects. 
	virtual void clear()
	{
		while(!objects.empty())
		{
#ifdef _DEBUG
			Target *obj=objects.begin()->second;
			delete obj;
#else
			delete objects.begin()->second;
#endif
		}
		assert(objects.empty());
	}
예제 #15
0
파일: sole.hpp 프로젝트: guker/flipsta
        // Rvalue reference.
        std::shared_ptr <Value const> get (Value && value) {
            auto existing = objects_.find (value,
                boost::hash <Value>(), EqualToWeakPtr());
            if (existing != objects_.end())
                return existing->get();

            // The value is not in the store yet; insert it.
            auto sole = SoleType::construct (*this, std::move (value));
            Pointer newElement (sole);
            objects_.insert (std::move (newElement));

            return sole;
        }
예제 #16
0
	// called in Stored constructor
	// assignes new unique ID and back iterator
	virtual ID add(Target * object)
	{
		assert(generator);
		if(!valid(object->id()))	
			object->localID=generator->generate(object);
		else if(contains(object->id()))
		{
			assert(false);
		}
		objects.insert(std::make_pair(object->id(),object));	
		Objects::iterator it=objects.find(object->id());
		object->back=it;
		onAdd(object);		// raise onAdd event.
		return object->id();
	}
예제 #17
0
  void clear()
  {
    for(typename Objects::reverse_iterator i = objects.rbegin(); i != objects.rend(); ++i)
      (*i)->~T();
    objects.clear();

    // FIXME: We don't have to delete the chunks, instead we should
    // just reset the pointer to start and reuse them
    for(typename Chunks::reverse_iterator i = chunks.rbegin(); i != chunks.rend(); ++i)
    {
      delete[] *i;
    }
    chunks.clear();

    next_free = 0;
  }
예제 #18
0
ObjectLayer::Objects
ObjectLayer::get_selection(const CL_Rectf& rect)
{
  Objects selection;

  for(Objects::iterator i = impl->objects.begin(); i != impl->objects.end(); ++i)
  {
    // FIXME:
    if (rect.is_inside((*i).get_pos()))
    {
      selection.push_back(*i);
    }
  }

  return selection;
}
예제 #19
0
	void Print(std::ostream& stream)
	{
		std::vector<Objects::const_iterator> referencedObjects;
		referencedObjects.reserve(links.size());
		for(Links::const_iterator i = links.begin(); i != links.end(); ++i)
			referencedObjects.push_back(i->second);
		std::sort(referencedObjects.begin(), referencedObjects.end());
		referencedObjects.resize(std::unique(referencedObjects.begin(), referencedObjects.end()) - referencedObjects.begin());

		// пока просто вывести
		for(Objects::const_iterator object = objects.begin(); object != objects.end(); ++object)
		{
			if(std::binary_search(referencedObjects.begin(), referencedObjects.end(), object))
				continue;
			Print(stream, object);
		}
	}
예제 #20
0
파일: sole.hpp 프로젝트: guker/flipsta
        /** \brief
        Retrieve the sole object with value \a value.

        If an object with this value is already in the store, return a pointer
        to that object.
        If not, return a pointer to a newly allocated object.
        */
        std::shared_ptr <Value const> get (Value const & value) {
            auto existing = objects_.find (value,
                boost::hash <Value>(), EqualToWeakPtr());
            if (existing != objects_.end())
                return existing->get();

            // The value is not in the store yet; insert it.
            auto sole = SoleType::construct (*this, value);
            Pointer newElement (sole);
            // Note that this insertion involves a mere copy of newElement into
            // another place in memory.
            // No objects will therefore be deleted, and no objects will
            // therefore attempt to remove themselves from the store.
            objects_.insert (std::move (newElement));

            return sole;
        }
예제 #21
0
파일: struct.c 프로젝트: duralog/ldc
void AggregateDeclaration::semantic3(Scope *sc)
{
#if IN_LLVM
    if (!global.inExtraInliningSemantic)
        availableExternally = false;
#endif

    //printf("AggregateDeclaration::semantic3(%s)\n", toChars());
    if (members)
    {
        sc = sc->push(this);
        sc->parent = this;
        for (size_t i = 0; i < members->dim; i++)
        {
            Dsymbol *s = (*members)[i];
            s->semantic3(sc);
        }

        if (StructDeclaration *sd = isStructDeclaration())
        {
            //if (sd->xeq != NULL) printf("sd = %s xeq @ [%s]\n", sd->toChars(), sd->loc.toChars());
            //assert(sd->xeq == NULL);
            if (sd->xeq == NULL)
                sd->xeq = sd->buildXopEquals(sc);
        }
        sc = sc->pop();

        if (!getRTInfo && Type::rtinfo &&
            (!isDeprecated() || global.params.useDeprecated) && // don't do it for unused deprecated types
            (type && type->ty != Terror)) // or error types
        {   // Evaluate: gcinfo!type
            Objects *tiargs = new Objects();
            tiargs->push(type);
            TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
            ti->semantic(sc);
            ti->semantic2(sc);
            ti->semantic3(sc);
            Dsymbol *s = ti->toAlias();
            Expression *e = new DsymbolExp(Loc(), s, 0);
            e = e->ctfeSemantic(ti->tempdecl->scope);
            e = e->ctfeInterpret();
            getRTInfo = e;
        }
    }
}
예제 #22
0
unsigned int ReturnObjectListImpl::numberOfValidObjects() const
{
    for (size_t i = objects.size()-1; i >= 0; i--)
    {
      if(!objects[i].empty()) return (unsigned int)(i+1);
    }

    return 0;
}
void InitBulletPhysics()
{
	m_collisionConfiguration = new btDefaultCollisionConfiguration(); //collision configuration contains default setup for memory, collision setup
	m_dispatcher			 = new btCollisionDispatcher(m_collisionConfiguration); //use the default collision dispatcher 
	m_broadphase		  	 = new btDbvtBroadphase();
	m_solver			 	 = new btSequentialImpulseConstraintSolver; //the default constraint solver
	m_dynamicsWorld			 = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
	m_dynamicsWorld->setGravity(btVector3(0,-20,0));

	g_fPosX  = 0.0f;
	g_fPosY  = -5.0f;
	g_fPosZ  = 0.0f;

	Objects Object;  //This Order Must Be Preserved
	Object.createGround(-3.0f);
	Object.createWallZ(5, 10, 2.0, 0.0f, 0.0f, 0.0f);
	Object.createStones(50.0f, 0.0f, 10.0f, 1);
}
예제 #24
0
파일: Store.cpp 프로젝트: ventosus/ingen
void
Store::remove(const iterator top, Objects& removed)
{
	if (top != end()) {
		const iterator descendants_end = find_descendants_end(top);
		removed.insert(top, descendants_end);
		erase(top, descendants_end);
	}
}
TimelineLayer::Objects
TimelineLayer::get_objects(float selection_start, float selection_end) const
{
    assert(selection_start <= selection_end);

    Objects objects;

    for(const_iterator i = begin(); i != end(); ++i)
    {
        if (selection_start <= (*i)->get_pos() &&
                selection_end   >  (*i)->get_pos() + (*i)->get_width())
        {
            objects.push_back(*i);
        }
    }

    return objects;
}
예제 #26
0
파일: opover.c 프로젝트: odis-project/ldc
/***********************************************
 * This is mostly the same as UnaryExp::op_overload(), but has
 * a different rewrite.
 */
Expression *CastExp::op_overload(Scope *sc)
{
    //printf("CastExp::op_overload() (%s)\n", toChars());
    AggregateDeclaration *ad = isAggregate(e1->type);
    if (ad)
    {
        Dsymbol *fd = NULL;
        /* Rewrite as:
         *      e1.opCast!(T)();
         */
        fd = search_function(ad, Id::cast);
        if (fd)
        {
#if 1 // Backwards compatibility with D1 if opCast is a function, not a template
            if (fd->isFuncDeclaration())
            {   // Rewrite as:  e1.opCast()
                return build_overload(loc, sc, e1, NULL, fd);
            }
#endif
            Objects *targsi = new Objects();
            targsi->push(to);
            Expression *e = new DotTemplateInstanceExp(loc, e1, fd->ident, targsi);
            e = new CallExp(loc, e);
            e = e->semantic(sc);
            return e;
        }

        // Didn't find it. Forward to aliasthis
        if (ad->aliasthis)
        {
            /* Rewrite op(e1) as:
             *  op(e1.aliasthis)
             */
            Expression *e1 = new DotIdExp(loc, this->e1, ad->aliasthis->ident);
            Expression *e = copy();
            ((UnaExp *)e)->e1 = e1;
            e = e->trySemantic(sc);
            return e;
        }
    }
    return NULL;
}
	void handleSourceDataUpdate(const Source<Objects>& source)
	{
		Objects::Mutex::scoped_lock lock(objects.mutex);

		objects = source.get();

		if (calibrating) {
			for (Objects::Iterator object = objects.begin(); object != objects.end(); ++object) {
				if ((*object)->isNew()) {
					objectAdded(*object);
				} else if ((*object)->isDead()) {
					objectRemoved(*object);
				} else {
					objectUpdated(*object);
				}
			}
		}

		repaint();
	}
예제 #28
0
파일: Store.cpp 프로젝트: ventosus/ingen
void
Store::rename(const iterator top, const Raul::Path& new_path)
{
	const Raul::Path old_path = top->first;

	// Remove the object and all its descendants
	Objects removed;
	remove(top, removed);

	// Rename all the removed objects
	for (Objects::const_iterator i = removed.begin(); i != removed.end(); ++i) {
		const Raul::Path path = (i->first == old_path)
			? new_path
			: new_path.child(
				Raul::Path(i->first.substr(old_path.base().length() - 1)));

		i->second->set_path(path);
		assert(find(path) == end());  // Shouldn't be dropping objects!
		insert(make_pair(path, i->second));
	}
}
예제 #29
0
	// called in Stored destructor
	// removes the object from list. returns iterator to next valid object.
	virtual void remove(Target * object)
	{
		// some STL versions of remove return void instead 
		// of returning iterator to next object. So we 
		// need to get it manually
		onRemove(object);	// raise onRemove event
		generator->free(object->id());
		object->localID=-1;
		//idGenerator.freeID(object->id());
	
		objects.erase(object->back);	
	}
예제 #30
0
void TUIOSender::send(const Objects& objects)
{
	Mutex::scoped_lock lock(mutex);

	if (!socket) {
		return;
	}

	try {
		char buffer[OUTBOUND_PACKET_STREAM_BUFFER_SIZE];
		osc::OutboundPacketStream p(buffer, OUTBOUND_PACKET_STREAM_BUFFER_SIZE);

		p << osc::BeginBundleImmediate;

		p << osc::BeginMessage(oscAddress.getValue().c_str()) << "source" << sourceId.get().c_str() << osc::EndMessage;

		p << osc::BeginMessage(oscAddress.getValue().c_str());
		p << "alive";
		for (Objects::ConstIterator object = objects.begin(); object != objects.end(); ++object) {
			if ((*object)->isAlive()) {
				p << int((*object)->getId());
			}
		}
		p << osc::EndMessage;

		for (Objects::ConstIterator object = objects.begin(); object != objects.end(); ++object) {
			if ((*object)->isAlive()) {
				p << osc::BeginMessage(oscAddress.getValue().c_str()) << "set" << (*object) << osc::EndMessage;
			}
		}

		p << osc::BeginMessage(oscAddress.getValue().c_str()) << "fseq" << int(frameSequenceNumber++) << osc::EndMessage;

		p << osc::EndBundle;

		socket->Send(p.Data(), p.Size());
	} catch (osc::OutOfBufferMemoryException& e) {
		LOG4CPLUS_ERROR(logger, "Sending objects failed, too many objects to send (" << objects.getSize() << ")");
	}
}