Using == operator on fields

This commit is contained in:
gjansa
2010-12-28 10:06:18 +01:00
parent 69517e18f6
commit bc3ce27494
2 changed files with 17 additions and 9 deletions

View File

@@ -83,7 +83,6 @@ short IntrospectionRegistry::registerIntrospectionInterface(FieldConstPtr field,
_registryIter = _registry.find(key);
if(_registryIter != _registry.end())
{
cout << "deleting 2" << endl;
_registryIter->second->decReferenceCount();
}
@@ -111,7 +110,7 @@ bool IntrospectionRegistry::registryContainsValue(FieldConstPtr field, short& ke
{
for(_registryRIter = _registry.rbegin(); _registryRIter != _registry.rend(); _registryRIter++)
{
if(compareFields(field,_registryRIter->second))
if((*field) == (*_registryRIter->second))
{
key = _registryRIter->first;
return true;
@@ -373,8 +372,10 @@ StructureConstPtr IntrospectionRegistry::deserializeStructureField(ByteBuffer* b
fields[i] = deserialize(buffer, control, registry);
}
}
//TODO stucture constructor created new fields instead of taking this ones
return _fieldCreate->createStructure(structureFieldName, size, fields);
StructureConstPtr structure = _fieldCreate->createStructure(structureFieldName, size, fields);
delete [] fields;
return structure;
}
void IntrospectionRegistry::serializeStructure(ByteBuffer* buffer, SerializableControl* control, PVStructurePtr pvStructure)

View File

@@ -60,6 +60,9 @@ typedef std::map<const short,const Field*> registryMap_t;
/**
* Registers introspection interface and get it's ID. Always OUTGOING.
* If it is already registered only preassigned ID is returned.
*
* TODO !!!!!!this can get very slow in larg maps. We need to change this !!!!!!
*
* @param field introspection interface to register
*
* @return id of given introspection interface
@@ -179,7 +182,7 @@ typedef std::map<const short,const Field*> registryMap_t;
/**
* Deserialize PVRequest.
* @param payloadBuffer data buffer.
* @param control
* @param control serialization control.
*
* @return deserialized PVRequest, can be <code>null</code>.
*/
@@ -187,24 +190,28 @@ typedef std::map<const short,const Field*> registryMap_t;
/**
* Deserialize Structure and create PVStructure instance.
*
* @param payloadBuffer data buffer.
* @param control serialization control.
*
* @return PVStructure instance, can be <code>null</code>.
*/
PVStructurePtr deserializeStructureAndCreatePVStructure(ByteBuffer* payloadBuffer, DeserializableControl* control);
/**
* Serialize status.
* TODO optimize duplicates
*
* @param buffer data buffer.
* @param control serializaiton control instance.
* @param control serialization control.
* @param status status to serialize.
*/
void serializeStatus(ByteBuffer* buffer, SerializableControl* control, Status* status);
/**
* Serialize status.
* TODO optimize duplicates
* Deserialize status.
*
* @param buffer data buffer.
* @param control serialization control.
*/
Status* deserializeStatus(ByteBuffer* buffer, DeserializableControl* control);