cleanups ready for proto gen

This commit is contained in:
John Cupitt 2014-10-27 14:17:33 +00:00
parent b5cd4ac144
commit 070a437f61
3 changed files with 26 additions and 3 deletions

View File

@ -37,8 +37,9 @@
#include <vips/debug.h>
/*
#define DEBUG
*/
#define VIPS_DEBUG
#define DEBUG
VIPS_NAMESPACE_START
@ -62,6 +63,7 @@ VOption *VOption::set( const char *name, const char *value )
return( this );
}
// input int ... this path is used for enums as well
VOption *VOption::set( const char *name, int value )
{
Pair *pair = new Pair( name );
@ -74,6 +76,7 @@ VOption *VOption::set( const char *name, int value )
return( this );
}
// input image
VOption *VOption::set( const char *name, VImage value )
{
Pair *pair = new Pair( name );
@ -87,6 +90,7 @@ VOption *VOption::set( const char *name, VImage value )
return( this );
}
// output image
VOption *VOption::set( const char *name, VImage *value )
{
Pair *pair = new Pair( name );
@ -108,12 +112,14 @@ void VOption::set_operation( VipsOperation *operation )
for( i = options.begin(); i != options.end(); i++ )
if( (*i)->input ) {
#ifdef DEBUG
printf( "set_operation: " );
vips_object_print_name( VIPS_OBJECT( operation ) );
char *str_value =
g_strdup_value_contents( &(*i)->value );
printf( ".%s = %s\n", (*i)->name, str_value );
g_free( str_value );
#endif /*DEBUG*/
g_object_set_property( G_OBJECT( operation ),
(*i)->name, &(*i)->value );
@ -130,12 +136,14 @@ void VOption::get_operation( VipsOperation *operation )
g_object_get_property( G_OBJECT( operation ),
(*i)->name, &(*i)->value );
#ifdef DEBUG
printf( "get_operation: " );
vips_object_print_name( VIPS_OBJECT( operation ) );
char *str_value =
g_strdup_value_contents( &(*i)->value );
printf( ".%s = %s\n", (*i)->name, str_value );
g_free( str_value );
#endif /*DEBUG*/
// rebox object
VipsImage *image = VIPS_IMAGE(

View File

@ -5,6 +5,8 @@
*
*/
#define DEBUG
#include <vips/vips8>
using namespace vips8;
@ -40,7 +42,9 @@ main( int argc, char **argv )
printf( "sizeof( VImage ) = %zd\n", sizeof( VImage ) );
{
VImage in = VImage::new_from_file( argv[1] );
VImage in = VImage::new_from_file( argv[1],
VImage::option()->set( "access", VIPS_ACCESS_SEQUENTIAL_UNBUFFERED ) );
VImage out;
out = in.invert();

View File

@ -60,6 +60,7 @@ public:
g_assert( !new_vobject ||
VIPS_IS_OBJECT( new_vobject ) );
#ifdef DEBUG
printf( "VObject constructor, obj = %p, steal = %d\n",
new_vobject, steal );
if( new_vobject ) {
@ -67,8 +68,12 @@ public:
vips_object_print_name( VIPS_OBJECT( new_vobject ) );
printf( "\n" );
}
#endif /*DEBUG*/
if( !steal ) {
#ifdef DEBUG
printf( " reffing object\n" );
#endif /*DEBUG*/
g_object_ref( vobject );
}
}
@ -84,10 +89,12 @@ public:
{
g_assert( VIPS_IS_OBJECT( a.vobject ) );
#ifdef DEBUG
printf( "VObject copy constructor, obj = %p\n",
vobject );
g_object_ref( vobject );
printf( " reffing object\n" );
#endif /*DEBUG*/
g_object_ref( vobject );
}
// assignment ... we must delete the old ref
@ -96,9 +103,11 @@ public:
{
VipsObject *old_vobject;
#ifdef DEBUG
printf( "VObject assignment\n" );
printf( " reffing %p\n", a.vobject );
printf( " unreffing %p\n", vobject );
#endif /*DEBUG*/
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );
@ -120,8 +129,10 @@ public:
// no vtable allowed
~VObject()
{
#ifdef DEBUG
printf( "VObject destructor\n" );
printf( " unreffing %p\n", vobject );
#endif /*DEBUG*/
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );