several minor problems found while developing pvDatabaseCPP

This commit is contained in:
Marty Kraimer
2012-12-12 14:59:33 -05:00
parent 18ba24156c
commit 4bc7e9c8fe
5 changed files with 29 additions and 11 deletions

View File

@@ -37,7 +37,7 @@
<h1>EPICS pvDataCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 01-Oct-2012</h2>
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 12-Dec-2012</h2>
<dl>
<dt>Latest version:</dt>
@@ -46,11 +46,11 @@
</dd>
<dt>This version:</dt>
<dd><a
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121026html">pvDataCPP_20121026html</a>
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121212html">pvDataCPP_20121212html</a>
</dd>
<dt>Previous version:</dt>
<dd><a
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121001.html">pvDataCPP_20121001.html</a>
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121026html">pvDataCPP_20121026html</a>
</dd>
<dt>Editors:</dt>
<dd>Marty Kraimer, BNL</dd>
@@ -97,7 +97,7 @@ Control System (EPICS).</a></p>
<h2 class="nocount">Status of this Document</h2>
<p>This is the 01-Oct-2012 version of the C++ implementation of pvData.</p>
<p>This is the 12-Dec-2012 version of the C++ implementation of pvData.</p>
<p> The text describes software which is a complete implementation of pvData as
currently planned by the EPICS V4 Working Group. </p> </p>
@@ -865,8 +865,7 @@ typedef std::tr1::shared_ptr&lt;PostHandler&gt; PostHandlerPtr</pre>
<p>PostHandler is a class that must be implemented by any code that calls
setPostHandler. It's single virtual method. postPut is called whenever
PVField::postPut is called.</p>
<pre>class PostHandler :
public std::tr1::enable_shared_from_this&lt;PostHandler&gt;
<pre>class PostHandler
{
public:
POINTER_DEFINITIONS(PostHandler);
@@ -3037,6 +3036,7 @@ public:
~Lock();
void lock();
void unlock();
bool tryLock();
bool ownsLock() ;
...
};</pre>

View File

@@ -62,7 +62,11 @@ template<typename T>
T BasePVScalar<T>::get() const { return value;}
template<typename T>
void BasePVScalar<T>::put(T val){value = val;}
void BasePVScalar<T>::put(T val)
{
value = val;
PVField::postPut();
}
template<typename T>
void BasePVScalar<T>::serialize(ByteBuffer *pbuffer,
@@ -120,7 +124,11 @@ BasePVString::~BasePVString() {}
String BasePVString::get() const { return value;}
void BasePVString::put(String val){value = val;}
void BasePVString::put(String val)
{
value = val;
postPut();
}
void BasePVString::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const

View File

@@ -158,7 +158,7 @@ void PVField::renameField(String const & newName)
void PVField::postPut()
{
if(postHandler!=NULL) postHandler->postPut();
if(postHandler.get()!=NULL) postHandler->postPut();
}
void PVField::setPostHandler(PostHandlerPtr const &handler)

View File

@@ -44,6 +44,15 @@ public:
locked=false;
}
}
bool tryLock()
{
if(locked) return true;
if(mutexPtr.tryLock()) {
locked = true;
return true;
}
return false;
}
bool ownsLock() const{return locked;}
private:
Mutex &mutexPtr;

View File

@@ -75,6 +75,8 @@ typedef std::vector<PVStructurePtr>::const_iterator PVStructurePtrArray_const__i
* typedef for a pointer to a PVStructureArray.
*/
typedef std::tr1::shared_ptr<PVStructureArray> PVStructureArrayPtr;
typedef std::vector<PVStructureArrayPtr> PVStructureArrayPtrArray;
typedef std::tr1::shared_ptr<PVStructureArrayPtrArray> PVStructureArrayPtrArrayPtr;
/**
* This class provides auxillary information about a PVField.
@@ -140,8 +142,7 @@ private:
/**
* This class is implemented by code that calls setPostHander
*/
class PostHandler :
public std::tr1::enable_shared_from_this<PostHandler>
class PostHandler
{
public:
POINTER_DEFINITIONS(PostHandler);