Exemplo n.º 1
0
void StandardLocationService::addLocalObject(const UUID& uuid, const TimedMotionVector3f& loc, const TimedMotionQuaternion& orient, const BoundingSphere3f& bnds, const String& msh, const String& phy) {
    LocationMap::iterator it = mLocations.find(uuid);

    // Add or update the information to the cache
    if (it == mLocations.end()) {
        mLocations[uuid] = LocationInfo();
        it = mLocations.find(uuid);
    } else {
        // It was already in there as a replica, notify its removal
        assert(it->second.local == false);
        CONTEXT_SPACETRACE(serverObjectEvent, 0, mContext->id(), uuid, false, TimedMotionVector3f()); // FIXME remote server ID
        notifyReplicaObjectRemoved(uuid);
    }

    LocationInfo& locinfo = it->second;
    locinfo.location = loc;
    locinfo.orientation = orient;
    locinfo.bounds = bnds;
    locinfo.mesh = msh;
    locinfo.physics = phy;
    locinfo.local = true;
    locinfo.aggregate = false;

    // FIXME: we might want to verify that location(uuid) and bounds(uuid) are
    // reasonable compared to the loc and bounds passed in

    // Add to the list of local objects
    CONTEXT_SPACETRACE(serverObjectEvent, mContext->id(), mContext->id(), uuid, true, loc);
    notifyLocalObjectAdded(uuid, false, location(uuid), orientation(uuid), bounds(uuid), mesh(uuid), physics(uuid));
}
Exemplo n.º 2
0
void Log::log(WarningLevel level, const string& str, const string& filename,
  const string& functionName, int lineNumber)
{
  if (level >= _level)
  {
    _logger->log(toLog4CxxLevel(level), str, LocationInfo(filename.data(), functionName.data(),
      lineNumber));
  }
}
Exemplo n.º 3
0
/**
 * Return the location for this contact.
 *
 * Change notification is via the locationUpdated() signal.
 *
 * This method requires Contact::FeatureLocation to be ready.
 *
 * \return The contact location as a LocationInfo object.
 */
LocationInfo Contact::location() const
{
    if (!mPriv->requestedFeatures.contains(FeatureLocation)) {
        warning() << "Contact::location() used on" << this
            << "for which FeatureLocation hasn't been requested - returning 0";
        return LocationInfo();
    }

    return mPriv->location;
}
Exemplo n.º 4
0
ScopeLogger::ScopeLogger( const char* cszFile, const char* cszFunc, int nLine )
{
    // We'll treat scope messages as debug level.
    if (bp::log::rootLogger().isLevelEnabled( bp::log::LEVEL_DEBUG ))
    {
        // Lazily init this member for performance.
        m_location = LocationInfo( cszFile, cszFunc, nLine );
        
        std::string sMsg = "> Entry.";
        bp::log::rootLogger()._forcedLog( bp::log::LEVEL_DEBUG, sMsg,
                                          m_location );
    } 
}
Exemplo n.º 5
0
void StandardLocationService::addLocalAggregateObject(const UUID& uuid, const TimedMotionVector3f& loc, const TimedMotionQuaternion& orient, const BoundingSphere3f& bnds, const String& msh, const String& phy) {
    // Aggregates get randomly assigned IDs -- if there's a conflict either we
    // got a true conflict (incredibly unlikely) or somebody (prox/query
    // handler) screwed up.
    assert(mLocations.find(uuid) == mLocations.end());

    mLocations[uuid] = LocationInfo();
    LocationMap::iterator it = mLocations.find(uuid);

    LocationInfo& locinfo = it->second;
    locinfo.location = loc;
    locinfo.orientation = orient;
    locinfo.bounds = bnds;
    locinfo.mesh = msh;
    locinfo.physics = phy;
    locinfo.local = true;
    locinfo.aggregate = true;

    // Add to the list of local objects
    notifyLocalObjectAdded(uuid, true, location(uuid), orientation(uuid), bounds(uuid), mesh(uuid), physics(uuid));
}
Exemplo n.º 6
0
void Parser::parse(std::istream* in) {
	this->generate();
	std::cout << std::endl;

	std::cout << "=== Generating extended grammar" << std::endl;
	this->generate_extended_grammar();
	std::cout << "=== Done extended grammar" << std::endl;
	std::cout << std::endl;

	std::cout << "=== Generating first and follow sets" << std::endl;
	this->generate_first_and_follow();
	std::cout << "=== Done first and follow sets" << std::endl;
	std::cout << std::endl;

	std::cout << "=== Generating extended sets" << std::endl;
	this->generate_extended_first_and_follow();
	std::cout << "=== Done extended sets" << std::endl;
	std::cout << std::endl;

	Parser::debug(this);

	this->generate_actions_and_gotos();

	std::cout << std::endl << "===== Parsing" << std::endl;
	this->parse_stack.push(0);
	Symbol last_reduction = "";
	while (true) {
		std::unique_ptr<ItemSet>& current_state = this->states.at(this->parse_stack.top());
		bool accept = false;
		for (const Item& item : current_state->head) {
			if (item.first->target == this->start && Parser::is_item_done(item)) {
				accept = true;
				break;
			}
		}
		if (accept) {
			std::cout << "Accepted." << std::endl;
			//break;
		}

		Symbol lr2 = last_reduction;
		last_reduction = "";
		if (lr2.length() > 0) {
			std::map<std::string, ItemSet*>::iterator it = current_state->next.find(lr2);
			if (it != current_state->next.end()) {
				std::cout << "goto " << it->second->index << std::endl;
				this->parse_stack.push(it->second->index);
				continue;
			} else {
				// TODO: what?
				std::cout << "No next state" << std::endl;
			}
		}
		std::unique_ptr<Token> t = this->next_token(in);
		if (t == nullptr) {
			std::cout << "Got null token, state " << current_state->index << std::endl;
			// TODO: refactor?
			std::map<Symbol, Production*> reduction_row = this->reductions.at(current_state->index);
			std::map<Symbol, Production*>::iterator it = reduction_row.find(Parser::END);
			if (it != reduction_row.end()) {
				std::cout << "Reducing via end" << std::endl;
				t.reset(new Token(Parser::END, "", LocationInfo(0, 0)));
			} else {
				std::cout << "Breaking." << std::endl;
				break;
			}
		}
		std::cout << "Got token " << t->tag << ": " << t->lexeme << std::endl;
		std::map<std::string, ItemSet*>::iterator it = current_state->next.find(t->tag);
		if (it != current_state->next.end()) {
			std::cout << "shift " << it->second->index << std::endl;
			this->parse_stack.push(it->second->index);
			this->parse_stack_matches.push(std::unique_ptr<Match>(new MatchedTerminal(std::move(t))));
			continue;
		}
		std::map<Symbol, Production*> reduction_row = this->reductions.at(current_state->index);
		std::map<Symbol, Production*>::iterator it2 = reduction_row.find(t->tag);
		if (it2 != reduction_row.end()) {
			it2->second->handler(nullptr);
			std::cout << "reducing via rule ";
			Parser::debug_production(it2->second);
			std::unique_ptr<MatchedNonterminal> mnt(new MatchedNonterminal(it2->second));
			for (size_t i = 0; i < it2->second->symbols.size(); i++) {
				this->parse_stack.pop();
				std::unique_ptr<Match> m = std::move(this->parse_stack_matches.top());
				this->parse_stack_matches.pop();
				std::cout << "Removing entry ";
				Parser::debug_match(m.get(), 0);
				mnt->terms[it2->second->symbols.size() - i - 1] = std::move(m);
			}
			this->parse_stack_matches.push(std::move(mnt));
			last_reduction = it2->second->target;
			this->push_token(std::move(t));
			continue;
		} else {
			// TODO: what is this?
			std::cout << "No reduction" << std::endl;
		}
	}
	assert(this->parse_stack.size() == 1);
	assert(this->parse_stack_matches.size() == 1);
	return;
}