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
+10 -2
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
+1 -1
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)
+9
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;
+3 -2
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);