SUMO - Simulation of Urban MObility
GNEAttributeCarrier Class Referenceabstract

#include <GNEAttributeCarrier.h>

Inheritance diagram for GNEAttributeCarrier:
Inheritance graph
Collaboration diagram for GNEAttributeCarrier:
Collaboration graph

Public Member Functions

void decRef (const std::string &debugMsg="")
 
virtual std::string getAttribute (SumoXMLAttr key) const =0
 
const std::vector< SumoXMLAttr > & getAttrs () const
 
virtual std::string getDescription ()
 how should this attribute carrier be called More...
 
const std::string getID () const
 function to support debugging More...
 
SumoXMLTag getTag () const
 
 GNEAttributeCarrier (SumoXMLTag tag)
 Constructor. More...
 
void incRef (const std::string &debugMsg="")
 
virtual bool isValid (SumoXMLAttr key, const std::string &value)
 
template<>
int parse (const std::string &string)
 
template<>
SUMOReal parse (const std::string &string)
 
virtual void setAttribute (SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
 
bool unreferenced ()
 
virtual ~GNEAttributeCarrier ()
 Destructor. More...
 

Static Public Member Functions

static const std::vector< SumoXMLAttr > & allowedAttributes (SumoXMLTag tag)
 get all editable attributes for tag. More...
 
static const std::vector< SumoXMLTag > & allowedTags ()
 get all editable attributes for tag. More...
 
template<typename T >
static bool canParse (const std::string &string)
 true if a number of type T can be parsed from string More...
 
static const std::vector< std::string > & discreteChoices (SumoXMLTag tag, SumoXMLAttr attr)
 return a list of discrete choices for this attribute or an empty vector More...
 
static bool discreteCombinableChoices (SumoXMLTag tag, SumoXMLAttr attr)
 return whether the given attribute allows for a combination of discrete values More...
 
static bool isNumerical (SumoXMLAttr attr)
 whether an attribute is numerical More...
 
template<typename T >
static bool isPositive (const std::string &string)
 true if a positive number of type T can be parsed from string More...
 
static bool isUnique (SumoXMLAttr attr)
 whether an attribute is unique (may not be edited for a multi-selection) More...
 
static bool isValidID (const std::string &value)
 true if value is a valid sumo ID More...
 
template<typename T >
static T parse (const std::string &string)
 parses a number of type T from string More...
 

Static Public Attributes

static const std::string APPROVED = "approved"
 feature has been approved but not changed (i.e. after being reguessed) More...
 
static const std::string GUESSED = "guessed"
 feature has been reguessed (may still be unchanged be we can't tell (yet) More...
 
static const std::string LOADED = "loaded"
 feature is still unchanged after being loaded (implies approval) More...
 
static const std::string MODIFIED = "modified"
 feature has been manually modified (implies approval) More...
 

Private Member Functions

GNEAttributeCarrieroperator= (const GNEAttributeCarrier &src)
 Invalidated assignment operator. More...
 
virtual void setAttribute (SumoXMLAttr key, const std::string &value)=0
 

Private Attributes

const SumoXMLTag myTag
 the xml tag to which this carrier corresponds More...
 

Static Private Attributes

static std::map< SumoXMLTag, std::vector< SumoXMLAttr > > _allowedAttributes
 
static std::vector< SumoXMLTag_allowedTags
 
static std::map< SumoXMLTag, std::map< SumoXMLAttr, std::vector< std::string > > > _discreteChoices
 
static std::set< SumoXMLAttr_numericalAttrs
 
static std::set< SumoXMLAttr_uniqueAttrs
 

Friends

class GNEChange_Attribute
 

Detailed Description

Abstract Base class for gui objects which carry attributes inherits from GNEReferenceCounter for convenience

Definition at line 57 of file GNEAttributeCarrier.h.

Constructor & Destructor Documentation

GNEAttributeCarrier::GNEAttributeCarrier ( SumoXMLTag  tag)

Constructor.

Definition at line 57 of file GNEAttributeCarrier.cpp.

virtual GNEAttributeCarrier::~GNEAttributeCarrier ( )
inlinevirtual

Destructor.

Definition at line 69 of file GNEAttributeCarrier.h.

References getAttribute(), isValid(), and setAttribute().

Member Function Documentation

const std::vector< SumoXMLTag > & GNEAttributeCarrier::allowedTags ( )
static

get all editable attributes for tag.

Definition at line 157 of file GNEAttributeCarrier.cpp.

References _allowedTags, SUMO_TAG_EDGE, SUMO_TAG_JUNCTION, and SUMO_TAG_LANE.

Referenced by getID(), GNESelector::GNESelector(), GNESelector::onCmdSelMBString(), and GNESelector::onCmdSelMBTag().

template<typename T >
static bool GNEAttributeCarrier::canParse ( const std::string &  string)
inlinestatic

true if a number of type T can be parsed from string

Definition at line 121 of file GNEAttributeCarrier.h.

References parse().

bool GNEAttributeCarrier::discreteCombinableChoices ( SumoXMLTag  tag,
SumoXMLAttr  attr 
)
static

return whether the given attribute allows for a combination of discrete values

Definition at line 236 of file GNEAttributeCarrier.cpp.

References SUMO_ATTR_ALLOW, and SUMO_ATTR_DISALLOW.

Referenced by GNEInspector::AttrInput::AttrInput(), and getID().

virtual std::string GNEAttributeCarrier::getAttribute ( SumoXMLAttr  key) const
pure virtual
const std::vector<SumoXMLAttr>& GNEAttributeCarrier::getAttrs ( ) const
inline

Definition at line 92 of file GNEAttributeCarrier.h.

References allowedAttributes(), and myTag.

Referenced by isValid().

virtual std::string GNEAttributeCarrier::getDescription ( )
inlinevirtual

how should this attribute carrier be called

Definition at line 84 of file GNEAttributeCarrier.h.

References myTag, and toString().

Referenced by GNEChange_Attribute::redoName(), and GNEChange_Attribute::undoName().

const std::string GNEAttributeCarrier::getID ( ) const
inlinevirtual
SumoXMLTag GNEAttributeCarrier::getTag ( ) const
inline

Definition at line 88 of file GNEAttributeCarrier.h.

References myTag.

Referenced by GNESelector::getMatches().

void GNEReferenceCounter::incRef ( const std::string &  debugMsg = "")
inlineinherited
template<typename T >
static bool GNEAttributeCarrier::isPositive ( const std::string &  string)
inlinestatic

true if a positive number of type T can be parsed from string

Definition at line 138 of file GNEAttributeCarrier.h.

References isValidID().

bool GNEAttributeCarrier::isUnique ( SumoXMLAttr  attr)
static

whether an attribute is unique (may not be edited for a multi-selection)

Definition at line 186 of file GNEAttributeCarrier.cpp.

References _uniqueAttrs, SUMO_ATTR_EDGES, SUMO_ATTR_FROM, SUMO_ATTR_ID, SUMO_ATTR_POSITION, SUMO_ATTR_SHAPE, and SUMO_ATTR_TO.

Referenced by GNEInspector::AttrPanel::AttrPanel(), and getID().

bool GNEAttributeCarrier::isValid ( SumoXMLAttr  key,
const std::string &  value 
)
virtual

Reimplemented in GNEEdge, GNEJunction, GNEPoly, GNELane, GNECrossing, and GNEPOI.

Definition at line 63 of file GNEAttributeCarrier.cpp.

References getAttrs(), and UNUSED_PARAMETER.

Referenced by ~GNEAttributeCarrier().

bool GNEAttributeCarrier::isValidID ( const std::string &  value)
static

true if value is a valid sumo ID

Definition at line 70 of file GNEAttributeCarrier.cpp.

Referenced by isPositive(), GNEJunction::isValid(), and GNEEdge::isValid().

GNEAttributeCarrier& GNEAttributeCarrier::operator= ( const GNEAttributeCarrier src)
private

Invalidated assignment operator.

template<>
int GNEAttributeCarrier::parse ( const std::string &  string)

Definition at line 76 of file GNEAttributeCarrier.cpp.

References TplConvert::_str2int(), and SUMOReal.

template<>
SUMOReal GNEAttributeCarrier::parse ( const std::string &  string)

Definition at line 82 of file GNEAttributeCarrier.cpp.

References TplConvert::_str2SUMOReal().

template<typename T >
static T GNEAttributeCarrier::parse ( const std::string &  string)
static

parses a number of type T from string

Referenced by canParse().

virtual void GNEAttributeCarrier::setAttribute ( SumoXMLAttr  key,
const std::string &  value,
GNEUndoList undoList 
)
pure virtual
virtual void GNEAttributeCarrier::setAttribute ( SumoXMLAttr  key,
const std::string &  value 
)
privatepure virtual

Friends And Related Function Documentation

Field Documentation

std::map< SumoXMLTag, std::vector< SumoXMLAttr > > GNEAttributeCarrier::_allowedAttributes
staticprivate

Definition at line 164 of file GNEAttributeCarrier.h.

Referenced by allowedAttributes().

std::vector< SumoXMLTag > GNEAttributeCarrier::_allowedTags
staticprivate

Definition at line 165 of file GNEAttributeCarrier.h.

Referenced by allowedTags().

std::map< SumoXMLTag, std::map< SumoXMLAttr, std::vector< std::string > > > GNEAttributeCarrier::_discreteChoices
staticprivate

Definition at line 168 of file GNEAttributeCarrier.h.

Referenced by discreteChoices().

std::set< SumoXMLAttr > GNEAttributeCarrier::_numericalAttrs
staticprivate

Definition at line 166 of file GNEAttributeCarrier.h.

Referenced by isNumerical().

std::set< SumoXMLAttr > GNEAttributeCarrier::_uniqueAttrs
staticprivate

Definition at line 167 of file GNEAttributeCarrier.h.

Referenced by isUnique().

const std::string GNEAttributeCarrier::APPROVED = "approved"
static

feature has been approved but not changed (i.e. after being reguessed)

Definition at line 152 of file GNEAttributeCarrier.h.

const std::string GNEAttributeCarrier::GUESSED = "guessed"
static

feature has been reguessed (may still be unchanged be we can't tell (yet)

Definition at line 148 of file GNEAttributeCarrier.h.

Referenced by GNEEdge::setAttribute(), and GNEJunction::setResponsible().

const std::string GNEAttributeCarrier::LOADED = "loaded"
static

feature is still unchanged after being loaded (implies approval)

Definition at line 146 of file GNEAttributeCarrier.h.

const std::string GNEAttributeCarrier::MODIFIED = "modified"
static

feature has been manually modified (implies approval)

Definition at line 150 of file GNEAttributeCarrier.h.

Referenced by GNEConnector::onCmdClearSelectedConnections(), and GNEEdge::setAttribute().

const SumoXMLTag GNEAttributeCarrier::myTag
private

the xml tag to which this carrier corresponds

Definition at line 162 of file GNEAttributeCarrier.h.

Referenced by getAttrs(), getDescription(), and getTag().


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