From 4ee19f4dd131597fa4d63719b0c39e600bf6dceb Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 1 Oct 2014 08:34:34 -0400 Subject: [PATCH] URI of form ev4:nt/NTType:1.0 ; narrow, narrow_unsafe, is_compatible => wrap, wrapUnsafe, isCompatible --- documentation/ntCPP.html | 116 ++++++++++++++++----------------- src/nt/ntmultiChannel.cpp | 17 +++-- src/nt/ntmultiChannel.h | 18 ++--- src/nt/ntnameValue.cpp | 15 ++--- src/nt/ntnameValue.h | 17 ++--- src/nt/ntndarray.cpp | 19 +++--- src/nt/ntndarray.h | 17 ++--- src/nt/ntscalar.cpp | 15 ++--- src/nt/ntscalar.h | 17 ++--- src/nt/ntscalarArray.cpp | 15 ++--- src/nt/ntscalarArray.h | 17 ++--- src/nt/nttable.cpp | 22 +++---- src/nt/nttable.h | 17 ++--- test/nt/ntmultiChannelTest.cpp | 27 ++++---- test/nt/ntnameValueTest.cpp | 24 +++---- test/nt/ntndarrayTest.cpp | 26 ++++---- test/nt/ntscalarArrayTest.cpp | 24 +++---- test/nt/ntscalarTest.cpp | 24 +++---- test/nt/nttableTest.cpp | 24 +++---- 19 files changed, 230 insertions(+), 241 deletions(-) diff --git a/documentation/ntCPP.html b/documentation/ntCPP.html index 3ea6f80..c29ca30 100644 --- a/documentation/ntCPP.html +++ b/documentation/ntCPP.html @@ -37,7 +37,7 @@

EPICS ntCPP

-

EPICS v4 Working Group, Working Draft, 22-Sept-2014

+

EPICS v4 Working Group, Working Draft, 01-Oct-2014

Latest version:
@@ -80,7 +80,7 @@ V4 control system programming environment:

Status of this Document

-

This is the 22-Sept-2014 version of the C++ implementation of pvData. +

This is the 01-Oct-2014 version of the C++ implementation of pvData.

@@ -417,7 +417,7 @@ This has methods to do the following:

Normative Type NTScalar

This has the following fields:

-uri:ev4:nt/2014/pwd:NTScalar
+ev4:nt/NTScalar:1.0
     double value                        // mandatory and can be any numeric type
     string descriptor                   // optional
     alarm_t alarm                       // optional
@@ -532,10 +532,10 @@ class NTScalar
 public:
     POINTER_DEFINITIONS(NTScalar);
     ~NTScalar() {}
-    static shared_pointer narrow(PVStructurePtr const & structure);
-    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static shared_pointer wrap(PVStructurePtr const & structure);
+    static shared_pointer wrapUnsafe(PVStructurePtr const & structure);
     static bool is_a(StructureConstPtr const & structure);
-    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static bool isComparible(PVStructurePtr const &pvStructure);
     static NTScalarBuilderPtr createBuilder();
 
     bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
@@ -555,20 +555,19 @@ private:
 
where
-
narrow
+
wrap
Given a pvStructure this creates an NTScalar that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null PVScalar if is_a returns false. + It calls isCompatible returns a null PVScalar if isCompatible returns false.
-The primary use of narrow is by pvAccess client code. +The primary use of wrap is by pvAccess client code. The server creates a pvStructure that is valid for an NTScalar and passes it to the client. -The client can call narrow to create an NTScalar for it;s own use. +The client can call wrap to create an NTScalar for it;s own use. An example is:
 void myCallback(PVStructurePtr const & pvStructure)
 {
-     NTScalarPtr ntscalar = NTScalar::narrow(pvStructure);
+     NTScalarPtr ntscalar = NTScalar::wrap(pvStructure);
      if(!ntscalar) {
        // not a valid NTScalar
      }
@@ -576,14 +575,14 @@ void myCallback(PVStructurePtr const & pvStructure)
 }
 
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTScalar that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTScalar.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTScalar.
@@ -661,7 +660,7 @@ string message = alarm.getMessage(); field is a scalar array field instead of just a scalar.

This has the following fields:

-uri:ev4:nt/2014/pwd:NTScalarArray
+ev4:nt/NTScalarArray:1.0
     double[] value                      // mandatory and can be any numeric type
     string descriptor                   // optional
     alarm_t alarm                       // optional
@@ -746,10 +745,10 @@ class NTScalarArray
 public:
     POINTER_DEFINITIONS(NTScalarArray);
     ~NTScalarArray() {}
-    static shared_pointer narrow(PVStructurePtr const & structure);
-    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static shared_pointer wrap(PVStructurePtr const & structure);
+    static shared_pointer wrapUnsafe(PVStructurePtr const & structure);
     static bool is_a(StructureConstPtr const & structure);
-    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static bool isComparible(PVStructurePtr const &pvStructure);
     static NTScalarArrayBuilderPtr createBuilder();
 
     bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
@@ -769,19 +768,18 @@ private:
 
where
-
narrow
+
wrap
Given a pvStructure this creates an NTScalarArray that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null PVScalarArrayPtr if is_a returns false. + It calls isCompatible returns a null PVScalarArray if isCompatible returns false.
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTScalarArray that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTScalarArray.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTScalarArray.
@@ -834,7 +832,7 @@ where

Normative Type NTNameValue

-uri:ev4:nt/2014/pwd:NTNameValue
+ev4:nt/NTNameValue:1.0
     string[] names                 // mandatory
     double[] values                // madatory, can be any type, must be same length as names
     string descriptor              // optional
@@ -905,10 +903,10 @@ class NTNameValue
 public:
     POINTER_DEFINITIONS(NTNameValue);
     ~NTNameValue() {}
-    static shared_pointer narrow(PVStructurePtr const & structure);
-    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static shared_pointer wrap(PVStructurePtr const & structure);
+    static shared_pointer wrapUnsafe(PVStructurePtr const & structure);
     static bool is_a(StructureConstPtr const & structure);
-    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static bool isComparible(PVStructurePtr const &pvStructure);
     static NTNameValueBuilderPtr createBuilder();
 
     bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
@@ -925,19 +923,18 @@ private:
 
where
-
narrow
+
wrap
Given a pvStructure this creates an NTNameValue that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null NTNameValuePtr if is_a returns false. + It calls isCompatible returns a null NTNameValue if isCompatible returns false.
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTNameValue that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTNameValue.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTNameValue.
@@ -974,7 +971,7 @@ where

Normative Type NTTable

-uri:ev4:nt/2014/pwd:NTTable 
+ev4:nt/NTTable:1.0 
     string[] labels [column0,column1,column2]    // mandatory
     structure value                              // mandatory; 
         double[] column0 []                      // name=labels[0]; can be any scalar type
@@ -1045,10 +1042,10 @@ class NTTable
 public:
     POINTER_DEFINITIONS(NTTable);
     ~NTTable() {}
-    static shared_pointer narrow(PVStructurePtr const & structure);
-    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static shared_pointer wrap(PVStructurePtr const & structure);
+    static shared_pointer wrapUnsafe(PVStructurePtr const & structure);
     static bool is_a(StructureConstPtr const & structure);
-    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static bool isComparible(PVStructurePtr const &pvStructure);
     static NTTableBuilderPtr createBuilder();
 
     bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
@@ -1066,19 +1063,18 @@ private:
 
where
-
narrow
+
wrap
Given a pvStructure this creates an NTTable that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null NTTablePtr if is_a returns false. + It calls isCompatible returns a null NTTable if isCompatible returns false.
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTTable that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTTable.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTTable.
@@ -1200,10 +1196,10 @@ class NTMultiChannel public: POINTER_DEFINITIONS(NTMultiChannel); ~NTMultiChannel() {} - static shared_pointer narrow(PVStructurePtr const & structure); - static shared_pointer narrow_unsafe(PVStructurePtr const & structure); + static shared_pointer wrap(PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(PVStructurePtr const & structure); static bool is_a(StructureConstPtr const & structure); - static bool is_compatible(PVStructurePtr const &pvStructure); + static bool isComparible(PVStructurePtr const &pvStructure); static NTMultiChannelBuilderPtr createBuilder(); bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const; @@ -1228,19 +1224,18 @@ private: where
-
narrow
+
wrap
Given a pvStructure this creates an NTMultiChannel that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null NTMultiChannelPtr if is_a returns false. + It calls isCompatible returns a null NTMultiChannel if isCompatible returns false.
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTMultiChannel that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTMultiChannel.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTMultiChannel.
@@ -1291,7 +1286,7 @@ where

Normative Type NTNDArray

-uri:ev4:nt/2014/pwd:NTNDArray 
+ev4:nt/NTNDArray:1.0 
     union value                                 //mandatory
     long compressedSize                         //mandatory
     long uncompressedSize                       //mandatory
@@ -1311,9 +1306,9 @@ uri:ev4:nt/2014/pwd:NTNDArray
         long secondsPastEpoch
         int nanoseconds
         int userTag
-    uri:ev4:nt/2014/pwd:NTAttribute[] attribute //mandatory
-        uri:ev4:nt/2014/pwd:NTAttribute[]
-            uri:ev4:nt/2014/pwd:NTAttribute
+    ev4:nt/NTAttribute:1.0[] attribute //mandatory
+        ev4:nt/NTAttribute:1.0[]
+            ev4:nt/NTAttribute:1.0
                 string name
                 any value
                 string description
@@ -1389,10 +1384,10 @@ class NTNDArray
 public:
     POINTER_DEFINITIONS(NTNDArray);
     ~NTNDArray() {}
-    static shared_pointer narrow(PVStructurePtr const & structure);
-    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static shared_pointer wrap(PVStructurePtr const & structure);
+    static shared_pointer wrapUnsafe(PVStructurePtr const & structure);
     static bool is_a(StructureConstPtr const & structure);
-    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static bool isComparible(PVStructurePtr const &pvStructure);
     static NTNDArrayBuilderPtr createBuilder();
 
     bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
@@ -1416,19 +1411,18 @@ private:
 
where
-
narrow
+
wrap
Given a pvStructure this creates an NTNDArray that warps it. - It calls is_a on the introspection interface of the - pvStructure and returns a null NTNDArrayPtr if is_a returns false. + It calls isCompatible returns a null NTNDArray if isCompatible returns false.
-
narrow_unsafe
+
wrapUnsafe
Given a pvStructure this creates an NTNDArray that warps it. It does not check that the introspection interface is compatible. This method is dangerous.
is_a
This method checks to see if the structure has an ID that is correct for NTNDArray.
-
is_compatible
+
isComparible
This method checks to see if the pvStructure has appropriate fields to be an NTNDArray.
diff --git a/src/nt/ntmultiChannel.cpp b/src/nt/ntmultiChannel.cpp index 0bce9e3..f9c6124 100644 --- a/src/nt/ntmultiChannel.cpp +++ b/src/nt/ntmultiChannel.cpp @@ -103,7 +103,7 @@ StructureConstPtr NTMultiChannelBuilder::createStructure() if(valueType) { fields[ind++] = fieldCreate->createUnionArray(valueType); } else { - fields[ind++] = fieldCreate->createVariantUnion(); + fields[ind++] = fieldCreate->createVariantUnionArray(); } names[ind] = "channelName"; fields[ind++] = fieldCreate->createScalarArray(pvString); @@ -195,17 +195,15 @@ NTMultiChannelBuilder::shared_pointer NTMultiChannelBuilder::add(string const & } -const std::string NTMultiChannel::URI("uri:ev4:nt/2014/pwd:NTMultiChannel"); +const std::string NTMultiChannel::URI("ev4:nt/NTMultiChannel:1.0"); -NTMultiChannel::shared_pointer NTMultiChannel::narrow(PVStructurePtr const & structure) +NTMultiChannel::shared_pointer NTMultiChannel::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTMultiChannel::shared_pointer NTMultiChannel::narrow_unsafe(PVStructurePtr const & structure) +NTMultiChannel::shared_pointer NTMultiChannel::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTMultiChannel(structure)); } @@ -215,8 +213,9 @@ bool NTMultiChannel::is_a(StructureConstPtr const &structure) return structure->getID() == URI; } -bool NTMultiChannel::is_compatible(PVStructurePtr const &pvStructure) +bool NTMultiChannel::isCompatible(PVStructurePtr const &pvStructure) { + if(!pvStructure) return false; PVUnionArrayPtr pvValue = pvStructure->getSubField("value"); if(!pvValue) return false; PVFieldPtr pvField = pvStructure->getSubField("descriptor"); diff --git a/src/nt/ntmultiChannel.h b/src/nt/ntmultiChannel.h index d24c20b..30aa35a 100644 --- a/src/nt/ntmultiChannel.h +++ b/src/nt/ntmultiChannel.h @@ -148,20 +148,20 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTMultiChannel. - * First the structure ID is checked against NTMultiChannel::URI. - * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTMultiChannel. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTMultiChannel. * @return NTMultiChannel instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTMultiChannel. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTMultiChannel. * @return NTMultiChannel instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + 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. @@ -176,7 +176,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** * Create a NTMultiChannelBuilder instance diff --git a/src/nt/ntnameValue.cpp b/src/nt/ntnameValue.cpp index bf6f0da..b1dd26a 100644 --- a/src/nt/ntnameValue.cpp +++ b/src/nt/ntnameValue.cpp @@ -108,17 +108,15 @@ NTNameValueBuilder::shared_pointer NTNameValueBuilder::add(string const & name, } -const std::string NTNameValue::URI("uri:ev4:nt/2014/pwd:NTNameValue"); +const std::string NTNameValue::URI("ev4:nt/NTNameValue:1.0"); -NTNameValue::shared_pointer NTNameValue::narrow(PVStructurePtr const & structure) +NTNameValue::shared_pointer NTNameValue::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTNameValue::shared_pointer NTNameValue::narrow_unsafe(PVStructurePtr const & structure) +NTNameValue::shared_pointer NTNameValue::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTNameValue(structure)); } @@ -128,8 +126,9 @@ bool NTNameValue::is_a(StructureConstPtr const & structure) return structure->getID() == URI; } -bool NTNameValue::is_compatible(PVStructurePtr const & pvStructure) +bool NTNameValue::isCompatible(PVStructurePtr const & pvStructure) { + if(!pvStructure) return false; PVStringArrayPtr pvName = pvStructure->getSubField("name"); if(!pvName) return false; PVFieldPtr pvValue = pvStructure->getSubField("value"); diff --git a/src/nt/ntnameValue.h b/src/nt/ntnameValue.h index af48582..d5e5a93 100644 --- a/src/nt/ntnameValue.h +++ b/src/nt/ntnameValue.h @@ -119,20 +119,21 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTNameValue. - * First the structure ID is checked against NTNameValue::URI. + * Wrap (aka dynamic cast, or wrap) the structure to NTNameValue. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTNameValue. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNameValue. * @return NTNameValue instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTNameValue without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTNameValue. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNameValue. * @return NTNameValue instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure); /** * Is the structure an NTNameValue. @@ -146,7 +147,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** * Create a NTNameValue builder instance. diff --git a/src/nt/ntndarray.cpp b/src/nt/ntndarray.cpp index a27bb35..1635dc5 100644 --- a/src/nt/ntndarray.cpp +++ b/src/nt/ntndarray.cpp @@ -18,7 +18,7 @@ static NTFieldPtr ntField = NTField::get(); namespace detail { -const std::string ntAttrStr("uri:ev4:nt/2014/pwd:NTAttribute"); +const std::string ntAttrStr("ev4:nt/NTAttribute:1.0"); static FieldCreatePtr fieldCreate = getFieldCreate(); static PVDataCreatePtr pvDataCreate = getPVDataCreate(); @@ -198,21 +198,19 @@ NTNDArrayBuilder::shared_pointer NTNDArrayBuilder::add(string const & name, Fiel } -const std::string NTNDArray::URI("uri:ev4:nt/2014/pwd:NTNDArray"); -const std::string ntAttrStr("uri:ev4:nt/2014/pwd:NTAttribute"); +const std::string NTNDArray::URI("ev4:nt/NTNDArray:1.0"); +const std::string ntAttrStr("ev4:nt/NTAttribute:1.0"); static FieldCreatePtr fieldCreate = getFieldCreate(); static PVDataCreatePtr pvDataCreate = getPVDataCreate(); -NTNDArray::shared_pointer NTNDArray::narrow(PVStructurePtr const & structure) +NTNDArray::shared_pointer NTNDArray::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTNDArray::shared_pointer NTNDArray::narrow_unsafe(PVStructurePtr const & structure) +NTNDArray::shared_pointer NTNDArray::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTNDArray(structure)); } @@ -222,8 +220,9 @@ bool NTNDArray::is_a(StructureConstPtr const & structure) return structure->getID() == URI; } -bool NTNDArray::is_compatible(PVStructurePtr const & pvStructure) +bool NTNDArray::isCompatible(PVStructurePtr const & pvStructure) { + if(!pvStructure) return false; PVUnionPtr pvValue = pvStructure->getSubField("value"); if(!pvValue) return false; PVFieldPtr pvField = pvStructure->getSubField("descriptor"); diff --git a/src/nt/ntndarray.h b/src/nt/ntndarray.h index c2609c1..d84776b 100644 --- a/src/nt/ntndarray.h +++ b/src/nt/ntndarray.h @@ -116,20 +116,21 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTNDArray. - * First the structure ID is checked against NTNDArray::URI. + * Wrap (aka dynamic cast, or wrap) the structure to NTNDArray. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTNDArray. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNDArray. * @return NTNDArray instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTNDArray without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTNDArray. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTNDArray. * @return NTNDArray instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure); /** * Is the structure an NTNDArray. @@ -144,7 +145,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** * Create a NTNDArrayBuilder instance diff --git a/src/nt/ntscalar.cpp b/src/nt/ntscalar.cpp index b6e3f62..3b3c660 100644 --- a/src/nt/ntscalar.cpp +++ b/src/nt/ntscalar.cpp @@ -128,17 +128,15 @@ NTScalarBuilder::shared_pointer NTScalarBuilder::add(string const & name, FieldC } -const std::string NTScalar::URI("uri:ev4:nt/2014/pwd:NTScalar"); +const std::string NTScalar::URI("ev4:nt/NTScalar:1.0"); -NTScalar::shared_pointer NTScalar::narrow(PVStructurePtr const & structure) +NTScalar::shared_pointer NTScalar::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTScalar::shared_pointer NTScalar::narrow_unsafe(PVStructurePtr const & structure) +NTScalar::shared_pointer NTScalar::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTScalar(structure)); } @@ -148,8 +146,9 @@ bool NTScalar::is_a(StructureConstPtr const & structure) return structure->getID() == URI; } -bool NTScalar::is_compatible(PVStructurePtr const & pvStructure) +bool NTScalar::isCompatible(PVStructurePtr const & pvStructure) { + if(!pvStructure) return false; PVScalarPtr pvValue = pvStructure->getSubField("value"); if(!pvValue) return false; PVFieldPtr pvField = pvStructure->getSubField("descriptor"); diff --git a/src/nt/ntscalar.h b/src/nt/ntscalar.h index d8f6c59..bffca71 100644 --- a/src/nt/ntscalar.h +++ b/src/nt/ntscalar.h @@ -134,20 +134,21 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTScalar. - * First the structure ID is checked against NTScalar::URI. + * Wrap (aka dynamic cast, or wrap) the structure to NTScalar. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTScalar. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTScalar. * @return NTScalar instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTScalar without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTScalar. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTScalar. * @return NTScalar instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure); /** * Is the structure an NTScalar. @@ -161,7 +162,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** * Create a NTScalar builder instance. diff --git a/src/nt/ntscalarArray.cpp b/src/nt/ntscalarArray.cpp index 1c61a8d..511c2b0 100644 --- a/src/nt/ntscalarArray.cpp +++ b/src/nt/ntscalarArray.cpp @@ -125,17 +125,15 @@ NTScalarArrayBuilder::shared_pointer NTScalarArrayBuilder::add(string const & na } -const std::string NTScalarArray::URI("uri:ev4:nt/2014/pwd:NTScalarArray"); +const std::string NTScalarArray::URI("ev4:nt/NTScalarArray:1.0"); -NTScalarArray::shared_pointer NTScalarArray::narrow(PVStructurePtr const & structure) +NTScalarArray::shared_pointer NTScalarArray::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTScalarArray::shared_pointer NTScalarArray::narrow_unsafe(PVStructurePtr const & structure) +NTScalarArray::shared_pointer NTScalarArray::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTScalarArray(structure)); } @@ -145,8 +143,9 @@ bool NTScalarArray::is_a(StructureConstPtr const & structure) return structure->getID() == URI; } -bool NTScalarArray::is_compatible(PVStructurePtr const & pvStructure) +bool NTScalarArray::isCompatible(PVStructurePtr const & pvStructure) { + if(!pvStructure) return false; PVScalarArrayPtr pvValue = pvStructure->getSubField("value"); if(!pvValue) return false; PVFieldPtr pvField = pvStructure->getSubField("descriptor"); diff --git a/src/nt/ntscalarArray.h b/src/nt/ntscalarArray.h index 8a4b7a9..b94e65a 100644 --- a/src/nt/ntscalarArray.h +++ b/src/nt/ntscalarArray.h @@ -134,20 +134,21 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTScalarArray. - * First the structure ID is checked against NTScalarArray::URI. + * Wrap (aka dynamic cast, or wrap) the structure to NTScalarArray. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTScalarArray. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTScalarArray. * @return NTScalarArray instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTScalarArray without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTScalarArray. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTScalarArray. * @return NTScalarArray instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure); /** @@ -162,7 +163,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** diff --git a/src/nt/nttable.cpp b/src/nt/nttable.cpp index e6ca86d..207f462 100644 --- a/src/nt/nttable.cpp +++ b/src/nt/nttable.cpp @@ -123,17 +123,15 @@ NTTableBuilder::shared_pointer NTTableBuilder::add(string const & name, FieldCon } -const std::string NTTable::URI("uri:ev4:nt/2014/pwd:NTTable"); +const std::string NTTable::URI("ev4:nt/NTTable:1.0"); -NTTable::shared_pointer NTTable::narrow(PVStructurePtr const & structure) +NTTable::shared_pointer NTTable::wrap(PVStructurePtr const & structure) { - if (!structure || !is_a(structure->getStructure())) - return shared_pointer(); - - return narrow_unsafe(structure); + if(!isCompatible(structure)) return shared_pointer(); + return wrapUnsafe(structure); } -NTTable::shared_pointer NTTable::narrow_unsafe(PVStructurePtr const & structure) +NTTable::shared_pointer NTTable::wrapUnsafe(PVStructurePtr const & structure) { return shared_pointer(new NTTable(structure)); } @@ -143,19 +141,15 @@ bool NTTable::is_a(StructureConstPtr const & structure) return structure->getID() == URI; } -bool NTTable::is_compatible(PVStructurePtr const & pvStructure) +bool NTTable::isCompatible(PVStructurePtr const & pvStructure) { + if(!pvStructure) return false; PVFieldPtr pvField = pvStructure->getSubField("alarm"); if(pvField && !ntField->isAlarm(pvField->getField())) return false; pvField = pvStructure->getSubField("timeStamp"); if(pvField && !ntField->isTimeStamp(pvField->getField())) return false; PVStringArrayPtr pvLabel = pvStructure->getSubField("labels"); - const shared_vector column(pvLabel->view()); - size_t len = column.size(); - for(size_t i=0; igetSubField(value)) return false; - } + if(!pvLabel) return false; return true; } diff --git a/src/nt/nttable.h b/src/nt/nttable.h index d282ff4..2746397 100644 --- a/src/nt/nttable.h +++ b/src/nt/nttable.h @@ -122,20 +122,21 @@ public: static const std::string URI; /** - * Narrow (aka dynamic cast, or wrap) the structure to NTTable. - * First the structure ID is checked against NTTable::URI. + * Wrap (aka dynamic cast, or wrap) the structure to NTTable. + * First isCompatible is called. + * This method will nullptr if the structure is is not compatible. * This method will nullptr if the structure is nullptr. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTTable. + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTTable. * @return NTTable instance on success, nullptr otherwise. */ - static shared_pointer narrow(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrap(epics::pvData::PVStructurePtr const & structure); /** - * Narrow (aka dynamic cast, or wrap) the structure to NTTable without checking for null-ness or its ID. - * @param structure The structure to narrow-ed (dynamic cast, wrapped) to NTTable. + * Wrap (aka dynamic cast, or wrap) the structure to NTMultiChannel without checking for isCompatible + * @param structure The structure to wrap-ed (dynamic cast, wrapped) to NTTable. * @return NTTable instance. */ - static shared_pointer narrow_unsafe(epics::pvData::PVStructurePtr const & structure); + static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & structure); /** * Is the structure an NTTable. @@ -149,7 +150,7 @@ public: * @param pvStructure The pvStructure to test. * @return (false,true) if (is not, is) an NTMultiChannel. */ - static bool is_compatible( + static bool isCompatible( epics::pvData::PVStructurePtr const &pvStructure); /** * Create a NTTable builder instance. diff --git a/test/nt/ntmultiChannelTest.cpp b/test/nt/ntmultiChannelTest.cpp index 10e1bca..9ba1fec 100644 --- a/test/nt/ntmultiChannelTest.cpp +++ b/test/nt/ntmultiChannelTest.cpp @@ -32,7 +32,7 @@ using std::cout; using std::endl; using std::vector; -static bool debug = true; +static bool debug = false; static FieldCreatePtr fieldCreate = getFieldCreate(); static PVDataCreatePtr pvDataCreate = getPVDataCreate(); @@ -122,7 +122,7 @@ static void test() testOk1(multiChannel.get() != 0); pvStructure = multiChannel->getPVStructure(); if(debug) {cout << *pvStructure << endl;} - testOk1(NTMultiChannel::is_compatible(pvStructure)==true); + testOk1(NTMultiChannel::isCompatible(pvStructure)==true); PVStructurePtr pvTimeStamp = multiChannel->getTimeStamp(); testOk1(pvTimeStamp.get() !=0); PVStructurePtr pvAlarm = multiChannel->getAlarm(); @@ -150,19 +150,19 @@ static void test() } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTMultiChannelPtr nullPtr = NTMultiChannel::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTMultiChannelPtr nullPtr = NTMultiChannel::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTMultiChannel::narrow( + nullPtr = NTMultiChannel::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTMultiChannelBuilderPtr builder = NTMultiChannel::createBuilder(); @@ -174,18 +174,19 @@ void test_narrow() if (!pvStructure) return; - NTMultiChannelPtr ptr = NTMultiChannel::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + NTMultiChannelPtr ptr = NTMultiChannel::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTMultiChannel::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + builder = NTMultiChannel::createBuilder(); + ptr = NTMultiChannel::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } MAIN(testCreateRequest) { testPlan(25); test(); - test_narrow(); + test_wrap(); return testDone(); } diff --git a/test/nt/ntnameValueTest.cpp b/test/nt/ntnameValueTest.cpp index f80357f..a42695d 100644 --- a/test/nt/ntnameValueTest.cpp +++ b/test/nt/ntnameValueTest.cpp @@ -180,19 +180,19 @@ void test_ntnameValue() } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTNameValuePtr nullPtr = NTNameValue::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTNameValuePtr nullPtr = NTNameValue::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTNameValue::narrow( + nullPtr = NTNameValue::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTNameValueBuilderPtr builder = NTNameValue::createBuilder(); @@ -205,12 +205,12 @@ void test_narrow() if (!pvStructure) return; - testOk1(NTNameValue::is_compatible(pvStructure)==true); - NTNameValuePtr ptr = NTNameValue::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + testOk1(NTNameValue::isCompatible(pvStructure)==true); + NTNameValuePtr ptr = NTNameValue::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTNameValue::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + ptr = NTNameValue::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } void test_extra() @@ -248,7 +248,7 @@ MAIN(testNTNameValue) { testPlan(48); test_builder(); test_ntnameValue(); - test_narrow(); + test_wrap(); test_extra(); return testDone(); } diff --git a/test/nt/ntndarrayTest.cpp b/test/nt/ntndarrayTest.cpp index 4463c2f..6939739 100644 --- a/test/nt/ntndarrayTest.cpp +++ b/test/nt/ntndarrayTest.cpp @@ -76,23 +76,23 @@ void test_all() add("extra2",fieldCreate->createScalarArray(pvString)) -> createPVStructure(); std::cout << *pvStructure << std::endl; - testOk1(NTNDArray::is_compatible(pvStructure)==true); + testOk1(NTNDArray::isCompatible(pvStructure)==true); } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTNDArrayPtr nullPtr = NTNDArray::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTNDArrayPtr nullPtr = NTNDArray::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTNDArray::narrow( + nullPtr = NTNDArray::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTNDArrayBuilderPtr builder = NTNDArray::createBuilder(); @@ -103,13 +103,13 @@ void test_narrow() testOk1(pvStructure.get() != 0); if (!pvStructure) return; - testOk1(NTNDArray::is_compatible(pvStructure)==true); + testOk1(NTNDArray::isCompatible(pvStructure)==true); - NTNDArrayPtr ptr = NTNDArray::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + NTNDArrayPtr ptr = NTNDArray::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTNDArray::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + ptr = NTNDArray::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } MAIN(testNTNDArray) { @@ -118,7 +118,7 @@ MAIN(testNTNDArray) { test_builder(false); test_builder(false); // called twice to test caching test_all(); - test_narrow(); + test_wrap(); return testDone(); } diff --git a/test/nt/ntscalarArrayTest.cpp b/test/nt/ntscalarArrayTest.cpp index 11128b0..aee7e2e 100644 --- a/test/nt/ntscalarArrayTest.cpp +++ b/test/nt/ntscalarArrayTest.cpp @@ -201,19 +201,19 @@ void test_ntscalarArray() } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTScalarArrayPtr nullPtr = NTScalarArray::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTScalarArrayPtr nullPtr = NTScalarArray::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTScalarArray::narrow( + nullPtr = NTScalarArray::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTScalarArrayBuilderPtr builder = NTScalarArray::createBuilder(); @@ -226,19 +226,19 @@ void test_narrow() if (!pvStructure) return; - testOk1(NTScalarArray::is_compatible(pvStructure)==true); - NTScalarArrayPtr ptr = NTScalarArray::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + testOk1(NTScalarArray::isCompatible(pvStructure)==true); + NTScalarArrayPtr ptr = NTScalarArray::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTScalarArray::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + ptr = NTScalarArray::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } MAIN(testNTScalarArray) { testPlan(38); test_builder(); test_ntscalarArray(); - test_narrow(); + test_wrap(); return testDone(); } diff --git a/test/nt/ntscalarTest.cpp b/test/nt/ntscalarTest.cpp index 413f6bd..070f3da 100644 --- a/test/nt/ntscalarTest.cpp +++ b/test/nt/ntscalarTest.cpp @@ -192,19 +192,19 @@ void test_ntscalar() } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTScalarPtr nullPtr = NTScalar::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTScalarPtr nullPtr = NTScalar::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTScalar::narrow( + nullPtr = NTScalar::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTScalarBuilderPtr builder = NTScalar::createBuilder(); @@ -217,19 +217,19 @@ void test_narrow() if (!pvStructure) return; - testOk1(NTScalar::is_compatible(pvStructure)==true); - NTScalarPtr ptr = NTScalar::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + testOk1(NTScalar::isCompatible(pvStructure)==true); + NTScalarPtr ptr = NTScalar::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTScalar::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + ptr = NTScalar::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } MAIN(testNTScalar) { testPlan(35); test_builder(); test_ntscalar(); - test_narrow(); + test_wrap(); return testDone(); } diff --git a/test/nt/nttableTest.cpp b/test/nt/nttableTest.cpp index 8d48d28..5e1d509 100644 --- a/test/nt/nttableTest.cpp +++ b/test/nt/nttableTest.cpp @@ -87,7 +87,7 @@ void test_labels() if (!pvStructure) return; - testOk1(NTTable::is_compatible(pvStructure)==true); + testOk1(NTTable::isCompatible(pvStructure)==true); std::cout << *pvStructure << std::endl; PVStringArrayPtr labels = pvStructure->getSubField("labels"); @@ -199,19 +199,19 @@ void test_nttable() } -void test_narrow() +void test_wrap() { - testDiag("test_narrow"); + testDiag("test_wrap"); - NTTablePtr nullPtr = NTTable::narrow(PVStructurePtr()); - testOk(nullPtr.get() == 0, "nullptr narrow"); + NTTablePtr nullPtr = NTTable::wrap(PVStructurePtr()); + testOk(nullPtr.get() == 0, "nullptr wrap"); - nullPtr = NTTable::narrow( + nullPtr = NTTable::wrap( getPVDataCreate()->createPVStructure( NTField::get()->createTimeStamp() ) ); - testOk(nullPtr.get() == 0, "wrong type narrow"); + testOk(nullPtr.get() == 0, "wrong type wrap"); NTTableBuilderPtr builder = NTTable::createBuilder(); @@ -226,11 +226,11 @@ void test_narrow() if (!pvStructure) return; - NTTablePtr ptr = NTTable::narrow(pvStructure); - testOk(ptr.get() != 0, "narrow OK"); + NTTablePtr ptr = NTTable::wrap(pvStructure); + testOk(ptr.get() != 0, "wrap OK"); - ptr = NTTable::narrow_unsafe(pvStructure); - testOk(ptr.get() != 0, "narrow_unsafe OK"); + ptr = NTTable::wrapUnsafe(pvStructure); + testOk(ptr.get() != 0, "wrapUnsafe OK"); } MAIN(testNTTable) { @@ -238,7 +238,7 @@ MAIN(testNTTable) { test_builder(); test_labels(); test_nttable(); - test_narrow(); + test_wrap(); return testDone(); }