documentation - element and elementvector
TRANSCRIPT
Reference Manual
Generated by Doxygen 1.6.3
Mon Dec 5 12:55:58 2011
Contents
1 Class Index 1
1.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 File Index 3
2.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Class Documentation 5
3.1 Element Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2.1 Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2.2 ∼Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.1 operator< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.2 operator<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.3 operator> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.4 value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.3.5 value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 ElementVector Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2.1 ElementVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2.2 ∼ElementVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.1 absMaxValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.2 add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.3 at . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.4 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3.5 isEmpty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ii CONTENTS
3.2.3.6 maxValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3.7 minValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.3.8 operator[] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.3.9 push_back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.3.10 resize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.3.11 size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.3.12 sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.3.13 swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 PredicateSort Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.2.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 File Documentation 15
4.1 Element.cxx File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Element.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Element.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Element.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.5 Sys-Element.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.5.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.5.1.1 main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.6 Sys-Element.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
Chapter 1
Class Index
1.1 Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5ElementVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8PredicateSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Class Index
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
Chapter 2
File Index
2.1 File List
Here is a list of all files with brief descriptions:
Element.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Element.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Sys-Element.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4 File Index
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
Chapter 3
Class Documentation
3.1 Element Class Reference
#include <Element.h>
Public Member Functions
• Element (long double value=0.0)• void value (long double Value)• long double value (void)• bool operator> (Element &e)• bool operator< (Element &e)• bool operator<= (Element &e)• virtual ∼Element ()
3.1.1 Detailed Description
Classe para armazenamento das caracteristicas de um determinado elemento
Definition at line 18 of file Element.h.
3.1.2 Constructor & Destructor Documentation
3.1.2.1 Element::Element (long double value = 0.0) [inline]
Método construtor da classe.
Definition at line 30 of file Element.h.
00030 {_value = value;};
Here is the call graph for this function:
Element::Element Element::value
6 Class Documentation
3.1.2.2 virtual Element::∼Element () [inline, virtual]
Método destrutor. Responsável por liberar todos os recursos alocados pela classe.
Definition at line 61 of file Element.h.
00061 {};
3.1.3 Member Function Documentation
3.1.3.1 bool Element::operator< (Element & e) [inline]
Sobrecarga do operador < para simplificação da comparação de valores.
Definition at line 50 of file Element.h.
00050 { return (this->value() < e.value()); };
Here is the call graph for this function:
Element::operator< Element::value
3.1.3.2 bool Element::operator<= (Element & e) [inline]
Sobrecarga do operador <= para simplificação da comparação de valores.
Definition at line 55 of file Element.h.
00055 { return (this->value() <= e.value()); };
Here is the call graph for this function:
Element::operator<= Element::value
3.1.3.3 bool Element::operator> (Element & e) [inline]
Sobrecarga do operador > para simplificação da comparação de valores.
Definition at line 45 of file Element.h.
00045 { return (this->value() > e.value()); };
Here is the call graph for this function:
Element::operator> Element::value
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
3.1 Element Class Reference 7
3.1.3.4 long double Element::value (void) [inline]
Método que retorna o valor contido no atributo value.
Definition at line 40 of file Element.h.
00040 { return _value; };
Here is the caller graph for this function:
Element::value
Element::Element
Element::operator<
Element::operator<=
Element::operator>
3.1.3.5 void Element::value (long double Value) [inline]
Método que atribui um valor ao atributo value.
Definition at line 35 of file Element.h.
00035 { _value = Value; };
Here is the caller graph for this function:
Element::value
main
ElementVector::maxValue
ElementVector::minValue
Element::operator<
Element::operator<=
Element::operator>
ElementVector::absMaxValue
The documentation for this class was generated from the following file:
• Element.h
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
8 Class Documentation
3.2 ElementVector Class Reference
#include <Element.h>
Public Member Functions
• ElementVector (void)• long double maxValue (void)• long double minValue (void)• long double absMaxValue (void)• bool isEmpty (void)• void resize (unsigned int new_size)• void sort (void)• unsigned int size (void)• Element at (unsigned int index)• Element & operator[ ] (unsigned int index)• void push_back (Element e)• void add (Element e)• void swap (unsigned int position_a, unsigned int position_b)• void clear (void)• virtual ∼ElementVector ()
3.2.1 Detailed Description
Classe para armazenamento de uma lista de elementos
Definition at line 76 of file Element.h.
3.2.2 Constructor & Destructor Documentation
3.2.2.1 ElementVector::ElementVector (void) [inline]
Método construtor da classe.
Definition at line 88 of file Element.h.
00088 {};
3.2.2.2 virtual ElementVector::∼ElementVector () [inline, virtual]
Método destrutor. Responsável por liberar todos os recursos alocados pela classe.
Definition at line 163 of file Element.h.
00163 { clear(); }
Here is the call graph for this function:
ElementVector::~ElementVector ElementVector::clear
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
3.2 ElementVector Class Reference 9
3.2.3 Member Function Documentation
3.2.3.1 long double ElementVector::absMaxValue (void)
Método que retorna o maior valor absoluto contido na lista.
Definition at line 54 of file Element.cxx.
00055 {00056 return (fabsl(maxValue()) > fabsl(minValue()))?(maxValue()):(fabsl(minValue()))
;00057 }
Here is the call graph for this function:
ElementVector::absMaxValue
ElementVector::maxValue
ElementVector::minValue
ElementVector::at
Element::value
3.2.3.2 void ElementVector::add (Element e) [inline]
Método que insere elementos na lista
Definition at line 146 of file Element.h.
00146 { this->push_back(e); }
Here is the call graph for this function:
ElementVector::add ElementVector::push_back
Here is the caller graph for this function:
ElementVector::add main
3.2.3.3 Element ElementVector::at (unsigned int index) [inline]
Método que retorna o elemento de uma determinada posição
Definition at line 128 of file Element.h.
00128 { return _list.at(index); };
Here is the caller graph for this function:
ElementVector::at
ElementVector::maxValue
ElementVector::minValue
ElementVector::absMaxValue
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
10 Class Documentation
3.2.3.4 void ElementVector::clear (void) [inline]
Método que executa limpeza da lista de elementos
Definition at line 157 of file Element.h.
00157 { _list.clear(); }
Here is the caller graph for this function:
ElementVector::clear ElementVector::~ElementVector
3.2.3.5 bool ElementVector::isEmpty (void) [inline]
Método que verifica se a alista está vazia
Definition at line 108 of file Element.h.
00108 { return _list.empty(); };
3.2.3.6 long double ElementVector::maxValue (void)
Método que retorna o maior valor existente na lista de elementos
Definition at line 13 of file Element.cxx.
00014 {00015 //Verificando se a lista foi preenchida ...00016 if (_list.size() == 0 ) return 0;0001700018 //Resgatando o primeiro elemento da lista para verificação do maior elemento00019 long double maximo = at(0).value();0002000021 //Looping para verificação do maior elemento00022 for (unsigned int index = 1; index < _list.size(); index++)00023 {00024 if (maximo < at(index).value()) maximo = at(index).value();00025 }0002600027 //Retornando o maior valor da lista00028 return maximo;00029 }
Here is the call graph for this function:
ElementVector::maxValue
ElementVector::at
Element::value
Here is the caller graph for this function:
ElementVector::maxValue ElementVector::absMaxValue
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
3.2 ElementVector Class Reference 11
3.2.3.7 long double ElementVector::minValue (void)
Método que retorna o menor valor existente na lista de elementos
Definition at line 33 of file Element.cxx.
00034 {00035 //Verificando se a lista foi preenchida ...00036 if (_list.size() == 0 ) return 0;0003700038 //Resgatando o primeiro elemento da lista para verificação do maior elemento00039 long double minimo = at(0).value();0004000041 //Looping para verificação do maior elemento00042 for (unsigned int index = 1; index < _list.size(); index++)00043 {00044 if (minimo > at(index).value()) minimo = at(index).value();00045 }0004600047 //Retornando o maior valor da lista00048 return minimo;00049 }
Here is the call graph for this function:
ElementVector::minValue
ElementVector::at
Element::value
Here is the caller graph for this function:
ElementVector::minValue ElementVector::absMaxValue
3.2.3.8 Element& ElementVector::operator[ ] (unsigned int index) [inline]
Sobrecarga do operador [] para simplificar o acesso a um determinado elemento. Lembrando que esseoperador devolve uma referência, o que faz que acessemos diretamente o valor do objeto, além disso nãoexecutamos verificação de limites com esse operador, isso fica a cargo do programador.
Definition at line 136 of file Element.h.
00136 { return _list[index]; };
3.2.3.9 void ElementVector::push_back (Element e) [inline]
Método que insere elementos na lista
Definition at line 141 of file Element.h.
00141 { _list.push_back(e); }
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
12 Class Documentation
Here is the caller graph for this function:
ElementVector::push_back ElementVector::add main
3.2.3.10 void ElementVector::resize (unsigned int new_size) [inline]
Método que executa um resize na lista de elementos
Definition at line 113 of file Element.h.
00113 { _list.resize(new_size); };
3.2.3.11 unsigned int ElementVector::size (void) [inline]
Método que retorna o tamanho da lista de elementos
Definition at line 123 of file Element.h.
00123 { return _list.size(); }
Here is the caller graph for this function:
ElementVector::size main
3.2.3.12 void ElementVector::sort (void) [inline]
Método que utiliza o algoritmo de ordenação quick sort fornecido pela STL
Definition at line 118 of file Element.h.
00118 { std::sort(_list.begin(), _list.end(), PredicateSort()); };
3.2.3.13 void ElementVector::swap (unsigned int position_a, unsigned int position_b)
Método que executa a troca entre dois valores de uma determinada posição dentro da lista de elementos.
Definition at line 63 of file Element.cxx.
00064 {00065 //Executa a troca dos valores00066 long double temp = _list[position_a].value();00067 _list[position_a].value( _list[position_b].value() );00068 _list[position_b].value(temp);00069 }
The documentation for this class was generated from the following files:
• Element.h• Element.cxx
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
3.3 PredicateSort Struct Reference 13
3.3 PredicateSort Struct Reference
#include <Element.h>
Public Member Functions
• bool operator() (Element a, Element b)
3.3.1 Detailed Description
Estrutura auxiliar usada como predicado para executar ordenação usando o quicksort interno da STL.
Definition at line 68 of file Element.h.
3.3.2 Member Function Documentation
3.3.2.1 bool PredicateSort::operator() (Element a, Element b) [inline]
Definition at line 70 of file Element.h.
00070 { return a < b; }
The documentation for this struct was generated from the following file:
• Element.h
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
14 Class Documentation
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
Chapter 4
File Documentation
4.1 Element.cxx File Reference
#include "Element.h"
#include <vector>
#include <cmath>
#include <algorithm>
Include dependency graph for Element.cxx:
Element.cxx
vector cmath algorithm
This graph shows which files directly or indirectly include this file:
Element.cxx
16 File Documentation
4.2 Element.cxx
00001 /*00002 * _Element.cpp00003 *00004 * Created on: 25/10/200900005 * Author: Administrador00006 */0000700008 #include "Element.h"0000900013 long double ElementVector::maxValue(void)00014 {00015 //Verificando se a lista foi preenchida ...00016 if (_list.size() == 0 ) return 0;0001700018 //Resgatando o primeiro elemento da lista para verificação do maior elemento00019 long double maximo = at(0).value();0002000021 //Looping para verificação do maior elemento00022 for (unsigned int index = 1; index < _list.size(); index++)00023 {00024 if (maximo < at(index).value()) maximo = at(index).value();00025 }0002600027 //Retornando o maior valor da lista00028 return maximo;00029 }00033 long double ElementVector::minValue(void)00034 {00035 //Verificando se a lista foi preenchida ...00036 if (_list.size() == 0 ) return 0;0003700038 //Resgatando o primeiro elemento da lista para verificação do maior elemento00039 long double minimo = at(0).value();0004000041 //Looping para verificação do maior elemento00042 for (unsigned int index = 1; index < _list.size(); index++)00043 {00044 if (minimo > at(index).value()) minimo = at(index).value();00045 }0004600047 //Retornando o maior valor da lista00048 return minimo;00049 }0005000054 long double ElementVector::absMaxValue(void)00055 {00056 return (fabsl(maxValue()) > fabsl(minValue()))?(maxValue()):(fabsl(minValue()))
;00057 }0005800063 void ElementVector::swap(unsigned int position_a, unsigned int position_b)00064 {00065 //Executa a troca dos valores00066 long double temp = _list[position_a].value();00067 _list[position_a].value( _list[position_b].value() );00068 _list[position_b].value(temp);00069 }0007000071
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
4.3 Element.h File Reference 17
4.3 Element.h File Reference
#include <vector>
#include <cmath>
#include <algorithm>
Include dependency graph for Element.h:
Element.h
vector cmath algorithm
This graph shows which files directly or indirectly include this file:
Element.h
Sys-Element.cpp
Classes
• class Element• struct PredicateSort• class ElementVector
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
18 File Documentation
4.4 Element.h
00001 /*00002 * Element.h00003 *00004 * Created on: 25/10/200900005 * Author: Michel Alves dos Santos00006 */0000700008 #ifndef _ELEMENT_H_00009 #define _ELEMENT_H_0001000011 #include <vector>00012 #include <cmath>00013 #include <algorithm>0001400018 class Element00019 {00023 long double _value;0002400025 public :0002600030 Element(long double value = 0.0){_value = value;};0003100035 void value(long double Value) { _value = Value; };0003600040 long double value(void) { return _value; };0004100045 bool operator > (Element& e) { return (this->value() > e.value()); };0004600050 bool operator < (Element& e) { return (this->value() < e.value()); };0005100055 bool operator <= (Element& e) { return (this->value() <= e.value()); };0005600061 virtual ~Element() {};00062 };0006300068 struct PredicateSort00069 {00070 bool operator()(Element a, Element b) { return a < b; }00071 };0007200076 class ElementVector00077 {00081 std::vector<Element> _list;0008200083 public:0008400088 ElementVector(void){};0008900093 long double maxValue(void);0009400098 long double minValue(void);0009900103 long double absMaxValue(void);0010400108 bool isEmpty(void) { return _list.empty(); };0010900113 void resize(unsigned int new_size) { _list.resize(new_size); };0011400118 void sort(void) { std::sort(_list.begin(), _list.end(), PredicateSort()); };0011900123 unsigned int size(void) { return _list.size(); }0012400128 Element at(unsigned int index) { return _list.at(index); };0012900136 Element& operator [](unsigned int index) { return _list[index]; };
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
4.4 Element.h 19
0013700141 void push_back(Element e) { _list.push_back(e); }0014200146 void add(Element e) { this->push_back(e); }0014700152 void swap(unsigned int position_a, unsigned int position_b);0015300157 void clear(void) { _list.clear(); }0015800163 virtual ~ElementVector(){ clear(); }00164 };0016500166 #endif /* _ELEMENT_H_ */
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
20 File Documentation
4.5 Sys-Element.cpp File Reference
#include <iostream>
#include "Element.h"
Include dependency graph for Sys-Element.cpp:
Sys-Element.cpp
iostream Element.h
vector cmath algorithm
Functions
• int main (int argc, char ∗argv[ ])
4.5.1 Function Documentation
4.5.1.1 int main (int argc, char ∗ argv[ ])
Função para testes com a biblioteca.
Definition at line 13 of file Sys-Element.cpp.
00014 {00015 Element e(10.5);00016 ElementVector ev;0001700018 ev.add(e); ev.add(Element(11.15)); ev.add(Element(9.5));0001900020 std::cout << "Valor armazenado: " << e.value() << std::endl;00021 std::cout << "Número de elementos na lista: " << ev.size() << std::endl;0002200023 return 0;00024 }
Here is the call graph for this function:
main
ElementVector::add
ElementVector::size
Element::value
ElementVector::push_back
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
4.6 Sys-Element.cpp 21
4.6 Sys-Element.cpp
00001 //============================================================================00002 // Name : Sys-Element00003 // Author : Michel Alves dos Santos00004 // Version : 1.00 Beta00005 //============================================================================0000600007 #include <iostream>00008 #include "Element.h"0000900013 int main(int argc, char* argv[])00014 {00015 Element e(10.5);00016 ElementVector ev;0001700018 ev.add(e); ev.add(Element(11.15)); ev.add(Element(9.5));0001900020 std::cout << "Valor armazenado: " << e.value() << std::endl;00021 std::cout << "Número de elementos na lista: " << ev.size() << std::endl;0002200023 return 0;00024 }
Generated on Mon Dec 5 12:55:58 2011 by Doxygen
Index
∼ElementElement, 5
∼ElementVectorElementVector, 8
absMaxValueElementVector, 9
addElementVector, 9
atElementVector, 9
clearElementVector, 9
Element, 5∼Element, 5Element, 5operator<, 6operator<=, 6operator>, 6value, 6, 7
Element.cxx, 15Element.h, 17ElementVector, 8
∼ElementVector, 8absMaxValue, 9add, 9at, 9clear, 9ElementVector, 8isEmpty, 10maxValue, 10minValue, 10push_back, 11resize, 12size, 12sort, 12swap, 12
isEmptyElementVector, 10
mainSys-Element.cpp, 20
maxValue
ElementVector, 10minValue
ElementVector, 10
operator<Element, 6
operator<=Element, 6
operator>Element, 6
operator()PredicateSort, 13
PredicateSort, 13operator(), 13
push_backElementVector, 11
resizeElementVector, 12
sizeElementVector, 12
sortElementVector, 12
swapElementVector, 12
Sys-Element.cpp, 20main, 20
valueElement, 6, 7