introspectionRegistry: enabled caching of non scalar/scalarArrays

This commit is contained in:
Matej Sekoranja
2013-12-05 13:07:10 +01:00
parent cb561b84b3
commit f6d4c68c39
3 changed files with 72 additions and 2 deletions
+5 -2
View File
@@ -107,8 +107,11 @@ void IntrospectionRegistry::serialize(FieldConstPtr const & field, ByteBuffer* b
}
else
{
// only structures registry check
if (field->getType() == structure)
// do not cache scalars, scalarArrays
// ... and (array of) variant unions - not worth the complex condition,
// unless bool Field.cache() would exist
if (field->getType() != scalar &&
field->getType() != scalarArray)
{
bool existing;
const int16 key = registerIntrospectionInterface(field, existing);
+7
View File
@@ -21,6 +21,7 @@
#include "channelAccessIFTest.h"
//#define ENABLE_STRESS_TESTS
using namespace std::tr1;
@@ -41,7 +42,11 @@ std::string ChannelAccessIFTest::TEST_ARRAY_CHANNEL_NAME = "testArray1";
int ChannelAccessIFTest::runAllTest() {
#ifdef ENABLE_STRESS_TESTS
testPlan(157);
#else
testPlan(152);
#endif
test_implementation();
test_providerName();
@@ -92,9 +97,11 @@ int ChannelAccessIFTest::runAllTest() {
test_channelArray_destroy();
test_channelArrayTestNoConnection();
#ifdef ENABLE_STRESS_TESTS
test_stressConnectDisconnect();
test_stressConnectGetDisconnect();
test_stressMonitorAndProcess();
#endif
return testDone();
}
@@ -129,6 +129,39 @@ StructureArrayConstPtr getStructureArray(string name1, string name2)
return structureArray;
}
UnionConstPtr getUnion(string name)
{
String properties("alarm");
FieldConstPtrArray powerSupply = new FieldConstPtr[3];
powerSupply[0] = standardField->scalar(
String("voltage"),pvDouble,properties);
powerSupply[1] = standardField->scalar(
String("power"),pvDouble,properties);
powerSupply[2] = standardField->scalar(
String("current"),pvDouble,properties);
UnionConstPtr punion = getFieldCreate()->createUnion(name,3,powerSupply);
PVField *pvField = pvDataCreate->createPVField(0,punion);
pvFieldArray.push_back(pvField);
return punion;
}
UnionArrayConstPtr getUnionArray(string name1, string name2)
{
String properties("alarm");
FieldConstPtrArray powerSupply = new FieldConstPtr[3];
powerSupply[0] = standardField->scalar(
String("voltage"),pvDouble,properties);
powerSupply[1] = standardField->scalar(
String("power"),pvDouble,properties);
powerSupply[2] = standardField->scalar(
String("current"),pvDouble,properties);
UnionConstPtr punion = getFieldCreate()->createUnion(name1,3,powerSupply);
UnionArrayConstPtr unionArray = standardField->unionArray(name2,punion);
PVField *pvField = pvDataCreate->createPVField(0,unionArray);
pvFieldArray.push_back(pvField);
return unionArray;
}
//test methods
void testRegistryPutGet()
{
@@ -324,6 +357,33 @@ void testSerialize()
name3 = "structure" + ss.str();
name4 = "structureArray" + ss.str();
testSerializeCommon(static_pointer_cast<const Field>(getStructureArray(name1,name2)),static_pointer_cast<const Field>(getStructureArray(name3,name4)));
name1.clear();
name2.clear();
ss.str("");
ss << j;
name1 = "union" + ss.str();
ss.str("");
j++;
ss << j;
name2 = "union" + ss.str();
testSerializeCommon(static_pointer_cast<const Field>(getUnion(name1)),static_pointer_cast<const Field>(getUnion(name2)));
name1.clear();
name2.clear();
name3.clear();
name4.clear();
ss.str("");
ss << j;
name1 = "union" + ss.str();
name2 = "unionArray" + ss.str();
ss.str("");
j++;
ss << j;
name3 = "union" + ss.str();
name4 = "unionArray" + ss.str();
testSerializeCommon(static_pointer_cast<const Field>(getUnionArray(name1,name2)),static_pointer_cast<const Field>(getUnionArray(name3,name4)));
}
//serverRegistry->printKeysAndValues("server");