Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
Field.h File Reference
#include <vector>
#include <algorithm>
#include <variant>
#include "joedb/Type.h"
#include "joedb/index_types.h"
#include "joedb/TYPE_MACRO.h"
Include dependency graph for Field.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  joedb::Field
 

Namespaces

namespace  joedb
 

Macros

#define TYPE_MACRO(cpp_type, return_type, type_id, R, W)    , std::vector<cpp_type>
 
#define TYPE_MACRO(cpp_type, return_type, type_id, R, W)
 
#define TYPE_MACRO(cpp_type, return_type, type_id, R, W)
 
#define TYPE_MACRO(cpp_type, return_type, type_id, R, W)
 

Macro Definition Documentation

◆ TYPE_MACRO [1/4]

#define TYPE_MACRO (   cpp_type,
  return_type,
  type_id,
  R,
 
)     , std::vector<cpp_type>

Definition at line 60 of file Field.h.

◆ TYPE_MACRO [2/4]

#define TYPE_MACRO (   cpp_type,
  return_type,
  type_id,
  R,
 
)
Value:
case Type::Type_Id::type_id:\
column.emplace<std::vector<cpp_type>>(size);\
break;

Definition at line 60 of file Field.h.

◆ TYPE_MACRO [3/4]

#define TYPE_MACRO (   cpp_type,
  return_type,
  type_id,
  R,
 
)
Value:
case Type::Type_Id::type_id:\
std::get<std::vector<cpp_type>>(column).resize(size);\
break;

Definition at line 60 of file Field.h.

◆ TYPE_MACRO [4/4]

#define TYPE_MACRO (   cpp_type,
  return_type,
  type_id,
  R,
 
)
Value:
return_type get_##type_id(Record_Id record_id) const\
{\
return std::get<std::vector<cpp_type>>(column)[index(record_id)];\
}\
void set_##type_id(Record_Id record_id, return_type value)\
{\
std::get<std::vector<cpp_type>>(column)[index(record_id)] = value;\
}\
const cpp_type *get_vector_##type_id() const\
{\
return &std::get<std::vector<cpp_type>>(column)[0];\
}\
void set_vector_##type_id(Record_Id record_id,\
size_t size,\
const cpp_type *value)\
{\
cpp_type *target =\
&std::get<std::vector<cpp_type>>(column)[index(record_id)];\
if (target != value)\
std::copy_n(value, size, target);\
}\
cpp_type *get_own_##type_id##_storage(Record_Id record_id)\
{\
return &std::get<std::vector<cpp_type>>(column)[index(record_id)];\
}\
const cpp_type *get_own_##type_id##_storage(Record_Id record_id) const\
{\
return &std::get<std::vector<cpp_type>>(column)[index(record_id)];\
}

Definition at line 60 of file Field.h.