Browse Source

update: RawCode module

master
Dnomd343 2 years ago
parent
commit
43cd86b552
  1. 3
      include/klotski.h
  2. 2
      src/raw_code/CMakeLists.txt
  3. 11
      src/raw_code/convert.cc
  4. 4
      src/raw_code/raw_code.cc
  5. 11
      src/raw_code/raw_code.h

3
include/klotski.h

@ -20,9 +20,6 @@
//#define F_2x1 uint64_t(0x7007)
//#define F_2x2 uint64_t(0x3F03F)
//uint64_t compact_code(uint64_t code);
//uint64_t extract_code(uint64_t code);
#endif
/*

2
src/raw_code/CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(raw_code raw_code.cc)
add_library(raw_code convert.cc raw_code.cc)
target_link_libraries(raw_code utils common_code)

11
src/raw_code/convert.cc

@ -0,0 +1,11 @@
#include "raw_code.h"
uint64_t RawCode::compact(uint64_t raw_code) { // raw code --> common code
return 0;
// TODO: should we throw error here?
}
/// NOTE: ensure that input common code is valid !!!
uint64_t RawCode::extract(uint64_t common_code) { // common code --> raw code
return 0;
}

4
src/raw_code/raw_code.cc

@ -88,3 +88,7 @@ std::string RawCode::dump_case() const {
}
return result;
}

11
src/raw_code/raw_code.h

@ -1,6 +1,8 @@
#pragma once
#include <string>
#include <cstdint>
#include <ostream>
#include "common_code.h"
class CommonCode;
@ -10,10 +12,19 @@ public:
uint64_t unwrap() const;
std::string dump_case() const;
CommonCode to_common_code() const;
// friend std::ostream& operator<<(std::ostream &out, const RawCode &self);
explicit RawCode(const CommonCode &common_code);
explicit RawCode(uint64_t raw_code) : code(raw_code) {}
// static RawCode create(uint64_t raw_code);
// static RawCode from_common_code(const CommonCode &common_code);
// TODO: mirror functions
private:
uint64_t code;
static uint64_t compact(uint64_t raw_code);
static uint64_t extract(uint64_t common_code);
};

Loading…
Cancel
Save