Add isValid() and overloads of is_a() and isCompatible()

Add convenience methods is_a(PVStructure). Add overloads of isCompatible
taking a Structure since implementation of isCompatible(PVStructure)
only uses introspection interface. Implement for NTScalar and
NTScalarArray. Add isValid() function that checks NT is valid through data
interface.
This commit is contained in:
Dave Hickin
2015-08-21 01:15:40 +01:00
parent 59afc5335a
commit 0b3e1c9fd1
12 changed files with 369 additions and 52 deletions

View File

@@ -181,7 +181,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTAggregate without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTAggregate.
* @return NTAggregate instance.
*/
@@ -193,14 +193,41 @@ public:
* @return (false,true) if (is not, is) an NTAggregate.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTAggregate.
* Is the structure an NTAggregate.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTAggregate.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTAggregate.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTAggregate.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTAggregate.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTAggregate.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTAggregate.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTAggregate
* @return (false,true) if (is not, is) a valid NTAggregate.
*/
bool isValid();
/**
* Create a NTAggregate builder instance.
* @return builder instance.

View File

@@ -139,7 +139,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTAttribute without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTAttribute.
* @return NTAttribute instance.
*/
@@ -151,14 +151,41 @@ public:
* @return (false,true) if (is not, is) an NTAttribute.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTAttribute.
* Is the structure an NTAttribute.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTAttribute.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTAttribute.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTAttribute.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTAttribute.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTAttribute.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTAttribute.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTAttribute
* @return (false,true) if (is not, is) a valid NTAttribute.
*/
bool isValid();
/**
* Create a NTAttribute builder instance.
* @return builder instance.

View File

@@ -132,7 +132,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTEnum without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTEnum.
* @return NTEnum instance.
*/
@@ -144,14 +144,41 @@ public:
* @return (false,true) if (is not, is) an NTEnum.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTEnum.
* Is the structure an NTEnum.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTEnum.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTEnum.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTEnum.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTEnum.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTEnum.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTEnum.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTEnum
* @return (false,true) if (is not, is) a valid NTEnum.
*/
bool isValid();
/**
* Create a NTEnum builder instance.
* @return builder instance.

View File

@@ -149,28 +149,53 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTMatrix without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTMatrix.
* @return NTMatrix instance.
*/
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure);
/**
* Is the structure an NTMatrix.
* @param structure The structure to test.
* @return (false,true) if (is not, is) an NTMatrix.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTMatrix..
* Is the structure an NTMatrix.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTMatrix.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTMatrix.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTMatrix.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTMatrix.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTMatrix.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTMatrix.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTMatrix
* @return (false,true) if (is not, is) a valid NTMatrix.
*/
bool isValid();
/**
* Create a NTMatrix builder instance.
* @return builder instance.

View File

@@ -186,22 +186,48 @@ public:
* @return NTMultiChannel instance.
*/
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure);
/**
* Is the Structure an NTMultiChannel.
* This method structure->getID() and checks if it is the same as the URI.
* Is the structure an NTMultiChannel.
* @param structure The structure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
*/
static bool is_a(
epics::pvData::StructureConstPtr const &structure);
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTMultiChannel.
* Is the structure an NTMultiChannel.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTMultiChannel.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTMultiChannel.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTMultiChannel.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTMultiChannel
* @return (false,true) if (is not, is) a valid NTMultiChannel.
*/
bool isValid();
/**
* Create a NTMultiChannelBuilder instance
* @return builder instance.

View File

@@ -144,7 +144,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTNameValue without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNameValue.
* @return NTNameValue instance.
*/
@@ -156,14 +156,41 @@ public:
* @return (false,true) if (is not, is) an NTNameValue.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTNameValue..
* Is the structure an NTNameValue.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTNameValue.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTNameValue.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTNameValue.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTNameValue.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTNameValue.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTNameValue.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTNameValue
* @return (false,true) if (is not, is) a valid NTNameValue.
*/
bool isValid();
/**
* Create a NTNameValue builder instance.
* @return builder instance.

View File

@@ -143,7 +143,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTNDArray without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNDArray.
* @return NTNDArray instance.
*/
@@ -157,13 +157,39 @@ public:
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTNDArray..
* Is the structure an NTNDArray.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTNDArray.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTNDArray.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTNDArray.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTNDArray.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTNDArray.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTNDArray.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTNDArray
* @return (false,true) if (is not, is) a valid NTNDArray.
*/
bool isValid();
/**
* Create a NTNDArrayBuilder instance
* @return builder instance.

View File

@@ -171,14 +171,41 @@ public:
* @return (false,true) if (is not, is) an NTScalar.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTScalar.
* Is the structure an NTScalar.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalar.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTScalar.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTScalar.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTScalar.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalar.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTScalar.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTScalar
* @return (false,true) if (is not, is) a valid NTScalar.
*/
bool isValid();
/**
* Create a NTScalar builder instance.
* @return builder instance.

View File

@@ -160,28 +160,53 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTMatrix without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTScalarArray.
* @return NTScalarArray instance.
*/
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure);
/**
* Is the structure an NTScalarArray.
* @param structure The structure to test.
* @return (false,true) if (is not, is) an NTScalarArray.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTScalarArray..
* Is the structure an NTScalarArray.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalarArray.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTScalarArray.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTScalarArray.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTScalarArray.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalarArray.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTScalarArray.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTScalarArray
* @return (false,true) if (is not, is) a valid NTScalarArray.
*/
bool isValid();
/**
* Create a NTScalarArray builder instance.
* @return builder instance.

View File

@@ -187,22 +187,48 @@ public:
* @return NTScalarMultiChannel instance.
*/
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure);
/**
* Is the Structure an NTScalarMultiChannel.
* This method structure->getID() and checks if it is the same as the URI.
* Is the structure an NTScalarMultiChannel.
* @param structure The structure to test.
* @return (false,true) if (is not, is) an NTScalarMultiChannel.
*/
static bool is_a(
epics::pvData::StructureConstPtr const &structure);
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTScalarMultiChannel.
* Is the structure an NTScalarMultiChannel.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalarMultiChannel.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTScalarMultiChannel.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTScalarMultiChannel.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTScalarMultiChannel.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTScalarMultiChannel.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTScalarMultiChannel.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTScalarMultiChannel
* @return (false,true) if (is not, is) a valid NTScalarMultiChannel.
*/
bool isValid();
/**
* Create a NTScalarMultiChannelBuilder instance
* @return builder instance.

View File

@@ -164,14 +164,41 @@ public:
* @return (false,true) if (is not, is) an NTTable.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTTable.
* Is the structure an NTTable.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTTable.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTTable.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTTable.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTTable.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTTable.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTTable.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTTable
* @return (false,true) if (is not, is) a valid NTTable.
*/
bool isValid();
/**
* Create a NTTable builder instance.
* @return builder instance.

View File

@@ -134,7 +134,7 @@ public:
static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure);
/**
* Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible
* Wrap (aka dynamic cast, or wrap) the structure to NTUnion without checking for isCompatible
* @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTUnion.
* @return NTUnion instance.
*/
@@ -146,14 +146,41 @@ public:
* @return (false,true) if (is not, is) an NTUnion.
*/
static bool is_a(epics::pvData::StructureConstPtr const & structure);
/**
* Is the pvStructure compatible with NTUnion.
* Is the structure an NTUnion.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTUnion.
*/
static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
/**
* Is the Structure compatible with NTUnion.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The pvStructure to test.
* @return (false,true) if (is not, is) an NTMultiChannel.
* @param structure The Structure to test.
* @return (false,true) if (is not, is) an NTUnion.
*/
static bool isCompatible(
epics::pvData::StructureConstPtr const &structure);
/**
* Is the PVStructure compatible with NTUnion.
* This method introspects the fields to see if they are compatible.
* @param pvStructure The PVStructure to test.
* @return (false,true) if (is not, is) an NTUnion.
*/
static bool isCompatible(
epics::pvData::PVStructurePtr const &pvStructure);
/**
* Checks if the specified structure is a valid NTUnion.
*
* Checks whether the wrapped structure is valid with respect to this
* version of NTUnion
* @return (false,true) if (is not, is) a valid NTUnion.
*/
bool isValid();
/**
* Create a NTUnion builder instance.
* @return builder instance.