Public Member Functions | Private Member Functions | Private Attributes

Set Class Reference

This class describes a set: it mainly consists of a list of set elements. More...

#include <Set.h>

Inheritance diagram for Set:
CompDescr

List of all members.

Public Member Functions

 Set (const ListNode &list_of_els)
 Construct a set from a list of elements in a SyntaxNode.
int size () const
 Return the size of the set.
int dim () const
 Return the dimension of the set.
int findPos (const SetElement &el) const
 Find position of element in set.

Private Member Functions

void add (const SetElement &el)
 Add element to the set.
std::string toString () const
 Return the set as a string.

Private Attributes

std::map< SetElement, int,
SetElement
elements
 The actual elements: each element is


int dim_
 Dimension: a set can be multidimensional.

Detailed Description

This class describes a set: it mainly consists of a list of set elements.

The element of the sets are described by the vector<string*> elements Each entry of elements is an array of strings (dimension of the array is the dimension of the set).


Constructor & Destructor Documentation

Set::Set ( const ListNode list  ) 

Construct a set from a list of elements in a SyntaxNode.

Constructs the Set from a list of set elements given as a tree of SyntaxNodes

Parameters:
list a description of the set elements as read in from the data file

This constructor assumes that the parameter list describes the set elements in the following format:

  • The top node is of type SyntaxNode.opCode=' ', SyntaxNode::nval=[#items in the list]
  • Each child describes one element of the set and is of either of the forms + SyntaxNode.opCode=ID|INT_VAL|FLOAT_VAL, SyntaxNode.values[0] = + (...,...,..) represented as SyntaxNode.opCode=LBRACKET with one child of type COMMA. The COMMA SyntaxNode is a list, with number of entries equal to the dimension of the set and each element of type opCode=ID (carrying the actual description of the set element).

References add(), SyntaxNode::begin(), dim_, SyntaxNode::end(), SyntaxNode::front(), SyntaxNode::getOpCode(), and ID.


Member Function Documentation

void Set::add ( const SetElement el  )  [private]

Add element to the set.

References elements.

Referenced by Set().

int Set::dim (  )  const [inline]

Return the dimension of the set.

References dim_.

Referenced by CompDescrParam::CompDescrParam(), labelToSetElement(), and CompDescrParam::toString().

int Set::findPos ( const SetElement el  )  const

Find position of element in set.

References elements, toString(), and SetElement::toString().

Referenced by CompDescrParam::CompDescrParam(), and labelToSetElement().

int Set::size (  )  const [inline]

Return the size of the set.

References elements.

Referenced by CompDescrParam::CompDescrParam(), and CompDescrParam::processValueTableList().

string Set::toString (  )  const [private, virtual]

Return the set as a string.

Reimplemented from CompDescr.

References elements, SetElement::getVal(), and to_string().

Referenced by findPos().


Member Data Documentation

int Set::dim_ [private]

Dimension: a set can be multidimensional.

Referenced by dim(), and Set().

std::map<SetElement, int, SetElement> Set::elements [private]

The actual elements: each element is

The elements of the set

Referenced by add(), findPos(), size(), and toString().


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