Documentation - Element and ElementVector

232 views

Published on

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
232
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Documentation - Element and ElementVector

  1. 1. Reference Manual Generated by Doxygen 1.6.3 Mon Dec 5 12:55:58 2011
  2. 2. Contents 1 1 1.1 2 Class Index 1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 3 File Index 3 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 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 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 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 3.1.3 3.2 3.2.3
  3. 3. ii CONTENTS 3.2.3.6 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 PredicateSort Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.2.1 4 10 3.2.3.7 3.3 maxValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Sys-Element.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.6 Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  4. 4. Chapter 1 Class Index 1.1 Class List Here are the classes, structs, unions and interfaces with brief descriptions: Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ElementVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PredicateSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8 13
  5. 5. 2 Class Index Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  6. 6. Chapter 2 File Index 2.1 File List Here is a list of all files with brief descriptions: Element.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Element.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sys-Element.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 17 20
  7. 7. 4 File Index Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  8. 8. 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
  9. 9. 6 3.1.2.2 Class Documentation 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< 3.1.3.2 Element::value 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<= 3.1.3.3 Element::value 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
  10. 10. 3.1 Element Class Reference 3.1.3.4 7 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::Element Element::operator< Element::value 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: main ElementVector::maxValue ElementVector::absMaxValue ElementVector::minValue Element::value Element::operator< Element::operator<= Element::operator> The documentation for this class was generated from the following file: • Element.h Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  11. 11. 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
  12. 12. 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::maxValue ElementVector::at ElementVector::minValue Element::value ElementVector::absMaxValue 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 3.2.3.3 main 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::maxValue ElementVector::at ElementVector::absMaxValue ElementVector::minValue Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  13. 13. 10 3.2.3.4 Class Documentation 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 3.2.3.5 ElementVector::~ElementVector 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; 00017 00018 //Resgatando o primeiro elemento da lista para verificação do maior elemento 00019 long double maximo = at(0).value(); 00020 00021 //Looping para verificação do maior elemento 00022 for (unsigned int index = 1; index < _list.size(); index++) 00023 { 00024 if (maximo < at(index).value()) maximo = at(index).value(); 00025 } 00026 00027 //Retornando o maior valor da lista 00028 return maximo; 00029 } Here is the call graph for this function: ElementVector::at ElementVector::maxValue 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
  14. 14. 3.2 ElementVector Class Reference 3.2.3.7 11 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; 00037 00038 //Resgatando o primeiro elemento da lista para verificação do maior elemento 00039 long double minimo = at(0).value(); 00040 00041 //Looping para verificação do maior elemento 00042 for (unsigned int index = 1; index < _list.size(); index++) 00043 { 00044 if (minimo > at(index).value()) minimo = at(index).value(); 00045 } 00046 00047 //Retornando o maior valor da lista 00048 return minimo; 00049 } Here is the call graph for this function: ElementVector::at ElementVector::minValue Element::value Here is the caller graph for this function: ElementVector::minValue 3.2.3.8 ElementVector::absMaxValue Element& ElementVector::operator[ ] (unsigned int index) [inline] Sobrecarga do operador [] para simplificar o acesso a um determinado elemento. Lembrando que esse operador devolve uma referência, o que faz que acessemos diretamente o valor do objeto, além disso não executamos 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
  15. 15. 12 Class Documentation Here is the caller graph for this function: ElementVector::push_back 3.2.3.10 ElementVector::add main 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 3.2.3.12 main 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 valores 00066 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
  16. 16. 3.3 PredicateSort Struct Reference 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 13
  17. 17. 14 Class Documentation Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  18. 18. 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
  19. 19. 16 4.2 00001 00002 00003 00004 00005 00006 00007 00008 00009 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00054 00055 00056 File Documentation Element.cxx /* * _Element.cpp * * Created on: 25/10/2009 Author: Administrador * */ #include "Element.h" long double ElementVector::maxValue(void) { //Verificando se a lista foi preenchida ... if (_list.size() == 0 ) return 0; //Resgatando o primeiro elemento da lista para verificação do maior elemento long double maximo = at(0).value(); //Looping para verificação do maior elemento for (unsigned int index = 1; index < _list.size(); index++) { if (maximo < at(index).value()) maximo = at(index).value(); } //Retornando o maior valor da lista return maximo; } long double ElementVector::minValue(void) { //Verificando se a lista foi preenchida ... if (_list.size() == 0 ) return 0; //Resgatando o primeiro elemento da lista para verificação do maior elemento long double minimo = at(0).value(); //Looping para verificação do maior elemento for (unsigned int index = 1; index < _list.size(); index++) { if (minimo > at(index).value()) minimo = at(index).value(); } //Retornando o maior valor da lista return minimo; } long double ElementVector::absMaxValue(void) { return (fabsl(maxValue()) > fabsl(minValue()))?(maxValue()):(fabsl(minValue())) ; 00057 } 00058 00063 void ElementVector::swap(unsigned int position_a, unsigned int position_b) 00064 { 00065 //Executa a troca dos valores 00066 long double temp = _list[position_a].value(); 00067 _list[position_a].value( _list[position_b].value() ); 00068 _list[position_b].value(temp); 00069 } 00070 00071 Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  20. 20. 4.3 Element.h File Reference 4.3 17 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
  21. 21. 18 4.4 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00018 00019 00023 00024 00025 00026 00030 00031 00035 00036 00040 00041 00045 00046 00050 00051 00055 00056 00061 00062 00063 00068 00069 00070 00071 00072 00076 00077 00081 00082 00083 00084 00088 00089 00093 00094 00098 00099 00103 00104 00108 00109 00113 00114 00118 00119 00123 00124 00128 00129 00136 File Documentation Element.h /* * Element.h * * Created on: 25/10/2009 * Author: Michel Alves dos Santos */ #ifndef _ELEMENT_H_ #define _ELEMENT_H_ #include <vector> #include <cmath> #include <algorithm> class Element { long double _value; public : Element(long double value = 0.0){_value = value;}; void value(long double Value) { _value = Value; }; long double value(void) { return _value; }; bool operator > (Element& e) { return (this->value() > e.value()); }; bool operator < (Element& e) { return (this->value() < e.value()); }; bool operator <= (Element& e) { return (this->value() <= e.value()); }; virtual ~Element() {}; }; struct PredicateSort { bool operator()(Element a, Element b) { return a < b; } }; class ElementVector { std::vector<Element> _list; public: ElementVector(void){}; long double maxValue(void); long double minValue(void); long double absMaxValue(void); bool isEmpty(void) { return _list.empty(); }; void resize(unsigned int new_size) { _list.resize(new_size); }; void sort(void) { std::sort(_list.begin(), _list.end(), PredicateSort()); }; unsigned int size(void) { return _list.size(); } Element at(unsigned int index) { return _list.at(index); }; Element& operator [](unsigned int index) { return _list[index]; }; Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  22. 22. 4.4 Element.h 00137 00141 void push_back(Element e) { _list.push_back(e); } 00142 00146 void add(Element e) { this->push_back(e); } 00147 00152 void swap(unsigned int position_a, unsigned int position_b); 00153 00157 void clear(void) { _list.clear(); } 00158 00163 virtual ~ElementVector(){ clear(); } 00164 }; 00165 00166 #endif /* _ELEMENT_H_ */ Generated on Mon Dec 5 12:55:58 2011 by Doxygen 19
  23. 23. 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; 00017 00018 ev.add(e); ev.add(Element(11.15)); ev.add(Element(9.5)); 00019 00020 std::cout << "Valor armazenado: " << e.value() << std::endl; 00021 std::cout << "Número de elementos na lista: " << ev.size() << std::endl; 00022 00023 return 0; 00024 } Here is the call graph for this function: ElementVector::add main ElementVector::push_back ElementVector::size Element::value Generated on Mon Dec 5 12:55:58 2011 by Doxygen
  24. 24. 4.6 Sys-Element.cpp 4.6 00001 00002 00003 00004 00005 00006 00007 00008 00009 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 Sys-Element.cpp //============================================================================ // Name : Sys-Element // Author : Michel Alves dos Santos // Version : 1.00 Beta //============================================================================ #include <iostream> #include "Element.h" int main(int argc, char* argv[]) { Element e(10.5); ElementVector ev; ev.add(e); ev.add(Element(11.15)); ev.add(Element(9.5)); std::cout << "Valor armazenado: " << e.value() << std::endl; std::cout << "Número de elementos na lista: " << ev.size() << std::endl; return 0; } Generated on Mon Dec 5 12:55:58 2011 by Doxygen 21
  25. 25. Index ∼Element Element, 5 ∼ElementVector ElementVector, 8 absMaxValue ElementVector, 9 add ElementVector, 9 at ElementVector, 9 ElementVector, 10 minValue ElementVector, 10 operator< Element, 6 operator<= Element, 6 operator> Element, 6 operator() PredicateSort, 13 clear ElementVector, 9 Element, 5 ∼Element, 5 Element, 5 operator<, 6 operator<=, 6 operator>, 6 value, 6, 7 Element.cxx, 15 Element.h, 17 ElementVector, 8 ∼ElementVector, 8 absMaxValue, 9 add, 9 at, 9 clear, 9 ElementVector, 8 isEmpty, 10 maxValue, 10 minValue, 10 push_back, 11 resize, 12 size, 12 sort, 12 swap, 12 isEmpty ElementVector, 10 main Sys-Element.cpp, 20 maxValue PredicateSort, 13 operator(), 13 push_back ElementVector, 11 resize ElementVector, 12 size ElementVector, 12 sort ElementVector, 12 swap ElementVector, 12 Sys-Element.cpp, 20 main, 20 value Element, 6, 7

×