Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cpp/examples/cpp_examples/demo_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ int demo_read() {
columns.emplace_back("s1");

auto table_schema = reader.get_table_schema(table_name);
storage::Filter* tag_filter1 = storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
storage::Filter* tag_filter2 = storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
storage::Filter* tag_filter = storage::TagFilterBuilder(table_schema.get()).and_filter(tag_filter1, tag_filter2);
storage::Filter* tag_filter1 =
storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
storage::Filter* tag_filter2 =
storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
storage::Filter* tag_filter = storage::TagFilterBuilder(table_schema.get())
.and_filter(tag_filter1, tag_filter2);
// Column vector contains the columns you want to select.
HANDLE_ERROR(reader.query(table_name, columns, 0, 100, temp_ret, tag_filter));
HANDLE_ERROR(
reader.query(table_name, columns, 0, 100, temp_ret, tag_filter));

// Get query handler.
auto ret = dynamic_cast<storage::TableResultSet*>(temp_ret);
Expand Down
2 changes: 0 additions & 2 deletions cpp/examples/cpp_examples/demo_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "cpp_examples.h"

int demo_write() {

storage::libtsfile_init();

std::string table_name = "table1";
Expand Down Expand Up @@ -61,7 +60,6 @@ int demo_write() {
common::ColumnCategory::FIELD},
10);


for (int row = 0; row < 5; row++) {
long timestamp = row;
tablet.add_timestamp(row, timestamp);
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/common/allocator/alloc_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ enum AllocModID {
__MAX_MOD_ID = 127, // leave 1 bit to detect header size
};

extern const char *g_mod_names[__LAST_MOD_ID];
extern const char* g_mod_names[__LAST_MOD_ID];

/* very basic alloc/free interface in C style */
void *mem_alloc(uint32_t size, AllocModID mid);
void mem_free(void *ptr);
void *mem_realloc(void *ptr, uint32_t size);
void* mem_alloc(uint32_t size, AllocModID mid);
void mem_free(void* ptr);
void* mem_realloc(void* ptr, uint32_t size);

class ModStat {
public:
ModStat() : stat_arr_(NULL) {}

static ModStat &get_instance() {
static ModStat& get_instance() {
/*
* This is the singleton of Mod Memory Statistic.
* gms is short for Global Mod Statistic
Expand All @@ -108,23 +108,23 @@ class ModStat {
#endif

private:
INLINE int32_t *get_item(int8_t mid) {
INLINE int32_t* get_item(int8_t mid) {
return &(stat_arr_[mid * (ITEM_SIZE / sizeof(int32_t))]);
}

private:
static const int32_t ITEM_SIZE = CACHE_LINE_SIZE;
static const int32_t ITEM_COUNT = __LAST_MOD_ID;
int32_t *stat_arr_;
int32_t* stat_arr_;

STATIC_ASSERT((ITEM_SIZE % sizeof(int32_t) == 0), ModStat_ITEM_SIZE_ERROR);
};

/* base allocator */
class BaseAllocator {
public:
void *alloc(uint32_t size, AllocModID mid) { return mem_alloc(size, mid); }
void free(void *ptr) { mem_free(ptr); }
void* alloc(uint32_t size, AllocModID mid) { return mem_alloc(size, mid); }
void free(void* ptr) { mem_free(ptr); }
};

extern BaseAllocator g_base_allocator;
Expand Down
Loading
Loading