OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PassThroughBuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "DataMgr/AbstractBuffer.h"
20 
21 using namespace Data_Namespace;
22 
23 namespace foreign_storage {
24 
32  public:
33  PassThroughBuffer(const int8_t* data, const size_t data_byte_size);
34  PassThroughBuffer() = delete;
35 
36  void read(int8_t* const destination,
37  const size_t num_bytes,
38  const size_t offset = 0,
39  const MemoryLevel destination_buffer_type = CPU_LEVEL,
40  const int destination_device_id = -1) override;
41 
42  void write(int8_t* source,
43  const size_t num_bytes,
44  const size_t offset = 0,
45  const MemoryLevel source_buffer_type = CPU_LEVEL,
46  const int source_device_id = -1) override;
47 
48  void reserve(size_t additional_num_bytes) override;
49 
50  void append(int8_t* source,
51  const size_t num_bytes,
52  const MemoryLevel source_buffer_type = CPU_LEVEL,
53  const int device_id = -1) override;
54 
55  int8_t* getMemoryPtr() override;
56  size_t pageCount() const override;
57  size_t pageSize() const override;
58  size_t reservedSize() const override;
59  MemoryLevel getType() const override;
60 
61  private:
62  int8_t* data_ptr_;
64 };
65 } // namespace foreign_storage
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:168
size_t write(FILE *f, const size_t offset, const size_t size, const int8_t *buf)
Writes the specified number of bytes to the offset position in file f from buf.
Definition: File.cpp:150
size_t read(FILE *f, const size_t offset, const size_t size, int8_t *buf)
Reads the specified number of bytes from the offset position in file f into buf.
Definition: File.cpp:142
An AbstractBuffer is a unit of data management for a data manager.