1/************************************************************************** 2* Copyright (C) 2005-2020 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU) * 3* info_at_agrum_dot_org * 4* * 5* This program is free software; you can redistribute it and/or modify * 6* it under the terms of the GNU General Public License as published by * 7* the Free Software Foundation; either version 2 of the License, or * 8* (at your option) any later version. * 9* * 10* This program is distributed in the hope that it will be useful, * 11* but WITHOUT ANY WARRANTY; without even the implied warranty of * 12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13* GNU General Public License for more details. * 14* * 15* You should have received a copy of the GNU General Public License * 16* along with this program; if not, write to the * 17* Free Software Foundation, Inc., * 18* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19***************************************************************************/ 20/** 21 * @file 22 * @brief The utility documentation page. 23 * 24 * @author Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU) 25 * @author Lionel TORTI 26 */ 27 28/** 29 * \defgroup utilities_group Utilities 30 * @{ 31 * About aGrUM utilities. 32 * 33 * \defgroup math_group Math 34 * @{ 35 * All the maths you'll need. 36 * @} 37 * 38 * \defgroup configuration_group Configuration 39 * @{ 40 * About aGrUM configuration. 41 * @} 42 * 43 * \defgroup refptr_group Smart Pointers 44 * @{ 45 * RefPtr are a replacement for the usual pointers: they keep track of the 46 * number of "smart" pointers pointing to a given element. When an element is 47 * no more referenced by any smart pointer, it is deleted. Hence using RefPtr, 48 * developers do not have to worry anymore about memory leaks. The correct way 49 * to use RefPtr is by creating unnamed temporaries like: @code RefPtr ( new 50 * myObject ) @endcode In any case, if you decide to pass a named pointer as 51 * argument to a RefPtr, make sure you will do it only once, that it is 52 * allocated on the heap and that you never try to deallocate it yourself, else 53 * your program will crash. 54 * 55 * @par Usage example: 56 * @code 57 * // creation of smart pointer 58 * RefPtr<int> ptr1 (new int (4)); 59 * 60 * // copying (and sharing) this pointer into new smart pointers 61 * RefPtr<int> ptr2 = ptr1, ptr3; 62 * ptr3 = ptr1; 63 * 64 * // make ptr2 point toward nothing (this does not deallocate int (4) as it is 65 * // pointed to by ptr1 and ptr3) 66 * ptr2.clear (); 67 * 68 * // modifying the value pointed to by the dumb pointer contained in ptr1 69 * *ptr1 = 5; 70 * 71 * // print the content of ptr3 72 * cerr << *ptr3 << " = 5" << endl; 73 * 74 * // check whether ptr1 and ptr3 reference the same dumb pointer 75 * if (ptr1 == ptr2) cerr << "reference the same dumb pointer" << endl; 76 * 77 * // check whether ptr1 and ptr2 contain a dumb pointer 78 * if (ptr1 && !ptr2) cerr << "check containers" << endl; 79 * @endcode 80 * 81 * @} 82 * 83 * @} 84 */ 85