operation.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* base class for all vips operations
  2. */
  3. /*
  4. Copyright (C) 1991-2005 The National Gallery
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. */
  18. /*
  19. These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
  20. */
  21. #ifndef VIPS_OPERATION_H
  22. #define VIPS_OPERATION_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif /*__cplusplus*/
  26. typedef enum /*< flags >*/ {
  27. VIPS_OPERATION_NONE = 0,
  28. VIPS_OPERATION_SEQUENTIAL = 1,
  29. VIPS_OPERATION_SEQUENTIAL_UNBUFFERED = 2,
  30. VIPS_OPERATION_NOCACHE = 4,
  31. VIPS_OPERATION_DEPRECATED = 8
  32. } VipsOperationFlags;
  33. #define VIPS_TYPE_OPERATION (vips_operation_get_type())
  34. #define VIPS_OPERATION( obj ) \
  35. (G_TYPE_CHECK_INSTANCE_CAST( (obj), \
  36. VIPS_TYPE_OPERATION, VipsOperation ))
  37. #define VIPS_OPERATION_CLASS( klass ) \
  38. (G_TYPE_CHECK_CLASS_CAST( (klass), \
  39. VIPS_TYPE_OPERATION, VipsOperationClass ))
  40. #define VIPS_IS_OPERATION( obj ) \
  41. (G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_OPERATION ))
  42. #define VIPS_IS_OPERATION_CLASS( klass ) \
  43. (G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_OPERATION ))
  44. #define VIPS_OPERATION_GET_CLASS( obj ) \
  45. (G_TYPE_INSTANCE_GET_CLASS( (obj), \
  46. VIPS_TYPE_OPERATION, VipsOperationClass ))
  47. typedef gboolean (*VipsOperationBuildFn)( VipsObject *object );
  48. typedef struct _VipsOperation {
  49. VipsObject parent_instance;
  50. /* Keep the hash here.
  51. */
  52. guint hash;
  53. gboolean found_hash;
  54. /* Pixels calculated ... handy for measuring over-calculation.
  55. */
  56. int pixels;
  57. } VipsOperation;
  58. typedef struct _VipsOperationClass {
  59. VipsObjectClass parent_class;
  60. /* Print the usage message.
  61. */
  62. void (*usage)( struct _VipsOperationClass *cls, VipsBuf *buf );
  63. /* Return a set of operation flags.
  64. */
  65. VipsOperationFlags (*get_flags)( VipsOperation *operation );
  66. VipsOperationFlags flags;
  67. /* One of our input images has signalled "invalidate". The cache uses
  68. * VipsOperation::invalidate to drop dirty ops.
  69. */
  70. void (*invalidate)( VipsOperation *operation );
  71. } VipsOperationClass;
  72. /* Don't put spaces around void here, it breaks gtk-doc.
  73. */
  74. GType vips_operation_get_type(void);
  75. VipsOperationFlags vips_operation_get_flags( VipsOperation *operation );
  76. void vips_operation_class_print_usage( VipsOperationClass *operation_class );
  77. void vips_operation_invalidate( VipsOperation *operation );
  78. int vips_operation_call_valist( VipsOperation *operation, va_list ap );
  79. VipsOperation *vips_operation_new( const char *name );
  80. int vips_call_required_optional( VipsOperation **operation,
  81. va_list required, va_list optional );
  82. int vips_call( const char *operation_name, ... )
  83. __attribute__((sentinel));
  84. int vips_call_split( const char *operation_name, va_list optional, ... );
  85. int vips_call_split_option_string( const char *operation_name,
  86. const char *option_string, va_list optional, ... );
  87. void vips_call_options( GOptionGroup *group, VipsOperation *operation );
  88. int vips_call_argv( VipsOperation *operation, int argc, char **argv );
  89. void vips_cache_drop_all( void );
  90. VipsOperation *vips_cache_operation_lookup( VipsOperation *operation );
  91. void vips_cache_operation_add( VipsOperation *operation );
  92. int vips_cache_operation_buildp( VipsOperation **operation );
  93. VipsOperation *vips_cache_operation_build( VipsOperation *operation );
  94. void vips_cache_print( void );
  95. void vips_cache_set_max( int max );
  96. void vips_cache_set_max_mem( size_t max_mem );
  97. int vips_cache_get_max( void );
  98. int vips_cache_get_size( void );
  99. size_t vips_cache_get_max_mem( void );
  100. int vips_cache_get_max_files( void );
  101. void vips_cache_set_max_files( int max_files );
  102. void vips_cache_set_dump( gboolean dump );
  103. void vips_cache_set_trace( gboolean trace );
  104. /* Part of threadpool, really, but we want these in a header that gets scanned
  105. * for our typelib.
  106. */
  107. void vips_concurrency_set( int concurrency );
  108. int vips_concurrency_get( void );
  109. #ifdef __cplusplus
  110. }
  111. #endif /*__cplusplus*/
  112. #endif /*VIPS_OPERATION_H*/