Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::PrimitiveBase Class Reference

#include <plist.h>

Inheritance diagram for plist::PrimitiveBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

Provides common functionality to all primitive value classes (implemented in a templated subclass Primitive).

This class supports callbacks upon modification through the use of the PrimitiveListener interface. Note that we only store a pointer to the listener list, which is typically unallocated when no listeners are active. This should ensure minimal memory usage per object, as well as support safe storage of plist objects in inter-process shared memory regions.

If you are using these in a shared memory region, just be sure that only the process with listeners does any and all modifications, and that it unsubscribes before detaching from the region (or else destroys the region itself)

Definition at line 196 of file plist.h.

Public Member Functions

 PrimitiveBase ()
 constructor
 PrimitiveBase (const PrimitiveBase &pb)
 copy constructor (don't copy listeners)
PrimitiveBaseoperator= (const PrimitiveBase &pb)
 assignment (don't assign listeners)
 ~PrimitiveBase ()
 destructor
virtual void set (const std::string &str)=0
 assign a new value
virtual std::string get () const =0
 return current value as a string
virtual void addPrimitiveListener (PrimitiveListener *vl)
 get notified of changes; be sure to call removeValueListener before destructing vl!
virtual void removePrimitiveListener (PrimitiveListener *vl)
 no longer take notification of changes to this object's value

Protected Member Functions

virtual void fireValueChanged () const
 run through primitiveListeners, calling PrimitiveListener::plistValueChanged(*this)

Protected Attributes

std::list< PrimitiveListener * > * primitiveListeners
 stores a list of the current listeners


Constructor & Destructor Documentation

plist::PrimitiveBase::PrimitiveBase  )  [inline]
 

constructor

Definition at line 199 of file plist.h.

plist::PrimitiveBase::PrimitiveBase const PrimitiveBase pb  )  [inline]
 

copy constructor (don't copy listeners)

Definition at line 201 of file plist.h.

plist::PrimitiveBase::~PrimitiveBase  ) 
 

destructor

Definition at line 369 of file plist.cc.


Member Function Documentation

void plist::PrimitiveBase::addPrimitiveListener PrimitiveListener vl  )  [virtual]
 

get notified of changes; be sure to call removeValueListener before destructing vl!

Definition at line 374 of file plist.cc.

void plist::PrimitiveBase::fireValueChanged  )  const [protected, virtual]
 

run through primitiveListeners, calling PrimitiveListener::plistValueChanged(*this)

Definition at line 393 of file plist.cc.

Referenced by plist::Primitive< std::string >::LoadXML(), plist::Primitive< unsigned char >::LoadXML(), plist::Primitive< char >::LoadXML(), plist::Primitive< bool >::LoadXML(), plist::Primitive< unsigned char >::operator *=(), plist::Primitive< char >::operator *=(), plist::Primitive< unsigned char >::operator+=(), plist::Primitive< char >::operator+=(), plist::Primitive< unsigned char >::operator-=(), plist::Primitive< char >::operator-=(), plist::Primitive< unsigned char >::operator/=(), plist::Primitive< char >::operator/=(), plist::NamedEnumeration< T >::operator=(), plist::Primitive< std::string >::operator=(), plist::Primitive< unsigned char >::operator=(), plist::Primitive< char >::operator=(), plist::Primitive< bool >::operator=(), plist::Primitive< T >::operator=(), plist::NamedEnumeration< T >::set(), plist::Primitive< std::string >::set(), plist::Primitive< char >::set(), and plist::Primitive< bool >::set().

virtual std::string plist::PrimitiveBase::get  )  const [pure virtual]
 

return current value as a string

Implemented in plist::Primitive< bool >, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, and plist::NamedEnumeration< T >.

Referenced by plist::operator<<().

PrimitiveBase& plist::PrimitiveBase::operator= const PrimitiveBase pb  )  [inline]
 

assignment (don't assign listeners)

Definition at line 203 of file plist.h.

Referenced by plist::NamedEnumeration< T >::operator=().

void plist::PrimitiveBase::removePrimitiveListener PrimitiveListener vl  )  [virtual]
 

no longer take notification of changes to this object's value

Definition at line 381 of file plist.cc.

virtual void plist::PrimitiveBase::set const std::string &  str  )  [pure virtual]
 

assign a new value

Implemented in plist::Primitive< bool >, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, and plist::NamedEnumeration< T >.

Referenced by plist::Primitive< unsigned char >::LoadXML(), plist::Primitive< char >::LoadXML(), plist::Primitive< bool >::LoadXML(), and plist::operator>>().


Member Data Documentation

std::list<PrimitiveListener*>* plist::PrimitiveBase::primitiveListeners [protected]
 

stores a list of the current listeners

Definition at line 221 of file plist.h.

Referenced by addPrimitiveListener(), fireValueChanged(), removePrimitiveListener(), and ~PrimitiveBase().


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

Tekkotsu v2.4.1
Generated Tue Aug 16 16:35:14 2005 by Doxygen 1.4.4