C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

data_block.h
1 /* file: data_block.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the DataBlock type
45 //--
46 */
47 
48 #ifndef __DAAL_DATABLOCK_H__
49 #define __DAAL_DATABLOCK_H__
50 
51 #include "services/base.h"
52 #include "services/daal_shared_ptr.h"
53 
54 namespace daal
55 {
56 namespace data_management
57 {
58 
59 namespace interface1
60 {
70 class DataBlockIface : public Base
71 {
72 public:
73  virtual ~DataBlockIface() {}
78  virtual byte *getPtr() const = 0;
83  virtual services::SharedPtr<byte> getSharedPtr() const = 0;
88  virtual size_t getSize() const = 0;
93  virtual void setPtr(byte *ptr) = 0;
98  virtual void setPtr(const services::SharedPtr<byte> &ptr) = 0;
103  virtual void setSize(size_t size) = 0;
104 };
109 class DAAL_EXPORT DataBlock : public DataBlockIface
110 {
111 public:
115  DataBlock() : _ptr(), _size(0)
116  {}
122  DataBlock(byte * ptr, size_t size) : _ptr(ptr, services::EmptyDeleter()), _size(size)
123  {}
129  DataBlock(const services::SharedPtr<byte> &ptr, size_t size) : _ptr(ptr), _size(size)
130  {}
135  DataBlock(size_t size) : _ptr(), _size(size)
136  {}
141  DataBlock(const DataBlock &block)
142  {
143  _ptr = block._ptr;
144  _size = block._size;
145  }
146 
147  virtual ~DataBlock() {}
148 
149  virtual byte *getPtr() const DAAL_C11_OVERRIDE
150  {
151  return _ptr.get();
152  }
153 
154  virtual services::SharedPtr<byte> getSharedPtr() const DAAL_C11_OVERRIDE
155  {
156  return _ptr;
157  }
158 
159  virtual size_t getSize() const DAAL_C11_OVERRIDE
160  {
161  return _size;
162  }
163 
164  virtual void setPtr(byte *ptr) DAAL_C11_OVERRIDE
165  {
166  _ptr = services::SharedPtr<byte>(ptr, services::EmptyDeleter());
167  }
168 
169  virtual void setPtr(const services::SharedPtr<byte> &ptr) DAAL_C11_OVERRIDE
170  {
171  _ptr = ptr;
172  }
173 
174  virtual void setSize(size_t size) DAAL_C11_OVERRIDE
175  {
176  _size = size;
177  }
178 
179 private:
180  services::SharedPtr<byte> _ptr;
181  size_t _size;
182 };
183 typedef services::SharedPtr<DataBlock> DataBlockPtr;
185 } // namespace interface1
186 using interface1::DataBlock;
187 using interface1::DataBlockPtr;
188 using interface1::DataBlockIface;
189 }
190 }
191 
192 #endif
daal
Definition: algorithm_base_common.h:57
daal::data_management::interface1::DataBlock::getSharedPtr
virtual services::SharedPtr< byte > getSharedPtr() const DAAL_C11_OVERRIDE
Definition: data_block.h:154
daal::data_management::interface1::DataBlock::setSize
virtual void setSize(size_t size) DAAL_C11_OVERRIDE
Definition: data_block.h:174
daal::data_management::interface1::DataBlockIface
Abstract interface class for a data management component responsible for a pointer to a byte array an...
Definition: data_block.h:70
daal::data_management::interface1::DataBlock::getPtr
virtual byte * getPtr() const DAAL_C11_OVERRIDE
Definition: data_block.h:149
daal::data_management::interface1::DataBlock::setPtr
virtual void setPtr(byte *ptr) DAAL_C11_OVERRIDE
Definition: data_block.h:164
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::data_management::interface1::DataBlock::getSize
virtual size_t getSize() const DAAL_C11_OVERRIDE
Definition: data_block.h:159
daal::data_management::interface1::DataBlockIface::setSize
virtual void setSize(size_t size)=0
daal::data_management::interface1::DataBlockIface::getSize
virtual size_t getSize() const =0
daal::data_management::interface1::DataBlock::DataBlock
DataBlock(const DataBlock &block)
Definition: data_block.h:141
daal::data_management::interface1::DataBlockIface::getPtr
virtual byte * getPtr() const =0
daal::data_management::interface1::DataBlock::DataBlock
DataBlock()
Definition: data_block.h:115
daal::data_management::interface1::DataBlockIface::getSharedPtr
virtual services::SharedPtr< byte > getSharedPtr() const =0
daal::data_management::interface1::DataBlockIface::setPtr
virtual void setPtr(byte *ptr)=0
daal::data_management::interface1::DataBlock::DataBlock
DataBlock(size_t size)
Definition: data_block.h:135
daal::data_management::interface1::DataBlock::DataBlock
DataBlock(byte *ptr, size_t size)
Definition: data_block.h:122
daal::data_management::interface1::DataBlock::setPtr
virtual void setPtr(const services::SharedPtr< byte > &ptr) DAAL_C11_OVERRIDE
Definition: data_block.h:169
daal::data_management::interface1::DataBlock::DataBlock
DataBlock(const services::SharedPtr< byte > &ptr, size_t size)
Definition: data_block.h:129
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:65
daal::services::interface1::EmptyDeleter
Implementation of DeleterIface without pointer destroying.
Definition: daal_shared_ptr.h:125
daal::data_management::interface1::DataBlock
Class that stores a pointer to a byte array and its size. Not responsible for memory management...
Definition: data_block.h:109

For more complete information about compiler optimizations, see our Optimization Notice.