This is Unofficial EPICS BASE Doxygen Site
epics::pvDatabase::PVRecordField Class Reference

Interface for a field of a record. More...

#include "pvDatabase.h"

+ Inheritance diagram for epics::pvDatabase::PVRecordField:
+ Collaboration diagram for epics::pvDatabase::PVRecordField:

Public Member Functions

 POINTER_DEFINITIONS (PVRecordField)
 
 PVRecordField (epics::pvData::PVFieldPtr const &pvField, PVRecordStructurePtr const &parent, PVRecordPtr const &pvRecord)
 Constructor. More...
 
virtual ~PVRecordField ()
 Destructor. More...
 
PVRecordStructurePtr getParent ()
 Get the parent. More...
 
epics::pvData::PVFieldPtr getPVField ()
 Get the PVField. More...
 
std::string getFullFieldName ()
 Get the full name of the field, i.e. field,field,.. More...
 
std::string getFullName ()
 Get the recordName plus the full name of the field, i.e. recordName.field,field,.. More...
 
PVRecordPtr getPVRecord ()
 Return the PVRecord to which this field belongs. More...
 
virtual void postPut ()
 This is called by the code that implements the data interface. It is called whenever the put method is called. More...
 
- Public Member Functions inherited from epics::pvData::PostHandler
 POINTER_DEFINITIONS (PostHandler)
 
virtual ~PostHandler ()
 

Protected Member Functions

virtual void init ()
 
virtual void postParent (PVRecordFieldPtr const &subField)
 
virtual void postSubField ()
 

Friends

class PVRecordStructure
 
class PVRecord
 

Detailed Description

Interface for a field of a record.

One exists for each field of the top level PVStructure.

Author
mrk

Definition at line 286 of file pvDatabase.h.

Constructor & Destructor Documentation

epics::pvDatabase::PVRecordField::PVRecordField ( epics::pvData::PVFieldPtr const &  pvField,
PVRecordStructurePtr const &  parent,
PVRecordPtr const &  pvRecord 
)

Constructor.

Parameters
pvFieldThe field from the top level structure.
parentThe parent.
pvRecordThe PVRecord.

Definition at line 323 of file pvRecord.cpp.

327 : pvField(pvField),
328  isStructure(pvField->getField()->getType()==structure ? true : false),
329  parent(parent),
330  pvRecord(pvRecord)
331 {
332 }
virtual epics::pvDatabase::PVRecordField::~PVRecordField ( )
inlinevirtual

Destructor.

Definition at line 306 of file pvDatabase.h.

306 {}

Member Function Documentation

string epics::pvDatabase::PVRecordField::getFullFieldName ( )

Get the full name of the field, i.e. field,field,..

Returns
The full name.

Definition at line 362 of file pvRecord.cpp.

362 {return fullFieldName; }
string epics::pvDatabase::PVRecordField::getFullName ( )

Get the recordName plus the full name of the field, i.e. recordName.field,field,..

Returns
The name.

Definition at line 364 of file pvRecord.cpp.

364 {return fullName; }
PVRecordStructurePtr epics::pvDatabase::PVRecordField::getParent ( )

Get the parent.

Returns
The parent.

Definition at line 355 of file pvRecord.cpp.

356 {
357  return parent.lock();
358 }
PVFieldPtr epics::pvDatabase::PVRecordField::getPVField ( )

Get the PVField.

Returns
The shared pointer.

Definition at line 360 of file pvRecord.cpp.

360 {return pvField.lock();}
PVRecordPtr epics::pvDatabase::PVRecordField::getPVRecord ( )

Return the PVRecord to which this field belongs.

Returns
The shared pointer,

Definition at line 366 of file pvRecord.cpp.

366 {return pvRecord.lock();}
void epics::pvDatabase::PVRecordField::init ( )
protectedvirtual

Reimplemented in epics::pvDatabase::PVRecordStructure.

Definition at line 334 of file pvRecord.cpp.

335 {
336  fullFieldName = pvField.lock()->getFieldName();
337  PVRecordStructurePtr pvParent(parent.lock());
338  while(pvParent) {
339  string parentName = pvParent->getPVField()->getFieldName();
340  if(parentName.size()>0) {
341  fullFieldName = pvParent->getPVField()->getFieldName()
342  + '.' + fullFieldName;
343  }
344  pvParent = pvParent->getParent();
345  }
346  PVRecordPtr pvRecord(this->pvRecord.lock());
347  if(fullFieldName.size()>0) {
348  fullName = pvRecord->getRecordName() + '.' + fullFieldName;
349  } else {
350  fullName = pvRecord->getRecordName();
351  }
352  pvField.lock()->setPostHandler(shared_from_this());
353 }
std::tr1::shared_ptr< PVRecord > PVRecordPtr
Definition: pvDatabase.h:21
std::tr1::shared_ptr< PVRecordStructure > PVRecordStructurePtr
Definition: pvDatabase.h:31
epics::pvDatabase::PVRecordField::POINTER_DEFINITIONS ( PVRecordField  )
void epics::pvDatabase::PVRecordField::postParent ( PVRecordFieldPtr const &  subField)
protectedvirtual

Definition at line 404 of file pvRecord.cpp.

405 {
406  PVRecordStructurePtr pvrs = static_pointer_cast<PVRecordStructure>(shared_from_this());
407  std::list<PVListenerWPtr>::iterator iter;
408  for(iter = pvListenerList.begin(); iter != pvListenerList.end(); ++iter)
409  {
410  PVListenerPtr listener = iter->lock();
411  if(!listener.get()) continue;
412  listener->dataPut(pvrs,subField);
413  }
414  PVRecordStructurePtr parent(this->parent.lock());
415  if(parent) parent->postParent(subField);
416 }
std::tr1::shared_ptr< PVListener > PVListenerPtr
Definition: pvDatabase.h:39
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
std::tr1::shared_ptr< PVRecordStructure > PVRecordStructurePtr
Definition: pvDatabase.h:31
Interface for a field that is a structure.
Definition: pvDatabase.h:365
void epics::pvDatabase::PVRecordField::postPut ( )
virtual

This is called by the code that implements the data interface. It is called whenever the put method is called.

Implements epics::pvData::PostHandler.

Definition at line 395 of file pvRecord.cpp.

396 {
397  PVRecordStructurePtr parent(this->parent.lock());;
398  if(parent) {
399  parent->postParent(shared_from_this());
400  }
401  postSubField();
402 }
std::tr1::shared_ptr< PVRecordStructure > PVRecordStructurePtr
Definition: pvDatabase.h:31
void epics::pvDatabase::PVRecordField::postSubField ( )
protectedvirtual

Definition at line 418 of file pvRecord.cpp.

419 {
420  callListener();
421  if(isStructure) {
422  PVRecordStructurePtr pvrs =
423  static_pointer_cast<PVRecordStructure>(shared_from_this());
424  PVRecordFieldPtrArrayPtr pvRecordFields = pvrs->getPVRecordFields();
425  PVRecordFieldPtrArray::iterator iter;
426  for(iter = pvRecordFields->begin() ; iter !=pvRecordFields->end(); iter++) {
427  (*iter)->postSubField();
428  }
429  }
430 }
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
PVRecordFieldPtrArrayPtr getPVRecordFields()
Get the sub fields.
Definition: pvRecord.cpp:479
std::tr1::shared_ptr< PVRecordStructure > PVRecordStructurePtr
Definition: pvDatabase.h:31
Interface for a field that is a structure.
Definition: pvDatabase.h:365
std::tr1::shared_ptr< PVRecordFieldPtrArray > PVRecordFieldPtrArrayPtr
Definition: pvDatabase.h:29

Friends And Related Function Documentation

friend class PVRecord
friend

Definition at line 356 of file pvDatabase.h.

friend class PVRecordStructure
friend

Definition at line 355 of file pvDatabase.h.


The documentation for this class was generated from the following files: