Bridges-C++  3.1.1
Bridges(C++API)
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bridges::datastructure::SLelement< E > Class Template Reference

#include <SLelement.h>

Inheritance diagram for bridges::datastructure::SLelement< E >:
bridges::datastructure::Element< E > bridges::datastructure::DataStructure bridges::datastructure::CircSLelement< E > bridges::datastructure::DLelement< E > bridges::datastructure::MLelement< E > bridges::datastructure::CircDLelement< E >

Detailed Description

template<typename E>
class bridges::datastructure::SLelement< E >

The singly linked list element, derived from Element.

This class can be used to create singly linked elements, with a next SLelement pointer

See also
There is a tutorial about Singly Linked Lists : http://bridgesuncc.github.io/tutorials/SinglyLinkedList.html
Parameters
Ethe application data type
Author
Kalpathi Subramanian
Date
6/11/15, 7/12/19

Classes

class  SLelement_constlisthelper
 these are helper classes for SLelement for easy iteration in a range for loop. It is not meant to be created by the bridges user. But it may be returned by Bridges to provide an STL compliant list API. More...
 
class  SLelement_listhelper
 these are helper classes for SLelement for easy iteration in a range for loop. It is not meant to be created by the bridges user. But it may be returned by Bridges to provide an STL compliant list API. More...
 

Public Member Functions

 SLelement (SLelement *next, const E &val=E(), const string &lab=string())
 
 SLelement (const E &val=E(), const string &lab=string())
 
virtual const string getDStype () const override
 
virtual SLelementgetNext ()
 
virtual const SLelementgetNext () const
 
void setNext (SLelement *n)
 
- Public Member Functions inherited from bridges::datastructure::Element< E >
 Element (const E &val=E(), const string &lab=string())
 
 Element (const Element &e)
 
Elementoperator= (const Element &e)
 
E & operator= (E const &e)
 
virtual ~Element ()
 
ElementVisualizergetVisualizer ()
 
const ElementVisualizergetVisualizer () const
 
LinkVisualizergetLinkVisualizer (const Element *el)
 
LinkVisualizergetLinkVisualizer (const Element *el) const
 
string const & getLabel () const
 
void setLabel (const string &lab)
 
E const & getValue () const
 
E & getValue ()
 
void setValue (const E &val)
 
void setSize (const double &sz)
 Sets size of the element. More...
 
double getSize () const
 
void setColor (const Color &col)
 Set the color of the Element. More...
 
void setColor (const string col)
 Set the color by name. More...
 
Color getColor () const
 Get the current color of the element. More...
 
void setOpacity (double opacity)
 
double getOpacity ()
 
void setShape (const Shape &shp)
 Set the shape of the element. More...
 
Shape getShape () const
 Returns the shape of the element. More...
 
void setLocation (const double &locX, const double &locY)
 
double getLocationX () const
 
double getLocationY () const
 
- Public Member Functions inherited from bridges::datastructure::DataStructure
virtual ~DataStructure ()=default
 

Protected Member Functions

virtual const pair< string, string > generateJSON (vector< const SLelement< E > *> nodes) const
 
virtual void getListElements (vector< const SLelement< E > *> &nodes) const
 
- Protected Member Functions inherited from bridges::datastructure::Element< E >
virtual const string getElementRepresentation () const
 

Protected Attributes

SLelementnext = nullptr
 
- Protected Attributes inherited from bridges::datastructure::Element< E >
unordered_map< Element *, LinkVisualizerlinks
 

Additional Inherited Members

- Static Protected Member Functions inherited from bridges::datastructure::Element< E >
static const string getLinkRepresentation (const LinkVisualizer &lv, const string &src, const string &dest)
 

Constructor & Destructor Documentation

◆ SLelement() [1/2]

template<typename E>
bridges::datastructure::SLelement< E >::SLelement ( SLelement< E > *  next,
const E &  val = E(),
const string &  lab = string() 
)
inline

Constructs an slelement with the provided value, label, and next slelement. The defaults will be used if not provided.

Parameters
valThe data to hold
labThe label to show
nextThe next SLelement

◆ SLelement() [2/2]

template<typename E>
bridges::datastructure::SLelement< E >::SLelement ( const E &  val = E(),
const string &  lab = string() 
)
inline

Constructs an slelement with the provided value and label, setting the next slelement to NULL. The defaults will be used if not provided.

Parameters
valThe data to hold
labThe label to show

Member Function Documentation

◆ generateJSON()

template<typename E>
virtual const pair<string, string> bridges::datastructure::SLelement< E >::generateJSON ( vector< const SLelement< E > *>  nodes) const
inlineprotectedvirtual

Generates the JSON representation of the nodes and links

Returns
JSON string pair containing the nodes and links

◆ getDStype()

template<typename E>
virtual const string bridges::datastructure::SLelement< E >::getDStype ( ) const
inlineoverridevirtual

Returns the data structure name

Returns
The string representation of this data structure type

Implements bridges::datastructure::DataStructure.

Reimplemented in bridges::datastructure::MLelement< E >, bridges::datastructure::CircDLelement< E >, bridges::datastructure::CircSLelement< E >, and bridges::datastructure::DLelement< E >.

◆ getListElements()

template<typename E>
virtual void bridges::datastructure::SLelement< E >::getListElements ( vector< const SLelement< E > *> &  nodes) const
inlineprotectedvirtual

Get the list of nodes

Parameters
nodesThe list of nodes

◆ getNext() [1/2]

template<typename E>
virtual SLelement* bridges::datastructure::SLelement< E >::getNext ( )
inlinevirtual

◆ getNext() [2/2]

template<typename E>
virtual const SLelement* bridges::datastructure::SLelement< E >::getNext ( ) const
inlinevirtual

Returns the next element in the list - Constant version

Returns
The next SLelement

Reimplemented in bridges::datastructure::MLelement< E >, bridges::datastructure::CircDLelement< E >, and bridges::datastructure::DLelement< E >.

◆ setNext()

template<typename E>
void bridges::datastructure::SLelement< E >::setNext ( SLelement< E > *  n)
inline

Sets next link to "n"

Parameters
nThe next SLelement

Member Data Documentation

◆ next

template<typename E>
SLelement* bridges::datastructure::SLelement< E >::next = nullptr
protected

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