Homepage Demos Overview Downloads Tutorials Reference
Credits

SystemUtility.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 /*=========================================================================
00003     CMPack'02 Source Code Release for OPEN-R SDK v1.0
00004     Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
00005     School of Computer Science, Carnegie Mellon University
00006   -------------------------------------------------------------------------
00007     This software is distributed under the GNU General Public License,
00008     version 2.  If you do not have a copy of this licence, visit
00009     www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
00010     Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
00011     in the hope that it will be useful, but WITHOUT ANY WARRANTY,
00012     including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00013   -------------------------------------------------------------------------
00014     Additionally licensed to Sony Corporation under the following terms:
00015 
00016     This software is provided by the copyright holders AS IS and any
00017     express or implied warranties, including, but not limited to, the
00018     implied warranties of merchantability and fitness for a particular
00019     purpose are disclaimed.  In no event shall authors be liable for
00020     any direct, indirect, incidental, special, exemplary, or consequential
00021     damages (including, but not limited to, procurement of substitute
00022     goods or services; loss of use, data, or profits; or business
00023     interruption) however caused and on any theory of liability, whether
00024     in contract, strict liability, or tort (including negligence or
00025     otherwise) arising in any way out of the use of this software, even if
00026     advised of the possibility of such damage.
00027   =========================================================================
00028 */
00029 #ifndef INCLUDED_SystemUtility_h
00030 #define INCLUDED_SystemUtility_h
00031 
00032 #include <MCOOP.h>
00033 
00034 #ifdef PLATFORM_APERIOS
00035 //! Gets memory from Aperios/OPEN-R using system's NewRegion command
00036 /*! This seems to be the thing to do when getting large regions?  We've
00037  *  had some issues with large regions returned from @c new which overlap.
00038  *  This issue may no longer exist, was never well known. */
00039 template <class T>
00040 T *NewLarge(T **dst, int count) {
00041   sError result;
00042   result=NewRegion(sizeof(T)*count+8096, reinterpret_cast<void **>(dst));
00043   if (result != sSUCCESS)
00044     *dst=NULL;
00045 
00046   return *dst;
00047 }
00048 
00049 //! Frees memory from Aperios/OPEN-R using system's DeleteRegion command (use only on regions obtained from NewLarge)
00050 template <class T>
00051 void DeleteLarge(T *dst) {
00052   DeleteRegion(dst);
00053 }
00054 #endif
00055 
00056 /*! @file
00057  * @brief Wrappers for getting large memory regions from Aperios
00058  * @author CMU RoboSoccer 2001-2002 (Creator)
00059  * 
00060  * @verbinclude CMPack_license.txt
00061  *
00062  * $Author: ejt $
00063  * $Name: tekkotsu-2_2_1 $
00064  * $Revision: 1.4 $
00065  * $State: Rel $
00066  * $Date: 2003/10/10 17:46:04 $
00067  */
00068 
00069 #endif

Tekkotsu v2.2.1
Generated Tue Nov 23 16:36:40 2004 by Doxygen 1.3.9.1