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

#include <DLelement.h>

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

Detailed Description

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

The doubly linked list element, derived from SLelement.

This class extends the SLelelement class by adding a previous DLelement pointer

There is a tutorial about Doubly Linked Lists : http://bridgesuncc.github.io/tutorials/DoublyLinkedList.html

Parameters
Ethe application data type
Author
Kalpathi Subramanian
Date
6/11/15, 7/12/19

Classes

class  DLelement_constlisthelper
 these are helper classes for DLelement 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  DLelement_listhelper
 these are helper classes for DLelement 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

 DLelement (DLelement *n, DLelement *p=nullptr, const E &val=E(), const string &lab=string())
 
 DLelement (const E &val=E(), const string &lab=string())
 
virtual const string getDStype () const override
 
virtual DLelementgetNext () override
 
virtual const DLelementgetNext () const override
 
void setNext (DLelement *n)
 
virtual DLelementgetPrev ()
 
virtual const DLelementgetPrev () const
 
virtual void setPrev (DLelement *p)
 
- Public Member Functions inherited from bridges::datastructure::SLelement< E >
 SLelement (SLelement *next, const E &val=E(), const string &lab=string())
 
 SLelement (const E &val=E(), const string &lab=string())
 
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
 

Additional Inherited Members

- Protected Member Functions inherited from bridges::datastructure::SLelement< E >
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
 
- Static Protected Member Functions inherited from bridges::datastructure::Element< E >
static const string getLinkRepresentation (const LinkVisualizer &lv, const string &src, const string &dest)
 
- Protected Attributes inherited from bridges::datastructure::SLelement< E >
SLelementnext = nullptr
 
- Protected Attributes inherited from bridges::datastructure::Element< E >
unordered_map< Element *, LinkVisualizerlinks
 

Constructor & Destructor Documentation

◆ DLelement() [1/2]

template<typename E>
bridges::datastructure::DLelement< E >::DLelement ( DLelement< E > *  n,
DLelement< E > *  p = nullptr,
const E &  val = E(),
const string &  lab = string() 
)
inline

Constructs a dlelement with the provided value, label, next and previous elements. The defaults will be used if not provided.

Parameters
nThe next DLelement
pThe previous DLelement
valThe data to hold
labThe label to show

◆ DLelement() [2/2]

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

Constructs a dlelement with the provided value and label, setting the next and previous dlelements to NULL. The defaults will be used if not provided.

Parameters
valThe data to hold
labThe label to show

Member Function Documentation

◆ getDStype()

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

Return the data structure type

Returns
The name of this data structure type

Reimplemented from bridges::datastructure::SLelement< E >.

Reimplemented in bridges::datastructure::CircDLelement< E >.

◆ getNext() [1/2]

template<typename E>
virtual DLelement* bridges::datastructure::DLelement< E >::getNext ( )
inlineoverridevirtual

Return the next DL element.

Returns
The next DLelement

Reimplemented from bridges::datastructure::SLelement< E >.

Reimplemented in bridges::datastructure::CircDLelement< E >.

◆ getNext() [2/2]

template<typename E>
virtual const DLelement* bridges::datastructure::DLelement< E >::getNext ( ) const
inlineoverridevirtual

Constant version

Returns
The next DLelement

Reimplemented from bridges::datastructure::SLelement< E >.

Reimplemented in bridges::datastructure::CircDLelement< E >.

◆ getPrev() [1/2]

template<typename E>
virtual DLelement* bridges::datastructure::DLelement< E >::getPrev ( )
inlinevirtual

Returns the previous element in the list

Returns
The previous DLelement

Reimplemented in bridges::datastructure::CircDLelement< E >.

◆ getPrev() [2/2]

template<typename E>
virtual const DLelement* bridges::datastructure::DLelement< E >::getPrev ( ) const
inlinevirtual

Returns the previous element - Constant version

Returns
The previous DLelement

Reimplemented in bridges::datastructure::CircDLelement< E >.

◆ setNext()

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

Sets next element to "n"

Parameters
nThe next DLelement

◆ setPrev()

template<typename E>
virtual void bridges::datastructure::DLelement< E >::setPrev ( DLelement< E > *  p)
inlinevirtual

Sets prev element to "p"

Parameters
pThe previous element

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