arithm::ArrayOfElmts Class Reference

Implements an array of group elements with several mathematical operations depending on the group the associated to it. More...

#include <arrayofelmts.hpp>

+ Collaboration diagram for arithm::ArrayOfElmts:

Public Member Functions

 ArrayOfElmts ()
 Creates an empty instance.
 ArrayOfElmts (verifierUtils::ByteTree *bt, Group *grp)
 Sets the content of this array.
verifierUtils::ByteTreetoByteTree ()
 Turns this array into a bytetree.
ArrayOfElmts subArray (std::vector< bool > keepList)
 Returns an ArrayOfElmts $R$ built from this instance $A$ such that $A_i \in R$ if and only if the ith element of the keep list is set to true.
void addElmt (Elmt e)
 Appends an element to the end of the array.
Elmt getElmt (unsigned int i)
 Returns the ith element of the array.
unsigned int size ()
 Returns the size of this array of elements.

Private Attributes

std::vector< Elmt * > elmts
 The actual content of this array.

Detailed Description

Implements an array of group elements with several mathematical operations depending on the group the associated to it.

Definition at line 28 of file arrayofelmts.hpp.

Constructor & Destructor Documentation

ArrayOfElmts::ArrayOfElmts ( )

Creates an empty instance.

Definition at line 20 of file arrayofelmts.cpp.

{
}
ArrayOfElmts::ArrayOfElmts ( verifierUtils::ByteTree bt,
Group grp 
)

Sets the content of this array.

Parameters
btA Node containing bytetree representations of group elements.
grpThe group in which the elements are.

Definition at line 25 of file arrayofelmts.cpp.

{
if (!bt->isNode())
{
std::cout<<"ERROR: in ArrayOfElmts(bt,grp), bt is not "
<<"a Node.\nbt=";
bt->prettyPrint("");
std::cout<<std::endl;
exit(1);
}
elmts.resize(bt->size());
for (unsigned int i=0; i<bt->size(); i++)
elmts[i] = new Elmt(grp->getElmt(bt->getChild(i)));
}

Member Function Documentation

void ArrayOfElmts::addElmt ( Elmt  e)

Appends an element to the end of the array.

Definition at line 69 of file arrayofelmts.cpp.

{
Elmt * ptr = new Elmt(e);
elmts.push_back(ptr);
}
Elmt ArrayOfElmts::getElmt ( unsigned int  i)

Returns the ith element of the array.

Definition at line 76 of file arrayofelmts.cpp.

{
Elmt res = (*elmts[i]);
return res;
}
unsigned int ArrayOfElmts::size ( )

Returns the size of this array of elements.

Definition at line 83 of file arrayofelmts.cpp.

{
return elmts.size();
}
ArrayOfElmts ArrayOfElmts::subArray ( std::vector< bool >  keepList)

Returns an ArrayOfElmts $R$ built from this instance $A$ such that $A_i \in R$ if and only if the ith element of the keep list is set to true.

Definition at line 50 of file arrayofelmts.cpp.

{
if (keepList.size() != elmts.size())
{
std::cout<<"ERROR: in ArrayOfElmts.subArray(keepList),"
<<" keepList and this are not of the same "
<<"size.\nthis.size()="<<elmts.size()
<<"\nkeepList.size()="<<keepList.size()
<<std::endl;
exit(1);
}
ArrayOfElmts result;
for (unsigned int i=0; i<keepList.size(); i++)
if (keepList[i])
result.addElmt(getElmt(i));
return result;
}
verifierUtils::ByteTree * ArrayOfElmts::toByteTree ( )

Turns this array into a bytetree.

Definition at line 41 of file arrayofelmts.cpp.

{
for (unsigned int i=0; i<elmts.size(); i++)
result->addChild(elmts[i]->toByteTree());
return result;
}

Member Data Documentation

std::vector<Elmt*> arithm::ArrayOfElmts::elmts
private

The actual content of this array.

Definition at line 34 of file arrayofelmts.hpp.


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