Basic Polynomial Algebra Subprograms (BPAS)  v. 1.652
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
Symbol Class Reference

An encapsulation of a mathematical symbol. More...

#include <Symbol.hpp>

Public Member Functions

 Symbol ()
 Construct an empty Symbol.
 
 Symbol (char c)
 Construct a Symbol from the given character. More...
 
 Symbol (const char *c)
 Construct a Symbol from a c-string. More...
 
 Symbol (const wchar_t *c)
 Construct a Symbol from a wide character c-string.
 
 Symbol (const std::string &a)
 Construct a Symbol from a std::string. More...
 
 Symbol (const std::wstring &a)
 Construct a Symbol from a wide string, std::wstring. More...
 
 Symbol (const Symbol &a)
 Copy constructor.
 
 ~Symbol ()
 Destructor.
 
Symboloperator= (char c)
 Get the type of this Symbol. More...
 
Symboloperator= (const char *c)
 Assignment operator from a c-string. More...
 
Symboloperator= (const std::string &a)
 Assignment operator from a std::string. More...
 
Symboloperator= (const Symbol &a)
 Copy assignment. More...
 
Symboloperator+= (const std::string &a)
 Concatenate a string to this Symbol. More...
 
Symboloperator+= (const Symbol &a)
 Concatenate a Symbol to this Symbol. More...
 
std::string toString () const
 Conver a Symbol to a std::string. More...
 
ExpressionTree convertToExpressionTree () const
 Convert a Symbol to an ExpressionTree. More...
 

Static Public Member Functions

static Symbol randomElement ()
 Get a random Symbol. More...
 
static std::vector< SymbolrandomElements (int n)
 Get a vector of pair-wise different random Symbols. More...
 

Friends

bool operator< (const Symbol &s1, const Symbol &s2)
 Less than comparison operator between two Symbol. More...
 
bool operator== (const Symbol &s1, const Symbol &s2)
 Equality comparison operator between two Symbol. More...
 
bool operator== (const std::string &s2, const Symbol &s1)
 Equality comparison operator between a Symbol and a string. More...
 
bool operator== (const Symbol &s1, const std::string &s2)
 Equality comparison operator between a Symbol and a string. More...
 
bool operator!= (const std::string &s2, const Symbol &s1)
 Inequality comparison operator between a Symbol and a string. More...
 
bool operator!= (const Symbol &s1, const std::string &s2)
 Inequality comparison operator between a Symbol and a string. More...
 
bool operator<= (const Symbol &s1, const Symbol &s2)
 Less-than-equal comparison operator between two Symbol. More...
 
bool operator> (const Symbol &s1, const Symbol &s2)
 Greater-than comparison operator between two Symbol. More...
 
bool operator>= (const Symbol &s1, const Symbol &s2)
 Greater-than-equal comparison operator between two Symbol. More...
 
bool operator!= (const Symbol &s1, const Symbol &s2)
 Inequality comparison operator between two Symbol. More...
 
std::ostream & operator<< (std::ostream &out, const Symbol &b)
 Output operator. More...
 

Detailed Description

An encapsulation of a mathematical symbol.

This symbol can be an indeterminant, or more generally, any unicode string. Provides comparison, concatenation, and printing.

Constructor & Destructor Documentation

◆ Symbol() [1/4]

Symbol::Symbol ( char  c)
inline

Construct a Symbol from the given character.

Parameters
cthe character

◆ Symbol() [2/4]

Symbol::Symbol ( const char *  c)
inlineexplicit

Construct a Symbol from a c-string.

Parameters
cthe c-string.

◆ Symbol() [3/4]

Symbol::Symbol ( const std::string &  a)
inlineexplicit

Construct a Symbol from a std::string.

Parameters
athe string

◆ Symbol() [4/4]

Symbol::Symbol ( const std::wstring &  a)
inlineexplicit

Construct a Symbol from a wide string, std::wstring.

Parameters
athe wide string

Member Function Documentation

◆ convertToExpressionTree()

ExpressionTree Symbol::convertToExpressionTree ( ) const
inline

Convert a Symbol to an ExpressionTree.

Returns
the ExpressionTree encoding this Symbol.

◆ operator+=() [1/2]

Symbol& Symbol::operator+= ( const std::string &  a)
inline

Concatenate a string to this Symbol.

Parameters
athe string to concatenate.

◆ operator+=() [2/2]

Symbol& Symbol::operator+= ( const Symbol a)
inline

Concatenate a Symbol to this Symbol.

Parameters
athe Symbol to concatenate.

◆ operator=() [1/4]

Symbol& Symbol::operator= ( char  c)
inline

Get the type of this Symbol.

Assignment operator from a character.

Parameters
cthe character to assign from.

◆ operator=() [2/4]

Symbol& Symbol::operator= ( const char *  c)
inline

Assignment operator from a c-string.

Parameters
cthe c-string to assign from.

◆ operator=() [3/4]

Symbol& Symbol::operator= ( const std::string &  a)
inline

Assignment operator from a std::string.

Parameters
athe string to assign from.

◆ operator=() [4/4]

Symbol& Symbol::operator= ( const Symbol a)
inline

Copy assignment.

Parameters
athe other Symbol to copy from.

◆ randomElement()

static Symbol Symbol::randomElement ( )
static

Get a random Symbol.

Returns
the random Symbol.

◆ randomElements()

static std::vector<Symbol> Symbol::randomElements ( int  n)
static

Get a vector of pair-wise different random Symbols.

n: the size of the vector.

Returns
the vector of Symbols

◆ toString()

std::string Symbol::toString ( ) const
inline

Conver a Symbol to a std::string.

Returns
the Symbol as a string.

Friends And Related Function Documentation

◆ operator!= [1/3]

bool operator!= ( const std::string &  s2,
const Symbol s1 
)
friend

Inequality comparison operator between a Symbol and a string.

Parameters
s1a Symbol
s2a string
Returns
true iff s1 != s2

◆ operator!= [2/3]

bool operator!= ( const Symbol s1,
const std::string &  s2 
)
friend

Inequality comparison operator between a Symbol and a string.

Parameters
s1a Symbol
s2a string
Returns
true iff s1 != s2

◆ operator!= [3/3]

bool operator!= ( const Symbol s1,
const Symbol s2 
)
friend

Inequality comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 != s2

◆ operator<

bool operator< ( const Symbol s1,
const Symbol s2 
)
friend

Less than comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 < s2

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Symbol b 
)
friend

Output operator.

Outputs the Symbol to the output stream. out: the output stream. b: the Symbol to output.

◆ operator<=

bool operator<= ( const Symbol s1,
const Symbol s2 
)
friend

Less-than-equal comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 <= s2

◆ operator== [1/3]

bool operator== ( const Symbol s1,
const Symbol s2 
)
friend

Equality comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 = s2

◆ operator== [2/3]

bool operator== ( const std::string &  s2,
const Symbol s1 
)
friend

Equality comparison operator between a Symbol and a string.

Parameters
s1a Symbol
s2a string
Returns
true iff s1 = s2

◆ operator== [3/3]

bool operator== ( const Symbol s1,
const std::string &  s2 
)
friend

Equality comparison operator between a Symbol and a string.

Parameters
s1a Symbol
s2a string
Returns
true iff s1 = s2

◆ operator>

bool operator> ( const Symbol s1,
const Symbol s2 
)
friend

Greater-than comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 > s2

◆ operator>=

bool operator>= ( const Symbol s1,
const Symbol s2 
)
friend

Greater-than-equal comparison operator between two Symbol.

Parameters
s1the first Symbol
s2the second Symbol
Returns
true iff s1 >= s2

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