Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::OutputSelector Class Reference

Handles mapping <string> elements to the appropriate numeric offset using Capabilities database. More...

#include <plistSpecialty.h>

Inheritance diagram for plist::OutputSelector:

Detailed Description

Handles mapping <string> elements to the appropriate numeric offset using Capabilities database.

Values can be prefixed with the name of a model and '/' -- this is recommended for numeric values so they can be mapped portably to corresponding outputs on other models. This is not necessary when specifying output names, as the name is semantic and allows mapping through Capabilities.

By default, this class will accept any output offset, but through setRange(), can be configured to accept unactuated reference frames as well (e.g. CameraFrame). Invalid offsets can either trigger an exception or simply reset to UNUSED depending on throwOnInvalid.

This class stores the numeric output offset so it can be indexed into arrays.

Definition at line 28 of file plistSpecialty.h.

List of all members.

Classes

class  bad_value

Public Types

enum  { UNUSED = -1U }

Public Member Functions

 OutputSelector ()
 constructor
 OutputSelector (unsigned int v, bool isNum=false)
 casting constructor
OutputSelectoroperator= (const std::string &v)
 assignment from std::string, wraps it in a plist::Primitive and passes on to operator=(PrimitiveBase)
OutputSelectoroperator= (const unsigned int &v)
 assignment from value type (template specializations add in-place modiciation (e.g. +=, *=))
OutputSelectoroperator= (const OutputSelector &v)
void loadXML (xmlNode *node)
 interprets node as holding the specialization type
void saveXML (xmlNode *node) const
 saves val into node
void set (const std::string &str)
 assign a new value
std::string get () const
 return current value as a string
void setNumeric (bool isNum)
 sets useNumeric
bool getNumeric () const
 returns useNumeric
void setDefaultModel (const std::string &name)
 sets defModel
const std::string & getDefaultModel () const
 returns defModel
void setSaveModel (const std::string &name)
 sets saveModel
const std::string & getSaveModel () const
 returns saveModel
void setRange (unsigned int begin, unsigned int end)
 Sets range of acceptable output offsets between begin (inclusive) and end (exclusive).
unsigned int getRangeBegin () const
 returns rangeBegin
unsigned int getRangeEnd () const
 returns rangeEnd
void throwOnInvalid (bool b)
 sets throwInvalid
bool throwOnInvalid () const
 returns throwInvalid
virtual OutputSelectorclone () const __attribute__((warn_unused_result))
 clone definition for OutputSelector

Protected Attributes

bool useNumeric
 If true, requests that saves store the numeric value instead of corresponding output name.
std::string defModel
 Stores the model to assume when loading a numeric output offset without a model specifier *from a string/file*, blank means current global capabilities.
std::string saveModel
 If non-empty, indicates the model specifier to use when saving as a numeric (useNumeric).
unsigned int rangeBegin
 the first acceptable output offset, lower offsets will be set as UNUSED
unsigned int rangeEnd
 The one-past-last acceptable output offset, higher offsets will be set as UNUSED.
bool throwInvalid
 If true, out-of-range or unknown values will throw an OutputSelector::bad_value exception instead of being marked UNUSED.
bool throwUnused
 If true, will throw an OutputSelector::bad_value exception for attempts to explicitly mark the output UNUSED (e.g. empty string, -1U numeric...).

Member Enumeration Documentation

anonymous enum
Enumerator:
UNUSED 

Definition at line 30 of file plistSpecialty.h.


Constructor & Destructor Documentation

plist::OutputSelector::OutputSelector (  ) 

constructor

Definition at line 50 of file plistSpecialty.h.

plist::OutputSelector::OutputSelector ( unsigned int  v,
bool  isNum = false 
)

casting constructor

Definition at line 51 of file plistSpecialty.h.


Member Function Documentation

OutputSelector * plist::OutputSelector::clone (  )  const [virtual]

clone definition for OutputSelector

implements the clone function for Primitive<char>

Reimplemented from plist::Primitive< unsigned int >.

Definition at line 364 of file plistSpecialty.cc.

const std::string& plist::OutputSelector::getDefaultModel (  )  const

returns defModel

Definition at line 67 of file plistSpecialty.h.

bool plist::OutputSelector::getNumeric (  )  const

returns useNumeric

Definition at line 64 of file plistSpecialty.h.

unsigned int plist::OutputSelector::getRangeBegin (  )  const

returns rangeBegin

Definition at line 76 of file plistSpecialty.h.

unsigned int plist::OutputSelector::getRangeEnd (  )  const

returns rangeEnd

Definition at line 77 of file plistSpecialty.h.

const std::string& plist::OutputSelector::getSaveModel (  )  const

returns saveModel

Definition at line 70 of file plistSpecialty.h.

void plist::OutputSelector::loadXML ( xmlNode node  )  [virtual]

interprets node as holding the specialization type

Reimplemented from plist::Primitive< unsigned int >.

Definition at line 65 of file plistSpecialty.cc.

OutputSelector& plist::OutputSelector::operator= ( const OutputSelector v  ) 

Definition at line 54 of file plistSpecialty.h.

Referenced by operator=().

OutputSelector & plist::OutputSelector::operator= ( const unsigned int &  v  ) 

assignment from value type (template specializations add in-place modiciation (e.g. +=, *=))

Reimplemented from plist::Primitive< unsigned int >.

Definition at line 43 of file plistSpecialty.cc.

OutputSelector& plist::OutputSelector::operator= ( const std::string &  v  ) 

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

Reimplemented from plist::PrimitiveBase.

Definition at line 52 of file plistSpecialty.h.

void plist::OutputSelector::saveXML ( xmlNode node  )  const [virtual]

saves val into node

Reimplemented from plist::Primitive< unsigned int >.

Definition at line 160 of file plistSpecialty.cc.

void plist::OutputSelector::set ( const std::string &  str  )  [virtual]

assign a new value

Reimplemented from plist::Primitive< unsigned int >.

Definition at line 177 of file plistSpecialty.cc.

void plist::OutputSelector::setDefaultModel ( const std::string &  name  ) 

sets defModel

Definition at line 66 of file plistSpecialty.h.

void plist::OutputSelector::setNumeric ( bool  isNum  ) 

sets useNumeric

Definition at line 63 of file plistSpecialty.h.

void plist::OutputSelector::setRange ( unsigned int  begin,
unsigned int  end 
)

Sets range of acceptable output offsets between begin (inclusive) and end (exclusive).

You could use this to restrict the type of outputs which can be assigned (e.g. LEDOffset to LEDOffset+NumLEDs), or to expand the range to include unactuated reference frames (0 to NumReferenceFrames)

Definition at line 346 of file plistSpecialty.cc.

Referenced by DriverMessaging::ContactPoint::init(), and KinematicJoint::initEntries().

void plist::OutputSelector::setSaveModel ( const std::string &  name  ) 

sets saveModel

Definition at line 69 of file plistSpecialty.h.

bool plist::OutputSelector::throwOnInvalid (  )  const

returns throwInvalid

Definition at line 80 of file plistSpecialty.h.

void plist::OutputSelector::throwOnInvalid ( bool  b  ) 

sets throwInvalid

Definition at line 79 of file plistSpecialty.h.


Member Data Documentation

std::string plist::OutputSelector::defModel [protected]

Stores the model to assume when loading a numeric output offset without a model specifier *from a string/file*, blank means current global capabilities.

Definition at line 88 of file plistSpecialty.h.

Referenced by getDefaultModel(), loadXML(), set(), and setDefaultModel().

unsigned int plist::OutputSelector::rangeBegin [protected]

the first acceptable output offset, lower offsets will be set as UNUSED

Definition at line 93 of file plistSpecialty.h.

Referenced by getRangeBegin(), loadXML(), operator=(), set(), and setRange().

unsigned int plist::OutputSelector::rangeEnd [protected]

The one-past-last acceptable output offset, higher offsets will be set as UNUSED.

Definition at line 95 of file plistSpecialty.h.

Referenced by getRangeEnd(), loadXML(), operator=(), set(), and setRange().

std::string plist::OutputSelector::saveModel [protected]

If non-empty, indicates the model specifier to use when saving as a numeric (useNumeric).

This is set whenever a value with a specifier is loaded from a file.

Definition at line 91 of file plistSpecialty.h.

Referenced by get(), getSaveModel(), loadXML(), saveXML(), set(), and setSaveModel().

If true, out-of-range or unknown values will throw an OutputSelector::bad_value exception instead of being marked UNUSED.

Definition at line 97 of file plistSpecialty.h.

Referenced by loadXML(), operator=(), set(), setRange(), and throwOnInvalid().

If true, will throw an OutputSelector::bad_value exception for attempts to explicitly mark the output UNUSED (e.g. empty string, -1U numeric...).

Definition at line 99 of file plistSpecialty.h.

Referenced by loadXML(), operator=(), and set().

If true, requests that saves store the numeric value instead of corresponding output name.

Definition at line 83 of file plistSpecialty.h.

Referenced by get(), getNumeric(), loadXML(), saveXML(), and setNumeric().


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

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