void RemoteAspect::receiveChanged(Connection                &con,
                                  FieldContainerFactoryBase *fcFactory)
{
    UInt32          remoteId  = 0;
    UInt32          localId   = 0;
    BitVector       fieldMask = 0;
    UInt32          len       = 0;
    FieldContainer *fcPtr     = NULL;

    con.getValue(remoteId);
    con.getValue(fieldMask);
    con.getValue(len);

    if(getLocalId(remoteId, localId))
    {
        fcPtr = fcFactory->getContainer(localId);

#ifndef OSG_REMOTE_ASPECT_SILENT
        SLOG << "Receive CHANGED: id (r/l) '" << remoteId
             << "/" << localId
             << "' mask '0x"
             << std::hex << fieldMask << std::dec
             << "' len '" << len
             << "' type name '"
             << (fcPtr != NULL ? fcPtr->getType().getName() : "")
             << "'\n";
#endif

        if(fcPtr == NULL)
        {
            clearFCMapping(localId, remoteId);

            char dummy;

            while(len--)
                con.get(&dummy, 1);
        }
        else
        {
            fcPtr->copyFromBin(con, fieldMask);

            callChanged(fcPtr);
        }
    }
    else
    {
        char dummy;

        SWARNING << "Can not do CHANGED for unknown FC remote id "
                 << remoteId
                 << " skip "
                 << len
                 << " bytes."
                 << std::endl;

        while(len--)
            con.get(&dummy, 1);
    }
}
Example #2
0
void CEntityItem::copyTo(CEntityItem* pOther, bool bWithoutContent) const
{
    pOther->setId(getId());
    pOther->setLocalId(getLocalId());
    pOther->setState(getState());
    pOther->setMd5(getMd5());
    pOther->setContentSize(getContentSize());
    pOther->setCreatedAt(getCreatedAt());
    pOther->setUpdatedAt(getUpdatedAt());
    if(!bWithoutContent)
        pOther->setContent(getContent());
}
Example #3
0
std::string PlainDictionary::idToString(unsigned int id, TripleComponentRole position)
{
    vector<DictionaryEntry*> &vector = getDictionaryEntryVector(id, position);

    unsigned int localid = getLocalId(id, position);

    if(localid<vector.size()) {
        DictionaryEntry *entry = vector[localid];
        string result(entry->str);
        return result;
    }

    return string();
}
Example #4
0
std::string FourSectionDictionary::idToString(unsigned int id, TripleComponentRole position)
{
	csd::CSD *section = getDictionarySection(id, position);

	unsigned int localid = getLocalId(id, position);

	if(localid<=section->getLength()) {
		const char * ptr = (const char *)section->extract(localid);
		if(ptr!=NULL) {
			string out = ptr;
			section->freeString((unsigned char*)ptr);
			return out;
		} else {
			//cout << "Not found: " << id << " as " << position << endl;
		}
	}

	return string();
}
void RemoteAspect::receiveSubRefed(Connection                &con,
                                   FieldContainerFactoryBase *fcFactory,
                                   ChangeList                *pChangeList)
{
    UInt32          remoteId = 0;
    UInt32          localId  = 0;
    FieldContainer *fcPtr    = NULL;

    con.getValue(remoteId);

    if(getLocalId(remoteId, localId))
    {
        fcPtr = fcFactory->getContainer(localId);

#ifndef OSG_REMOTE_ASPECT_SILENT
        SLOG << "Receive SUBREFED: remote id '" << remoteId
             << "' local id '"                  << localId
             << "' type name '"
             << (fcPtr != NULL ? fcPtr->getType().getName() : "")
             << "'\n";
#endif

        if(fcPtr == NULL)
        {
            clearFCMapping(localId, remoteId);
        }
        else
        {
            pChangeList->addDelayedSubRef<RecordedRefCountPolicy>(fcPtr);
        }
    }
    else
    {
        SWARNING << "Can not do SUBREFED for unknown FC remote id "
                 << remoteId << std::endl;
    }
}
Example #6
0
unsigned int FourSectionDictionary::getLocalId(unsigned int id, TripleComponentRole position) {
	return getLocalId(mapping,id,position);
}