Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkOclResourceService.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkOclResourceService_h
14 #define mitkOclResourceService_h
15 
16 #include <mitkServiceInterface.h>
17 
18 #include <mitkOpenCL.h>
19 
28 {
29 public:
31  virtual cl_context GetContext() const = 0;
32 
34  virtual cl_command_queue GetCommandQueue() const = 0;
35 
37  virtual cl_device_id GetCurrentDevice() const = 0;
38 
40  virtual bool GetIsFormatSupported( cl_image_format* format ) = 0;
41 
43  virtual void PrintContextInfo() const = 0;
44 
51  virtual void InsertProgram(cl_program program, std::string string, bool flag) = 0;
52 
57  virtual cl_program GetProgram(const std::string& name) = 0;
58 
60  virtual void InvalidateStorage() = 0;
61 
65  virtual void RemoveProgram(const std::string& name) = 0;
66 
72  virtual unsigned int GetMaximumImageSize(unsigned int dimension, cl_mem_object_type image) = 0;
73 
74  virtual ~OclResourceService() = 0;
75 
76 };
77 
78 MITK_DECLARE_SERVICE_INTERFACE(OclResourceService, "OpenCLResourceService/1.0")
79 #endif
OclResourceService::~OclResourceService
virtual ~OclResourceService()=0
OclResourceService::GetContext
virtual cl_context GetContext() const =0
Returns a valid OpenCL Context (if applicable) or nullptr if none present.
mitkServiceInterface.h
OclResourceService::RemoveProgram
virtual void RemoveProgram(const std::string &name)=0
Remove given program from storage.
OclResourceService::GetMaximumImageSize
virtual unsigned int GetMaximumImageSize(unsigned int dimension, cl_mem_object_type image)=0
Get the maximum size of an image.
OclResourceService::GetProgram
virtual cl_program GetProgram(const std::string &name)=0
Get the cl_program by name.
OclResourceService::InsertProgram
virtual void InsertProgram(cl_program program, std::string string, bool flag)=0
Insert program into the internal program storage.
OclResourceService::GetIsFormatSupported
virtual bool GetIsFormatSupported(cl_image_format *format)=0
Checks if an OpenCL image format passed in is supported on current device.
OclResourceService::InvalidateStorage
virtual void InvalidateStorage()=0
Remove all invalid (=do not compile) programs from the internal storage.
OclResourceService::GetCommandQueue
virtual cl_command_queue GetCommandQueue() const =0
Returns a valid cl_command_queue related to the (one) OpenCL context.
OclResourceService::PrintContextInfo
virtual void PrintContextInfo() const =0
Puts the OpenCL Context info in std::cout.
mitkOpenCL.h
OclResourceService
Declaration of the OpenCL Resources micro-service.
Definition: mitkOclResourceService.h:27
OclResourceService::GetCurrentDevice
virtual cl_device_id GetCurrentDevice() const =0
Returns the identifier of an OpenCL device related to the current context.
MITK_DECLARE_SERVICE_INTERFACE
#define MITK_DECLARE_SERVICE_INTERFACE(IFace, IId)
Definition: mitkServiceInterface.h:26