Exemplo n.º 1
0
void CompositeSource::addSource(const std::shared_ptr<ISeekableSource> &src)
{
    if (!count())
        m_asbd = src->getSampleFormat();
    else if (std::memcmp(&m_asbd, &src->getSampleFormat(), sizeof m_asbd))
        throw std::runtime_error("Concatenation of multiple inputs with "
                                 "different sample format is not supported");
    m_sources.push_back(src);
    uint64_t len = src->length();
    m_length = (len > ~0ULL - m_length) ? ~0ULL : m_length + len;

    /*
     * Want to discard tags that take different values on each track.
     * This way, only (per-album) common tags should finally remain.
     */
    auto parser = dynamic_cast<ITagParser*>(src.get());
    if (!parser)
        return;
    auto tags = parser->getTags();
    bool is_empty = m_tags.empty();
    std::for_each(tags.begin(), tags.end(),
                  [&](const decltype(*tags.begin()) &kv) {
                      if (is_empty)
                          m_tags[kv.first] = kv.second;
                      else {
                          auto it = m_tags.find(kv.first);
                          if (it != m_tags.end() && it->second != kv.second)
                              m_tags.erase(it);
                      }
                  });
}
Exemplo n.º 2
0
QVariantMap Contest::tags() const
{
    QVariantMap results;
    auto tagList = getTags();
    for (::UnsignedContest::Tag::Reader tag : tagList)
        results[QString::fromStdString(tag.getKey())] = QString::fromStdString(tag.getValue());
    return results;
}
Exemplo n.º 3
0
tgModel* tgRodInfo::createModel(tgWorld& world)
{
    // @todo: handle tags -> model
    // @todo: check to make sure the rigidBody has been built
    // @todo: Do we need to use the group here?

    // Just in case it hasn't been done already...
    initRigidBody(world); 
    
    #if (0)
    std::cout << "creating rod with tags " << getTags() << std::endl; 
    #endif
    
    tgRod* rod = new tgRod(getRigidBody(), getTags(), getLength());

    return rod;
}
Exemplo n.º 4
0
QDateTime OscMessage::getTimeTag() const
{
	int pos = getTags().indexOf( 't' );
	if (pos != -1)
	{
		OscValue* value = getValue( pos - 1 );
		return value->toTimetag();
	}
	return NtpTimestamp::IMMEDIATE;
}
Exemplo n.º 5
0
QStringList Note::getTagNames()
{
    QList<QVariantMap> tags = getTags();

    QStringList tagNames;
    QVariantMap tag;

    foreach(tag, tags) {
        tagNames.append(tag["name"].toString());
    }
Exemplo n.º 6
0
	FREObject getWifiTags(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
		FREObject result;
		
		std::wstring tags = getTags();
		std::vector<uint8_t> tagsVector(tags.begin(), tags.end());
		uint8_t *pVector = &tagsVector[0];
		FRENewObjectFromUTF8(tags.size(), pVector, &result);

		return result;
	}
Exemplo n.º 7
0
void DerpibooruTest::testJsonTags()
{
	QList<Tag> tags = getTags("Booru-on-rails", "derpibooru.org", "json", "tags.json");

	QCOMPARE(tags.count(), 250);

	QCOMPARE(tags[1].text(), QString("solo"));
	QCOMPARE(tags[1].count(), 599506);
	QCOMPARE(tags[1].type().name(), QString("unknown"));
}
tgModel* tgBasicActuatorInfo::createModel(tgWorld& world)
{
    // Don't have to do anything in the world for a tgBulletSpringCable...
    // @todo: set the name based on joined tags, or remove name from the model...
    //std::cout << "tgBasicActuatorInfo::createModel" << std::endl;
    
    // ensure connector has been initialized
    assert(m_bulletSpringCable);
    return new tgBasicActuator(m_bulletSpringCable, getTags(), m_config);
}
Exemplo n.º 9
0
    BSONObj ShardType::toBSON() const {
        BSONObjBuilder builder;

        if (_name) builder.append(name(), getName());
        if (_host) builder.append(host(), getHost());
        if (_draining) builder.append(draining(), getDraining());
        if (_maxSize) builder.append(maxSize(), getMaxSize());
        if (_tags) builder.append(tags(), getTags());

        return builder.obj();
    }
Exemplo n.º 10
0
//------------------------------------------------------------------------------
void Entity::serializeState(Variant & o, const SerializationContext & context)
{
    o["name"] = m_name;
    o["enabled"] = isEnabledSelf();

	std::vector<std::string> tags;
	getTags(tags);
    sn::serialize(o["tags"], tags);

    // TODO Serialize script

}
Exemplo n.º 11
0
QString Relation::toString() const
{
  stringstream ss(stringstream::out);
  ss << "relation(" << getId() << ")" << endl;
  ss << "type: " << getType() << endl;
  ss << "members: ";
  for (size_t i = 0; i < getMembers().size(); i++)
  {
    ss << "  " << getMembers()[i].toString().toUtf8().data() << endl;
  }
  ss << endl;
  ss << "tags: " << getTags().toString().toUtf8().data();
  ss << "status: " << getStatusString().toUtf8().data();
  return QString::fromUtf8(ss.str().data());
}
Exemplo n.º 12
0
    void visitElement(const utymap::entities::Element &element,
      const Coordinates &coordinates) {
      auto ctags = getTags(element);
      auto cstyles = getStyles(element);

      fillVertices(coordinates);

      elementCallback_(tag_, element.id,
        ctags.data(), static_cast<int>(ctags.size()),
        vertices_.data(), static_cast<int>(vertices_.size()),
        cstyles.data(), static_cast<int>(cstyles.size()));

      // NOTE clear vectors after raw array data is consumed by external code
      vertices_.clear();
      tagStrings_.clear();
      styleStrings_.clear();
    }
Exemplo n.º 13
0
BSONObj ShardType::toBSON() const {
    BSONObjBuilder builder;

    if (_name)
        builder.append(name(), getName());
    if (_host)
        builder.append(host(), getHost());
    if (_draining)
        builder.append(draining(), getDraining());
    if (_maxSizeMB)
        builder.append(maxSizeMB(), getMaxSizeMB());
    if (_tags)
        builder.append(tags(), getTags());
    if (_state)
        builder.append(state(), static_cast<std::underlying_type<ShardState>::type>(getState()));

    return builder.obj();
}
Exemplo n.º 14
0
void TransportLayerLegacy::endAllSessions(Session::TagMask tags) {
    log() << "legacy transport layer closing all connections";
    {
        stdx::lock_guard<stdx::mutex> lk(_sessionsMutex);
        for (auto&& it : _sessions) {

            // Attempt to make our weak_ptr into a shared_ptr
            auto session = it.lock();
            if (session) {
                if (session->getTags() & tags) {
                    log() << "Skip closing connection for connection # "
                          << session->conn()->connectionId;
                } else {
                    _closeConnection(session->conn());
                }
            }
        }
    }
}
Exemplo n.º 15
0
QString WrittenNote::toString()
{
    QString retrunString = "ID: " + QString::number(getId()) + "; content: " + getContent() + "; sunbject-ID:" + QString::number(getSubject_ID()) + "; Timestamp" +  getTimestamp().toString();

    QList<QString> tags = getTags();
    QList<QString> attachements = getAttachement();
    retrunString += "; Tags:";
    for (QString t: tags)
    {
       retrunString += " " + t ;
    }
    retrunString += "; Attatchements:";

    for (QString a: attachements)
    {
       retrunString +=  " " + a;
    }
    return  retrunString + ";";
}
Exemplo n.º 16
0
void CompositeSource::addSourceWithChapter(
                            const std::shared_ptr<ISeekableSource> &src,
                            const std::wstring &title)
{
    addSource(src);
    std::wstring name(title);
    auto parser = dynamic_cast<ITagParser*>(src.get());
    auto cp = dynamic_cast<IChapterParser*>(src.get());
    if (cp) {
        auto &chaps = cp->getChapters();
        if (chaps.size()) {
            std::copy(chaps.begin(), chaps.end(),
                      std::back_inserter(m_chapters));
            return;
        }
    }
    if (parser) {
        auto tags = parser->getTags();
        if (tags.find("title") != tags.end())
            name = strutil::us2w(tags["title"]);
    }
    addChapter(name, src->length() / m_asbd.mSampleRate);
}
Exemplo n.º 17
0
    bool run(OperationContext* opCtx,
             const std::string&,
             const BSONObj& cmdObj,
             BSONObjBuilder& result) final {
        Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
        if (!status.isOK()) {
            return appendCommandStatus(result, status);
        }

        ReplSetRequestVotesArgs parsedArgs;
        status = parsedArgs.initialize(cmdObj);
        if (!status.isOK()) {
            return appendCommandStatus(result, status);
        }

        // We want to keep request vote connection open when relinquishing primary.
        // Tag it here.
        transport::Session::TagMask originalTag = 0;
        auto session = opCtx->getClient()->session();
        if (session) {
            originalTag = session->getTags();
            session->replaceTags(originalTag | transport::Session::kKeepOpen);
        }

        // Untag the connection on exit.
        ON_BLOCK_EXIT([session, originalTag]() {
            if (session) {
                session->replaceTags(originalTag);
            }
        });

        ReplSetRequestVotesResponse response;
        status = getGlobalReplicationCoordinator()->processReplSetRequestVotes(
            opCtx, parsedArgs, &response);
        response.addToBSON(&result);
        return appendCommandStatus(result, status);
    }
Exemplo n.º 18
0
//------------------------------------------------------------------------------
void Entity::onSceneChanged(Scene * oldScene, Scene * newScene)
{
    if (newScene == oldScene)
        return;

	std::vector<std::string> tagList;

    EntityID oldID = m_id;

    // Register to the new scene
    if (newScene)
    {
        m_id = newScene->registerEntity(*this);

        // Update subscription
        if (getFlag(SN_EF_UPDATABLE))
        {
            std::string updateLayer;
            if (oldScene)
                oldScene->getUpdateManager().getEntityLayer(*this, updateLayer);
            newScene->getUpdateManager().addEntity(*this, updateLayer);
        }

        // System events subscription
        if (getFlag(SN_EF_SYSTEM_EVENT_LISTENER))
            newScene->registerEventListener(*this);

        // Tags registering
		if (oldScene)
		{
			// Get tags by name
			getTags(tagList);

			// Register them
			for (auto it = tagList.begin(); it != tagList.end(); ++it)
			{
				const std::string & tagName = *it;
				u32 tagIndex = newScene->registerTaggedEntity(*this, tagName);
				if (tagIndex != Scene::TagManager::INVALID_INDEX)
					m_tags.set(tagIndex, true);
			}
		}
    }
	else
	{
		SN_ERROR("No new scene, tag information will be lost!");
		m_tags.reset();
	}

    // Unregister from the old scene
    if (oldScene)
    {
        if (getFlag(SN_EF_UPDATABLE))
            oldScene->getUpdateManager().removeEntity(*this);

        if (getFlag(SN_EF_SYSTEM_EVENT_LISTENER))
            oldScene->unregisterEventListener(*this);

        for (auto it = tagList.begin(); it != tagList.end(); ++it)
        {
            oldScene->unregisterTaggedEntity(*this, *it);
        }

        oldScene->unregisterEntity(oldID);
    }

    r_scene = newScene;

    // Notify children
    for (auto it = m_children.begin(); it != m_children.end(); ++it)
    {
        Entity * child = *it;
        child->onSceneChanged(oldScene, newScene);
    }
}
Exemplo n.º 19
0
QString Node::toString() const
{
  return QString("Node(%1): x: %2 y: %3 tags:\n%4").arg(getId()).arg(getX()).arg(getY()).
    arg(getTags().toString());
}