/**
 * @file
 * $Id: tuple.h 2577 2005-10-02 09:47:13Z plasmahh $
 * $Revision: 2577 $
 * $Author: plasmahh $
 * $Date: 2005-10-02 11:47:13 +0200 (So, 02 Okt 2005) $
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWEAR_VALGRIND_H
#define __IWEAR_VALGRIND_H

#include <iwear/memcheck_requests.h>
#include <iwear/debugstream.h>

namespace iwear
{
namespace valgrind 
{

inline bool running_on( void )
{
    return ( RUNNING_ON_VALGRIND );
}

template<class T> inline void noaccess( T&t )
{
    VALGRIND_MAKE_NOACCESS(&t,sizeof(t));
}

template<class T> inline void* defined( T&t )
{
    // XXX Check if we need to extend this to definedness of the further bytes
    // of this structure.
    /*
    if( running_on() )
    {
	d_dbg << "Doing a client check of " << (void*)&t << endl;
    }*/
    return (void*)VALGRIND_CHECK_DEFINED(t);
}

}
}

#endif
