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

#include <CircSLelement.h>

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

Detailed Description

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

This class can be used to instantiate Singly Linked Circular List Elements.

This class can be used to instantiate Circular (Singly) Linked List Elements, derived from Singly Linked Element. The main difference from the SLelement is that they create circularly linked elements and their traversals are slightly different.

Elements have labels (string) that are displayed on the visualization Elements take an generic object as a user defined parameter, any native type or object.

Element contains a visualizer object for setting visual attributes (color, shape, opacity, size), necessary for displaying them in a web browser

See also
There is a tutorial about Circular Singly Linked Lists : https://bridgesuncc.github.io/tutorials/CircularSinglyLinkedList.html
Author
Kalpathi Subramanian
Date
10/5/2016, 7/12/19
Parameters
EUser type stored in the list

Classes

class  CircSLelement_constlisthelper
 these are helper classes for CircSLelement 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  CircSLelement_listhelper
 This is a helper class to facilitate using iterators to traverse circular list. More...
 

Public Member Functions

 CircSLelement ()
 
 CircSLelement (E val=E(), string label=string())
 
 CircSLelement (E e=E(), CircSLelement *next=nullptr)
 
 CircSLelement (CircSLelement *next)
 
virtual const string getDStype () const override
 
virtual CircSLelement< E > * getNext () override
 
void setNext (CircSLelement< E > *next)
 
- Public Member Functions inherited from bridges::datastructure::SLelement< E >
 SLelement (SLelement *next, const E &val=E(), const string &lab=string())
 Constructs an slelement with the provided value. More...
 
 SLelement (const E &val=E(), const string &lab=string())
 Constructs an slelement with the provided value. More...
 
virtual const SLelementgetNext () const
 Returns the next element in the list - Constant version. More...
 
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 ()
 Get the element visualizer object. More...
 
const ElementVisualizergetVisualizer () const
 Get the element visualizer object - constant version. More...
 
LinkVisualizergetLinkVisualizer (const Element *el)
 Returns the LinkVisualizer of element. More...
 
LinkVisualizergetLinkVisualizer (const Element *el) const
 Returns the LinkVisualizer of element. More...
 
string const & getLabel () const
 Gets the label of this element. More...
 
void setLabel (const string &lab)
 Sets label of this element. More...
 
E const & getValue () const
 Gets the object held in the generic object E. More...
 
E & getValue ()
 Gets the object held in the generic object E. More...
 
void setValue (const E &val)
 Sets generic object to "val". More...
 
void setSize (const double &sz)
 Sets size of the element. More...
 
double getSize () const
 Get element size. More...
 
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)
 Set opacity of element - use the 4th color component. More...
 
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)
 Sets the location attributes of an element. More...
 
double getLocationX () const
 Gets the X coordinate of the location. More...
 
double getLocationY () const
 Gets the Y coordinate of the location. More...
 
- 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
 Generates the JSON representation of the element. More...
 
virtual void getListElements (vector< const SLelement< E > * > &nodes) const
 Get the list of nodes. More...
 
- Protected Member Functions inherited from bridges::datastructure::Element< E >
virtual const string getElementRepresentation () const
 Gets the JSON string of the element representation. More...
 
- 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

◆ CircSLelement() [1/4]

template<typename E >
bridges::datastructure::CircSLelement< E >::CircSLelement ( )
inline

This constructor creates an CircSLelement object and sets its next pointer to itself

◆ CircSLelement() [2/4]

template<typename E >
bridges::datastructure::CircSLelement< E >::CircSLelement ( val = E(),
string  label = string() 
)
inline

This constructor creates an CircSLelement object of value "e" and label "label" and sets the next pointer to null

Parameters
labelthe label of CircSLelement that shows up on the Bridges visualization
valthe generic object that this CircSLelement will hold

◆ CircSLelement() [3/4]

template<typename E >
bridges::datastructure::CircSLelement< E >::CircSLelement ( e = E(),
CircSLelement< E > *  next = nullptr 
)
inline

Creates a new element with value "e" and sets the next pointer to the CircSLelement referenced by the "next" argument

Parameters
ethe generic object that this CircSLelement will hold
nextthe CircSLelement that should be assigned to the next pointer

◆ CircSLelement() [4/4]

template<typename E >
bridges::datastructure::CircSLelement< E >::CircSLelement ( CircSLelement< E > *  next)
inline

Creates a new element and sets the next pointer to the CircSLelement "next"

Parameters
nextthe CircSLelement that should be assigned to the next pointer

Member Function Documentation

◆ getDStype()

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

This method gets the data structure type

Returns
The date structure name

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

◆ getNext()

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

Retrieves the next CircSLelement

Returns
the next element in the list

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

◆ setNext()

template<typename E >
void bridges::datastructure::CircSLelement< E >::setNext ( CircSLelement< E > *  next)
inline

Sets the pointer to the next CircSLelement

Parameters
nextCircSLelement<E> that should be assigned to the next pointer

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