Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
clfMemory.hh
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10  BIAS is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 2.1 of the License, or
13  (at your option) any later version.
14 
15  BIAS is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with BIAS; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #ifndef CLFMEMORY_HH_
26 #define CLFMEMORY_HH_
27 
28 #include <Base/Common/BIASpragmaStart.hh>
29 #include <OpenCLFramework/clfOpenCL.hh>
30 
31 namespace BIAS {
32 
33  class BIASOpenCLFramework_EXPORT clfMemory {
34  public:
35  virtual ~clfMemory();
36 
37  inline bool Initialized() { return initialized_; }
38  inline bool IsSharedGL() { return sharedGL_; }
39 
40  inline unsigned int Size() { return size_; }
41  unsigned int GLId();
42 
43  void UnMap(void *data);
44 
45  bool IsReadOnly();
46  bool IsWriteOnly();
47 
48  protected:
49  clfMemory(cl::Context *context, cl::CommandQueue *queue);
50  cl::Memory& memory();
51 
52  int DetermineMemFlags_(bool readonly, bool writeonly, const void *hostptr=NULL, bool copy=false);
53 
54  cl::Context* context_;
55  cl::CommandQueue* queue_;
56  cl::Memory buffer_;
57 
58  unsigned int size_;
60  bool sharedGL_;
61  unsigned int glid_;
62  private:
63  friend class clfContext;
64  };
65 
66 }
67 #include <Base/Common/BIASpragmaEnd.hh>
68 #endif /* CLFMEMORY_HH_ */
bool IsSharedGL()
Definition: clfMemory.hh:38
unsigned int glid_
Definition: clfMemory.hh:61
cl::Context * context_
Definition: clfMemory.hh:54
cl::CommandQueue * queue_
Definition: clfMemory.hh:55
OpenCL Context wrapper.
Definition: clfContext.hh:49
bool Initialized()
Definition: clfMemory.hh:37
cl::Memory buffer_
Definition: clfMemory.hh:56
unsigned int Size()
Definition: clfMemory.hh:40
unsigned int size_
Definition: clfMemory.hh:58