Drake
Variables Class Reference

Represents a set of variables. More...

#include <common/symbolic_variables.h>

Public Types

typedef std::set< Variable >::size_type size_type
 
typedef std::set< Variable >::iterator iterator
 
typedef std::set< Variable >::const_iterator const_iterator
 
typedef std::set< Variable >::reverse_iterator reverse_iterator
 
typedef std::set< Variable >::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 Variables ()=default
 Default constructor. More...
 
 Variables (std::initializer_list< Variable > init)
 List constructor. More...
 
 Variables (const Eigen::Ref< const VectorX< Variable >> &init)
 Constructs from an Eigen vector of variables. More...
 
size_type size () const
 Returns the number of elements. More...
 
bool empty () const
 Checks if this set is empty or not. More...
 
std::string to_string () const
 Returns string representation of Variables. More...
 
iterator begin ()
 Returns an iterator to the beginning. More...
 
iterator end ()
 Returns an iterator to the end. More...
 
const_iterator begin () const
 Returns an iterator to the beginning. More...
 
const_iterator end () const
 Returns an iterator to the end. More...
 
const_iterator cbegin () const
 Returns a const iterator to the beginning. More...
 
const_iterator cend () const
 Returns a const iterator to the end. More...
 
reverse_iterator rbegin ()
 Returns a reverse iterator to the beginning. More...
 
reverse_iterator rend ()
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator rbegin () const
 Returns a reverse iterator to the beginning. More...
 
const_reverse_iterator rend () const
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator crbegin () const
 Returns a const reverse-iterator to the beginning. More...
 
const_reverse_iterator crend () const
 Returns a const reverse-iterator to the end. More...
 
void insert (const Variable &var)
 Inserts a variable var into a set. More...
 
template<class InputIt >
void insert (InputIt first, InputIt last)
 Inserts variables in [first, last) into a set. More...
 
void insert (const Variables &vars)
 Inserts variables in vars into a set. More...
 
size_type erase (const Variable &key)
 Erases key from a set. More...
 
size_type erase (const Variables &vars)
 Erases variables in vars from a set. More...
 
iterator find (const Variable &key)
 Finds element with specific key. More...
 
const_iterator find (const Variable &key) const
 
bool include (const Variable &key) const
 Return true if key is included in the Variables. More...
 
bool IsSubsetOf (const Variables &vars) const
 Return true if vars is a subset of the Variables. More...
 
bool IsSupersetOf (const Variables &vars) const
 Return true if vars is a superset of the Variables. More...
 
bool IsStrictSubsetOf (const Variables &vars) const
 Return true if vars is a strict subset of the Variables. More...
 
bool IsStrictSupersetOf (const Variables &vars) const
 Return true if vars is a strict superset of the Variables. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 Variables (const Variables &)=default
 
Variablesoperator= (const Variables &)=default
 
 Variables (Variables &&)=default
 
Variablesoperator= (Variables &&)=default
 

Friends

template<class HashAlgorithm >
void hash_append (HashAlgorithm &hasher, const Variables &item) noexcept
 Implements the hash_append generic hashing concept. More...
 
bool operator== (const Variables &vars1, const Variables &vars2)
 
bool operator< (const Variables &vars1, const Variables &vars2)
 
std::ostream & operator<< (std::ostream &, const Variables &vars)
 
Variables intersect (const Variables &vars1, const Variables &vars2)
 Returns the intersection of vars1 and vars2. More...
 

Detailed Description

Represents a set of variables.

This class is based on std::set<Variable>. The intent is to add things that we need including set-union (Variables::insert, operator+, operator+=), set-minus (Variables::erase, operator-, operator-=), and subset/superset checking functions (Variables::IsSubsetOf, Variables::IsSupersetOf, Variables::IsStrictSubsetOf, Variables::IsStrictSupersetOf).

Member Typedef Documentation

typedef std::set<Variable>::iterator iterator
typedef std::set<Variable>::size_type size_type

Constructor & Destructor Documentation

Variables ( const Variables )
default
Variables ( Variables &&  )
default
Variables ( )
default

Default constructor.

Here is the caller graph for this function:

Variables ( std::initializer_list< Variable init)

List constructor.

Variables ( const Eigen::Ref< const VectorX< Variable >> &  init)
explicit

Constructs from an Eigen vector of variables.

Here is the call graph for this function:

Member Function Documentation

iterator begin ( )
inline

Returns an iterator to the beginning.

Here is the caller graph for this function:

const_iterator begin ( ) const
inline

Returns an iterator to the beginning.

const_iterator cbegin ( ) const
inline

Returns a const iterator to the beginning.

Here is the caller graph for this function:

const_iterator cend ( ) const
inline

Returns a const iterator to the end.

const_reverse_iterator crbegin ( ) const
inline

Returns a const reverse-iterator to the beginning.

const_reverse_iterator crend ( ) const
inline

Returns a const reverse-iterator to the end.

bool empty ( ) const
inline

Checks if this set is empty or not.

Here is the call graph for this function:

iterator end ( )
inline

Returns an iterator to the end.

Here is the caller graph for this function:

const_iterator end ( ) const
inline

Returns an iterator to the end.

size_type erase ( const Variable key)
inline

Erases key from a set.

Return number of erased elements (0 or 1).

Here is the caller graph for this function:

Variables::size_type erase ( const Variables vars)

Erases variables in vars from a set.

Return number of erased elements ([0, vars.size()]).

Here is the call graph for this function:

iterator find ( const Variable key)
inline

Finds element with specific key.

Here is the caller graph for this function:

const_iterator find ( const Variable key) const
inline
bool include ( const Variable key) const
inline

Return true if key is included in the Variables.

Here is the call graph for this function:

Here is the caller graph for this function:

void insert ( const Variable var)
inline

Inserts a variable var into a set.

Here is the caller graph for this function:

void insert ( InputIt  first,
InputIt  last 
)
inline

Inserts variables in [first, last) into a set.

void insert ( const Variables vars)
inline

Inserts variables in vars into a set.

Here is the call graph for this function:

bool IsStrictSubsetOf ( const Variables vars) const

Return true if vars is a strict subset of the Variables.

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsStrictSupersetOf ( const Variables vars) const

Return true if vars is a strict superset of the Variables.

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsSubsetOf ( const Variables vars) const

Return true if vars is a subset of the Variables.

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsSupersetOf ( const Variables vars) const

Return true if vars is a superset of the Variables.

Here is the call graph for this function:

Here is the caller graph for this function:

Variables& operator= ( Variables &&  )
default
Variables& operator= ( const Variables )
default
reverse_iterator rbegin ( )
inline

Returns a reverse iterator to the beginning.

Here is the caller graph for this function:

const_reverse_iterator rbegin ( ) const
inline

Returns a reverse iterator to the beginning.

reverse_iterator rend ( )
inline

Returns a reverse iterator to the end.

const_reverse_iterator rend ( ) const
inline

Returns a reverse iterator to the end.

size_type size ( ) const
inline

Returns the number of elements.

Here is the caller graph for this function:

string to_string ( ) const

Returns string representation of Variables.

Here is the caller graph for this function:

Friends And Related Function Documentation

void hash_append ( HashAlgorithm &  hasher,
const Variables item 
)
friend

Implements the hash_append generic hashing concept.

Variables intersect ( const Variables vars1,
const Variables vars2 
)
friend

Returns the intersection of vars1 and vars2.

This function has a time complexity of O(N₁ + N₂) where N₁ and N₂ are the size of vars1 and vars2 respectively.

bool operator< ( const Variables vars1,
const Variables vars2 
)
friend
std::ostream& operator<< ( std::ostream &  os,
const Variables vars 
)
friend
bool operator== ( const Variables vars1,
const Variables vars2 
)
friend

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