本文整理汇总了C++中PVTimeStamp类的典型用法代码示例。如果您正苦于以下问题:C++ PVTimeStamp类的具体用法?C++ PVTimeStamp怎么用?C++ PVTimeStamp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PVTimeStamp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dest
void NTNDArrayConverter::fromTimeStamp (NDArray *src)
{
PVStructurePtr dest(m_array->getTimeStamp());
PVTimeStamp pvDest;
pvDest.attach(dest);
TimeStamp ts(src->epicsTS.secPastEpoch, src->epicsTS.nsec);
pvDest.set(ts);
}
示例2: src
void NTNDArrayConverter::toDataTimeStamp (NDArray *dest)
{
PVStructurePtr src(m_array->getDataTimeStamp());
PVTimeStamp pvSrc;
pvSrc.attach(src);
TimeStamp ts;
pvSrc.get(ts);
dest->timeStamp = ts.toSeconds();
}
示例3: Status
Status PvValue::getTimeStamp(TimeStamp &timeStamp)
{
if(pvGetStructure.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
PVTimeStamp pvTimeStamp;
PVFieldPtr pvField = pvGetStructure->getSubField("timeStamp");
if(pvField.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
if(!pvTimeStamp.attach(pvField)) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
pvTimeStamp.get(timeStamp);
return Status::Ok;
}
示例4: attachTimeStamp
bool NTScalar::attachTimeStamp(PVTimeStamp &pvTimeStamp) const
{
PVStructurePtr ts = getTimeStamp();
if (ts)
return pvTimeStamp.attach(ts);
else
return false;
}
示例5: attachDataTimeStamp
bool NTNDArray::attachDataTimeStamp(PVTimeStamp &pvTimeStamp) const
{
PVStructurePtr ts = getDataTimeStamp();
if (ts)
return pvTimeStamp.attach(ts);
else
return false;
}
示例6: setDataTimeStamp
void NTNDArrayRecord::setDataTimeStamp()
{
// Create PVTimeStamp and TimeStamp objects
// attach the dataTimeStamp field to the PVTimeStamp
// TimeStamp object should get the current time
// Use it to set the dataTimeStamp field
#if 0
PVTimeStamp timeStamp;
timeStamp.attach(pvStructure->getSubField<PVStructure>("dataTimeStamp"));
TimeStamp current;
current.getCurrent();
timeStamp.set(current);
#else
// Alternatively you can use the member objects already created
// for you and do the attaching once.
dataTimeStamp.getCurrent();
pvDataTimeStamp.set(dataTimeStamp);
#endif
}
示例7: _getTimeStamp
static PyObject * _getTimeStamp(PyObject *willBeNull, PyObject *args)
{
PyObject *pcapsule = 0;
PyObject *ptimeStamp = 0;
if(!PyArg_ParseTuple(args,"OO:nttablePy",
&pcapsule,
&ptimeStamp))
{
PyErr_SetString(PyExc_SyntaxError,
"Bad argument. Expected (pvt,ptimeStamp)");
return NULL;
}
void *pvoid = PyCapsule_GetPointer(pcapsule,"nttablePvt");
if(pvoid==0) {
PyErr_SetString(PyExc_SyntaxError,
"first arg must be return from _init");
return NULL;
}
NTTablePvt *pvt = static_cast<NTTablePvt *>(pvoid);
pvoid = PyCapsule_GetPointer(ptimeStamp,"timeStamp");
if(pvoid==0) {
PyErr_SetString(PyExc_SyntaxError,
"second argument is not a timeStamp capsule");
return NULL;
}
TimeStamp *xxx = static_cast<TimeStamp *>(pvoid);
PVStructurePtr pvStructure = pvt->nttable->getTimeStamp();
//if(pvStructure!=0) {
if(!pvStructure) {
PVTimeStamp pvTimeStamp;
pvTimeStamp.attach(pvStructure);
pvTimeStamp.get(*xxx);
}
Py_INCREF(Py_None);
return Py_None;
}
示例8: test_nthistogram
void test_nthistogram()
{
testDiag("test_nthistogram");
NTHistogramBuilderPtr builder = NTHistogram::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTHistogramPtr ntHistogram = builder->
value(pvInt)->
addDescriptor()->
addAlarm()->
addTimeStamp()->
add("extra1",fieldCreate->createScalar(pvString)) ->
add("extra2",fieldCreate->createScalarArray(pvString)) ->
create();
testOk1(ntHistogram.get() != 0);
testOk1(ntHistogram->getPVStructure().get() != 0);
testOk1(ntHistogram->getDescriptor().get() != 0);
testOk1(ntHistogram->getAlarm().get() != 0);
testOk1(ntHistogram->getTimeStamp().get() != 0);
testOk1(ntHistogram->getRanges().get() != 0);
testOk1(ntHistogram->getValue().get() != 0);
testOk1(ntHistogram->getValue<PVIntArray>().get() != 0);
//
// example how to set ranges
//
PVDoubleArray::svector newRanges;
newRanges.push_back(-100.0);
newRanges.push_back(0.0);
newRanges.push_back(100.0);
PVDoubleArrayPtr pvRangesField = ntHistogram->getRanges();
pvRangesField->replace(freeze(newRanges));
//
// example how to get ranges
//
PVDoubleArray::const_svector ranges(pvRangesField->view());
testOk1(ranges.size() == 3);
testOk1(ranges[0] == -100.0);
testOk1(ranges[1] == 0.0);
testOk1(ranges[2] == 100.0);
//
// example how to set value
//
PVIntArray::svector newValue;
newValue.push_back(1);
newValue.push_back(2);
PVIntArrayPtr pvValueField = ntHistogram->getValue<PVIntArray>();
pvValueField->replace(freeze(newValue));
//
// example how to get values for each bin
//
PVIntArray::const_svector value(pvValueField->view());
testOk1(value.size() == 2);
testOk1(value[0] == 1);
testOk1(value[1] == 2);
//
// test isValid
//
testOk1(ntHistogram->isValid());
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntHistogram->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntHistogram->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
alarm.setStatus(deviceStatus);
//.........这里部分代码省略.........
示例9: test_ntnameValue
void test_ntnameValue()
{
testDiag("test_ntnameValue");
NTNameValueBuilderPtr builder = NTNameValue::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTNameValuePtr ntNameValue = builder->
value(pvInt)->
addDescriptor()->
addAlarm()->
addTimeStamp()->
add("extra1",fieldCreate->createScalar(pvString)) ->
add("extra2",fieldCreate->createScalarArray(pvString)) ->
create();
testOk1(ntNameValue.get() != 0);
testOk1(NTNameValue::is_a(ntNameValue->getPVStructure()));
testOk1(NTNameValue::isCompatible(ntNameValue->getPVStructure()));
testOk1(ntNameValue->getPVStructure().get() != 0);
testOk1(ntNameValue->getDescriptor().get() != 0);
testOk1(ntNameValue->getAlarm().get() != 0);
testOk1(ntNameValue->getTimeStamp().get() != 0);
testOk1(ntNameValue->getName().get() != 0);
testOk1(ntNameValue->getValue().get() != 0);
//
// example how to set name
//
PVStringArray::svector newName;
newName.push_back("name1");
newName.push_back("name2");
newName.push_back("name3");
PVStringArrayPtr pvNameField = ntNameValue->getName();
pvNameField->replace(freeze(newName));
//
// example how to get name
//
PVStringArray::const_svector name(pvNameField->view());
testOk1(name.size() == 3);
testOk1(name[0] == "name1");
testOk1(name[1] == "name2");
testOk1(name[2] == "name3");
//
// example how to set value
//
PVIntArray::svector newValue;
newValue.push_back(1);
newValue.push_back(2);
newValue.push_back(8);
PVIntArrayPtr pvValueField = ntNameValue->getValue<PVIntArray>();
pvValueField->replace(freeze(newValue));
//
// example how to get column value
//
PVIntArray::const_svector value(pvValueField->view());
testOk1(value.size() == 3);
testOk1(value[0] == 1);
testOk1(value[1] == 2);
testOk1(value[2] == 8);
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntNameValue->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntNameValue->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
//.........这里部分代码省略.........
示例10: test_ntndarrayAttribute
void test_ntndarrayAttribute()
{
testDiag("test_ntndarrayAttribute");
NTNDArrayAttributeBuilderPtr builder = NTNDArrayAttribute::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTNDArrayAttributePtr ntNDArrayAttribute = builder->
addTags()->
addAlarm()->
addTimeStamp()->
create();
testOk1(ntNDArrayAttribute.get() != 0);
testOk1(ntNDArrayAttribute->getPVStructure().get() != 0);
testOk1(ntNDArrayAttribute->getName().get() != 0);
testOk1(ntNDArrayAttribute->getValue().get() != 0);
testOk1(ntNDArrayAttribute->getTags().get() != 0);
testOk1(ntNDArrayAttribute->getDescriptor().get() != 0);
testOk1(ntNDArrayAttribute->getAlarm().get() != 0);
testOk1(ntNDArrayAttribute->getTimeStamp().get() != 0);
testOk1(ntNDArrayAttribute->getSourceType().get() != 0);
testOk1(ntNDArrayAttribute->getSource().get() != 0);
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntNDArrayAttribute->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntNDArrayAttribute->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
alarm.setStatus(deviceStatus);
alarm.setSeverity(minorAlarm);
alarm.setMessage("simulation alarm");
pvAlarm.set(alarm);
}
else
testFail("alarm attach fail");
//
// set descriptor
//
ntNDArrayAttribute->getDescriptor()->put("This is a test NTNDArrayAttribute");
// dump ntNDArrayAttribute
std::cout << *ntNDArrayAttribute->getPVStructure() << std::endl;
}
示例11: test_ntscalar
void test_ntscalar()
{
testDiag("test_ntscalar");
NTScalarBuilderPtr builder = NTScalar::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTScalarPtr ntScalar = builder->
value(pvInt)->
addDescriptor()->
addAlarm()->
addTimeStamp()->
addDisplay()->
addControl()->
add("valueAlarm",standardField->intAlarm()) ->
create();
testOk1(ntScalar.get() != 0);
testOk1(NTScalar::is_a(ntScalar->getPVStructure()));
testOk1(NTScalar::isCompatible(ntScalar->getPVStructure()));
testOk1(ntScalar->getPVStructure().get() != 0);
testOk1(ntScalar->getValue().get() != 0);
testOk1(ntScalar->getDescriptor().get() != 0);
testOk1(ntScalar->getAlarm().get() != 0);
testOk1(ntScalar->getTimeStamp().get() != 0);
testOk1(ntScalar->getDisplay().get() != 0);
testOk1(ntScalar->getControl().get() != 0);
//
// example how to set a value
//
ntScalar->getValue<PVInt>()->put(12);
//
// example how to get a value
//
int32 value = ntScalar->getValue<PVInt>()->get();
testOk1(value == 12);
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntScalar->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntScalar->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
alarm.setStatus(deviceStatus);
alarm.setSeverity(minorAlarm);
alarm.setMessage("simulation alarm");
pvAlarm.set(alarm);
}
else
testFail("alarm attach fail");
//
// display ops
//
PVDisplay pvDisplay;
if (ntScalar->attachDisplay(pvDisplay))
{
testPass("display attach");
// example how to set an display
Display display;
display.setLow(-15);
display.setHigh(15);
display.setDescription("This is a test scalar");
display.setFormat("%d");
display.setUnits("A");
pvDisplay.set(display);
}
else
testFail("display attach fail");
//
//.........这里部分代码省略.........
示例12: test_ntenum
void test_ntenum()
{
testDiag("test_ntenum");
NTEnumBuilderPtr builder = NTEnum::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTEnumPtr ntEnum = builder->
addDescriptor()->
addAlarm()->
addTimeStamp()->
add("valueAlarm",standardField->intAlarm()) ->
create();
testOk1(ntEnum.get() != 0);
testOk1(NTEnum::is_a(ntEnum->getPVStructure()));
testOk1(NTEnum::isCompatible(ntEnum->getPVStructure()));
testOk1(ntEnum->getPVStructure().get() != 0);
testOk1(ntEnum->getValue().get() != 0);
testOk1(ntEnum->getDescriptor().get() != 0);
testOk1(ntEnum->getAlarm().get() != 0);
testOk1(ntEnum->getTimeStamp().get() != 0);
//
// example how to set a value
//
PVStructurePtr pvValue = ntEnum->getValue();
//PVStringArray pvChoices = pvValue->getSubField<PVStringArray>("choices");
PVStringArray::svector choices(2);
choices[0] = "Off";
choices[1] = "On";
pvValue->getSubField<PVStringArray>("choices")->replace(freeze(choices));
pvValue->getSubField<PVInt>("index")->put(1);
//
// example how to get a value
//
int32 value = ntEnum->getValue()->getSubField<PVInt>("index")->get();
testOk1(value == 1);
PVStringArrayPtr pvChoices = ntEnum->getValue()->getSubField<PVStringArray>("choices");
std::string choice0 = pvChoices->view()[0];
std::string choice1 = pvChoices->view()[1];
testOk1(choice0 == "Off");
testOk1(choice1 == "On");
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntEnum->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntEnum->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
alarm.setStatus(deviceStatus);
alarm.setSeverity(minorAlarm);
alarm.setMessage("simulation alarm");
pvAlarm.set(alarm);
}
else
testFail("alarm attach fail");
//
// set descriptor
//
ntEnum->getDescriptor()->put("This is a test NTEnum");
// dump ntEnum
std::cout << *ntEnum->getPVStructure() << std::endl;
}
示例13: test_ntcontinuum
void test_ntcontinuum()
{
testDiag("test_ntcontinuum");
NTContinuumBuilderPtr builder = NTContinuum::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTContinuumPtr ntContinuum = builder->
addDescriptor()->
addAlarm()->
addTimeStamp()->
add("extra1",fieldCreate->createScalar(pvString)) ->
add("extra2",fieldCreate->createScalarArray(pvString)) ->
create();
testOk1(ntContinuum.get() != 0);
testOk1(ntContinuum->getPVStructure().get() != 0);
testOk1(ntContinuum->getDescriptor().get() != 0);
testOk1(ntContinuum->getAlarm().get() != 0);
testOk1(ntContinuum->getTimeStamp().get() != 0);
testOk1(ntContinuum->getBase().get() != 0);
testOk1(ntContinuum->getValue().get() != 0);
//
// example how to set base
//
PVDoubleArray::svector newBase;
newBase.push_back(1.0);
newBase.push_back(2.0);
PVDoubleArrayPtr pvBaseField = ntContinuum->getBase();
pvBaseField->replace(freeze(newBase));
//
// example how to get bases
//
PVDoubleArray::const_svector base(pvBaseField->view());
testOk1(base.size() == 2);
testOk1(base[0] == 1.0);
testOk1(base[1] == 2.0);
//
// example how to set values
//
PVDoubleArray::svector newValue;
newValue.push_back(1.0);
newValue.push_back(2.0);
newValue.push_back(10.0);
newValue.push_back(20.0);
newValue.push_back(100.0);
newValue.push_back(200.0);
PVDoubleArrayPtr pvValueField = ntContinuum->getValue();
pvValueField->replace(freeze(newValue));
//
// example how to get values
//
PVDoubleArray::const_svector value(pvValueField->view());
testOk1(value.size() == 6);
testOk1(value[0] == 1.0);
testOk1(value[1] == 2.0);
testOk1(value[2] == 10.0);
testOk1(value[3] == 20.0);
testOk1(value[4] == 100.0);
testOk1(value[5] == 200.0);
//
// example how to set units
//
PVStringArray::svector newUnits;
newUnits.push_back("s");
newUnits.push_back("ms");
newUnits.push_back("us");
newUnits.push_back("s");
PVStringArrayPtr pvUnitsField = ntContinuum->getUnits();
pvUnitsField->replace(freeze(newUnits));
//
// example how to get units
//
PVStringArray::const_svector units(pvUnitsField->view());
testOk1(units.size() == 4);
testOk1(units[0] == "s");
testOk1(units[1] == "ms");
testOk1(units[2] == "us");
testOk1(units[3] == "s");
//
// test isValid
//
testOk1(ntContinuum->isValid());
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntContinuum->attachTimeStamp(pvTimeStamp))
//.........这里部分代码省略.........
示例14: testCopy
static void testCopy()
{
TEST_COPY(PVBoolean, 1);
TEST_COPY(PVByte, 12);
TEST_COPY(PVShort, 128);
TEST_COPY(PVInt, 128000);
TEST_COPY(PVLong, 128000000);
TEST_COPY(PVUByte, 12);
TEST_COPY(PVUShort, 128);
TEST_COPY(PVUInt, 128000);
TEST_COPY(PVULong, 128000000);
TEST_COPY(PVFloat, 12.8);
TEST_COPY(PVDouble, 8.12);
TEST_COPY(PVString, "jikes");
int32 testValue = 128;
// PVStructure test
PVStructurePtr pvStructure =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
pvStructure->getSubField<PVInt>("value")->put(testValue);
PVTimeStamp timeStamp;
timeStamp.attach(pvStructure->getSubField<PVStructure>("timeStamp"));
TimeStamp current;
current.getCurrent();
timeStamp.set(current);
PVStructurePtr pvStructureCopy =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
pvStructureCopy->copy(*pvStructure);
testOk(*pvStructure == *pvStructureCopy, "PVStructure copy");
PVStructurePtr pvStructureCopy2 =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
pvStructureCopy2->copyUnchecked(*pvStructure);
testOk(*pvStructure == *pvStructureCopy2, "PVStructure copyUnchecked");
BitSet mask(pvStructure->getNumberFields());
PVStructurePtr pvStructureCopy3 =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
PVStructurePtr pvStructureCopy4 =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
pvStructureCopy3->copyUnchecked(*pvStructure, mask);
testOk(*pvStructureCopy3 == *pvStructureCopy4, "PVStructure copyUnchecked w/ cleared mask");
mask.set(pvStructure->getSubField<PVInt>("value")->getFieldOffset());
pvStructureCopy3->copyUnchecked(*pvStructure, mask);
pvStructureCopy4->getSubField<PVInt>("value")->put(testValue);
testOk(*pvStructureCopy3 == *pvStructureCopy4, "PVStructure copyUnchecked w/ value mask only");
mask.set(pvStructure->getSubField<PVStructure>("timeStamp")->getFieldOffset());
PVStructurePtr pvStructureCopy5 =
standardPVField->scalar(pvInt, alarmTimeStampValueAlarm);
pvStructureCopy5->copyUnchecked(*pvStructure, mask);
testOk(*pvStructure == *pvStructureCopy5, "PVStructure copyUnchecked w/ value+timeStamp mask");
UnionConstPtr _union = fieldCreate->createFieldBuilder()->
add("doubleValue", pvDouble)->
add("intValue", pvInt)->
add("timeStamp",standardField->timeStamp())->
createUnion();
PVUnionPtr pvUnion = pvDataCreate->createPVUnion(_union);
PVUnionPtr pvUnion2 = pvDataCreate->createPVUnion(_union);
pvUnion2->copy(*pvUnion);
testOk(*pvUnion == *pvUnion2, "null PVUnion copy");
pvUnion->select<PVInt>("intValue")->put(123);
pvUnion2->copy(*pvUnion);
testOk(*pvUnion == *pvUnion2, "PVUnion scalar copy, to null PVUnion");
pvUnion->select("doubleValue");
pvUnion2->copy(*pvUnion);
testOk(*pvUnion == *pvUnion2, "PVUnion scalar copy, to different type PVUnion");
pvUnion->select<PVStructure>("timeStamp")->copy(
*pvStructure->getSubField<PVStructure>("timeStamp")
);
pvUnion2->copy(*pvUnion);
testOk(*pvUnion == *pvUnion2, "PVUnion PVStructure copy, to different type PVUnion");
}
示例15: test_nttable
void test_nttable()
{
testDiag("test_nttable");
NTTableBuilderPtr builder = NTTable::createBuilder();
testOk(builder.get() != 0, "Got builder");
NTTablePtr ntTable = builder->
addColumn("column0", pvDouble)->
addColumn("column1", pvString)->
addColumn("column2", pvInt)->
addDescriptor()->
addAlarm()->
addTimeStamp()->
create();
testOk1(ntTable.get() != 0);
testOk1(ntTable->getPVStructure().get() != 0);
testOk1(ntTable->getDescriptor().get() != 0);
testOk1(ntTable->getAlarm().get() != 0);
testOk1(ntTable->getTimeStamp().get() != 0);
testOk1(ntTable->getLabels().get() != 0);
testOk1(ntTable->getColumn<PVDoubleArray>("column0").get() != 0);
testOk1(ntTable->getColumn<PVStringArray>("column1").get() != 0);
testOk1(ntTable->getColumn<PVIntArray>("column2").get() != 0);
testOk1(ntTable->getColumn("invalid").get() == 0);
//
// example how to set column values
//
PVIntArray::svector newValues;
newValues.push_back(1);
newValues.push_back(2);
newValues.push_back(8);
PVIntArrayPtr intColumn = ntTable->getColumn<PVIntArray>("column2");
intColumn->replace(freeze(newValues));
//
// example how to get column values
//
PVIntArray::const_svector values(intColumn->view());
testOk1(values.size() == 3);
testOk1(values[0] == 1);
testOk1(values[1] == 2);
testOk1(values[2] == 8);
//
// timeStamp ops
//
PVTimeStamp pvTimeStamp;
if (ntTable->attachTimeStamp(pvTimeStamp))
{
testPass("timeStamp attach");
// example how to set current time
TimeStamp ts;
ts.getCurrent();
pvTimeStamp.set(ts);
// example how to get EPICS time
TimeStamp ts2;
pvTimeStamp.get(ts2);
testOk1(ts2.getEpicsSecondsPastEpoch() != 0);
}
else
testFail("timeStamp attach fail");
//
// alarm ops
//
PVAlarm pvAlarm;
if (ntTable->attachAlarm(pvAlarm))
{
testPass("alarm attach");
// example how to set an alarm
Alarm alarm;
alarm.setStatus(deviceStatus);
alarm.setSeverity(minorAlarm);
alarm.setMessage("simulation alarm");
pvAlarm.set(alarm);
}
else
testFail("alarm attach fail");
//
// set descriptor
//
ntTable->getDescriptor()->put("This is a test NTTable");
// dump NTTable
std::cout << *ntTable->getPVStructure() << std::endl;
}