OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::PassThroughBuffer Class Reference

#include <PassThroughBuffer.h>

+ Inheritance diagram for foreign_storage::PassThroughBuffer:
+ Collaboration diagram for foreign_storage::PassThroughBuffer:

Public Member Functions

 PassThroughBuffer (const int8_t *data, const size_t data_byte_size)
 
 PassThroughBuffer ()=delete
 
void read (int8_t *const destination, const size_t num_bytes, const size_t offset=0, const MemoryLevel destination_buffer_type=CPU_LEVEL, const int destination_device_id=-1) override
 
void write (int8_t *source, const size_t num_bytes, const size_t offset=0, const MemoryLevel source_buffer_type=CPU_LEVEL, const int source_device_id=-1) override
 
void reserve (size_t additional_num_bytes) override
 
void append (int8_t *source, const size_t num_bytes, const MemoryLevel source_buffer_type=CPU_LEVEL, const int device_id=-1) override
 
int8_t * getMemoryPtr () override
 
size_t pageCount () const override
 
size_t pageSize () const override
 
size_t reservedSize () const override
 
MemoryLevel getType () const override
 
- Public Member Functions inherited from Data_Namespace::AbstractBuffer
 AbstractBuffer (const int device_id)
 
 AbstractBuffer (const int device_id, const SQLTypeInfo sql_type)
 
virtual ~AbstractBuffer ()
 
virtual void setMemoryPtr (int8_t *new_ptr)
 
virtual int pin ()
 
virtual int unPin ()
 
virtual int getPinCount ()
 
size_t size () const
 
int getDeviceId () const
 
bool isDirty () const
 
bool isAppended () const
 
bool isUpdated () const
 
bool hasEncoder () const
 
SQLTypeInfo getSqlType () const
 
void setSqlType (const SQLTypeInfo &sql_type)
 
EncodergetEncoder () const
 
void setDirty ()
 
void setUpdated ()
 
void setAppended ()
 
void setSize (const size_t size)
 
void clearDirtyBits ()
 
void initEncoder (const SQLTypeInfo &tmp_sql_type)
 
void syncEncoder (const AbstractBuffer *src_buffer)
 
void copyTo (AbstractBuffer *destination_buffer, const size_t num_bytes=0)
 
void resetToEmpty ()
 

Private Attributes

int8_t * data_ptr_
 
size_t data_byte_size_
 

Additional Inherited Members

- Protected Attributes inherited from Data_Namespace::AbstractBuffer
std::unique_ptr< Encoderencoder_
 
SQLTypeInfo sql_type_
 
size_t size_
 
int device_id_
 

Detailed Description

PassThroughBuffer wraps a pointer with specifed data size. This class does not take ownership of the pointer. The underlying buffer is never intended to be modified only read, hence the constructor takes a const pointer.

Definition at line 31 of file PassThroughBuffer.h.

Constructor & Destructor Documentation

foreign_storage::PassThroughBuffer::PassThroughBuffer ( const int8_t *  data,
const size_t  data_byte_size 
)

Definition at line 21 of file PassThroughBuffer.cpp.

References data_byte_size_, and Data_Namespace::AbstractBuffer::setSize().

22  : AbstractBuffer(0)
23  , data_ptr_(const_cast<int8_t*>(data))
24  , data_byte_size_(data_byte_size) {
26 }
AbstractBuffer(const int device_id)
void setSize(const size_t size)

+ Here is the call graph for this function:

foreign_storage::PassThroughBuffer::PassThroughBuffer ( )
delete

Member Function Documentation

void foreign_storage::PassThroughBuffer::append ( int8_t *  source,
const size_t  num_bytes,
const MemoryLevel  source_buffer_type = CPU_LEVEL,
const int  device_id = -1 
)
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 41 of file PassThroughBuffer.cpp.

References UNREACHABLE.

44  {
45  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
46  "PassThroughBuffer";
47 }
#define UNREACHABLE()
Definition: Logger.h:333
int8_t * foreign_storage::PassThroughBuffer::getMemoryPtr ( )
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 49 of file PassThroughBuffer.cpp.

References data_ptr_.

49  {
50  return data_ptr_;
51 }
MemoryLevel foreign_storage::PassThroughBuffer::getType ( ) const
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 59 of file PassThroughBuffer.cpp.

References Data_Namespace::CPU_LEVEL.

59  {
60  return CPU_LEVEL;
61 }
size_t foreign_storage::PassThroughBuffer::pageCount ( ) const
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 72 of file PassThroughBuffer.cpp.

References UNREACHABLE.

72  {
73  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
74  "PassThroughBuffer";
75  return 0; // Added to avoid "no return statement" compiler warning
76 }
#define UNREACHABLE()
Definition: Logger.h:333
size_t foreign_storage::PassThroughBuffer::pageSize ( ) const
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 78 of file PassThroughBuffer.cpp.

References UNREACHABLE.

78  {
79  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
80  "PassThroughBuffer";
81  return 0; // Added to avoid "no return statement" compiler warning
82 }
#define UNREACHABLE()
Definition: Logger.h:333
void foreign_storage::PassThroughBuffer::read ( int8_t *const  destination,
const size_t  num_bytes,
const size_t  offset = 0,
const MemoryLevel  destination_buffer_type = CPU_LEVEL,
const int  destination_device_id = -1 
)
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 28 of file PassThroughBuffer.cpp.

References data_ptr_.

32  {
33  memcpy(destination, data_ptr_ + offset, num_bytes);
34 }
void foreign_storage::PassThroughBuffer::reserve ( size_t  additional_num_bytes)
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 36 of file PassThroughBuffer.cpp.

References UNREACHABLE.

36  {
37  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
38  "PassThroughBuffer";
39 }
#define UNREACHABLE()
Definition: Logger.h:333
size_t foreign_storage::PassThroughBuffer::reservedSize ( ) const
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 53 of file PassThroughBuffer.cpp.

References UNREACHABLE.

53  {
54  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
55  "PassThroughBuffer";
56  return 0;
57 }
#define UNREACHABLE()
Definition: Logger.h:333
void foreign_storage::PassThroughBuffer::write ( int8_t *  source,
const size_t  num_bytes,
const size_t  offset = 0,
const MemoryLevel  source_buffer_type = CPU_LEVEL,
const int  source_device_id = -1 
)
overridevirtual

Implements Data_Namespace::AbstractBuffer.

Definition at line 63 of file PassThroughBuffer.cpp.

References UNREACHABLE.

67  {
68  UNREACHABLE() << " unexpected call to purposefully unimplemented function in "
69  "PassThroughBuffer";
70 }
#define UNREACHABLE()
Definition: Logger.h:333

Member Data Documentation

size_t foreign_storage::PassThroughBuffer::data_byte_size_
private

Definition at line 63 of file PassThroughBuffer.h.

Referenced by PassThroughBuffer().

int8_t* foreign_storage::PassThroughBuffer::data_ptr_
private

Definition at line 62 of file PassThroughBuffer.h.

Referenced by getMemoryPtr(), and read().


The documentation for this class was generated from the following files: