Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::PrimitiveBase Class Reference

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

#include <plistBase.h>

Inheritance diagram for plist::PrimitiveBase:

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 245 of file plistBase.h.

List of all members.

Public Member Functions

 PrimitiveBase ()
 constructor
 PrimitiveBase (const PrimitiveBase &pb)
 copy constructor (don't copy listeners)
virtual PrimitiveBaseoperator= (const PrimitiveBase &pb)
 assignment (don't assign listeners); doesn't trigger fireValueChanged, subclass should do that from its own operator=() following assignment
PrimitiveBaseoperator= (const Primitive< std::string > &v)
 assignment from Primitive<string>, solely to resolve ambiguity with this type between operator=(PrimitiveBase) and operator=(std::string)
PrimitiveBaseoperator= (const std::string &v)
 assignment from std::string, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)
PrimitiveBaseoperator= (long v)
 assignment from long value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)
PrimitiveBaseoperator= (unsigned long v)
 assignment from unsigned long value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)
PrimitiveBaseoperator= (double v)
 assignment from double value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)
 ~PrimitiveBase ()
 destructor
virtual void set (const std::string &str)=0
 assign a new value
virtual void set (const ObjectBase &ob)
 polymorphic assignment (throws std::bad_cast if the assignment is between invalid types, i.e. a primitive and a collection, or different collection types)
virtual std::string get () const =0
 return current value as a string
virtual bool operator== (const PrimitiveBase &other)=0
virtual std::string toString () const
 return current value as a string
virtual void addPrimitiveListener (PrimitiveListener *vl) const
 get notified of changes; be sure to call removeValueListener before destructing vl!
virtual void removePrimitiveListener (PrimitiveListener *vl) const
 no longer take notification of changes to this object's value
virtual bool isPrimitiveListener (PrimitiveListener *vl) const
 test if l is currently registered as a listener

Protected Member Functions

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

Protected Attributes

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

Constructor & Destructor Documentation

plist::PrimitiveBase::PrimitiveBase (  ) 

constructor

Definition at line 248 of file plistBase.h.

plist::PrimitiveBase::PrimitiveBase ( const PrimitiveBase pb  ) 

copy constructor (don't copy listeners)

Definition at line 250 of file plistBase.h.

plist::PrimitiveBase::~PrimitiveBase (  ) 

destructor

Definition at line 112 of file plistBase.cc.


Member Function Documentation

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

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

Definition at line 117 of file plistBase.cc.

Referenced by KinematicJoint::addSelfListener(), KinematicJoint::getIK(), and XWalkMC::ParameterTransition::ParameterTransition().

void plist::PrimitiveBase::fireValueChanged ( bool  touch  )  const [protected, virtual]
bool plist::PrimitiveBase::isPrimitiveListener ( PrimitiveListener vl  )  const [virtual]

test if l is currently registered as a listener

Definition at line 136 of file plistBase.cc.

PrimitiveBase & plist::PrimitiveBase::operator= ( double  v  ) 

assignment from double value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)

Definition at line 110 of file plistBase.cc.

PrimitiveBase & plist::PrimitiveBase::operator= ( unsigned long  v  ) 

assignment from unsigned long value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)

Definition at line 109 of file plistBase.cc.

PrimitiveBase & plist::PrimitiveBase::operator= ( long  v  ) 

assignment from long value, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)

Definition at line 108 of file plistBase.cc.

PrimitiveBase & plist::PrimitiveBase::operator= ( const Primitive< std::string > &  v  ) 

assignment from Primitive<string>, solely to resolve ambiguity with this type between operator=(PrimitiveBase) and operator=(std::string)

Definition at line 106 of file plistBase.cc.

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

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

Definition at line 124 of file plistBase.cc.

Referenced by KinematicJoint::plistValueChanged(), KinematicJoint::removeSelfListener(), and XWalkMC::ParameterTransition::~ParameterTransition().

virtual void plist::PrimitiveBase::set ( const ObjectBase  )  [virtual]

polymorphic assignment (throws std::bad_cast if the assignment is between invalid types, i.e. a primitive and a collection, or different collection types)

Implements plist::ObjectBase.

Definition at line 268 of file plistBase.h.

virtual std::string plist::PrimitiveBase::toString (  )  const [virtual]

return current value as a string

Implements plist::ObjectBase.

Definition at line 274 of file plistBase.h.


Member Data Documentation

stores a list of the current listeners

Definition at line 287 of file plistBase.h.

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


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:24 2016 by Doxygen 1.6.3