Skip to content

Commit

Permalink
Switch to biicode
Browse files Browse the repository at this point in the history
  • Loading branch information
smessmer committed Feb 16, 2015
1 parent 424c408 commit 3350e93
Show file tree
Hide file tree
Showing 39 changed files with 238 additions and 108 deletions.
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

97 changes: 97 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
INCLUDE(messmer/cmake/tools)

# Initializes block variables
INIT_BIICODE_BLOCK()

SETUP_GOOGLETEST()

# Actually create targets: EXEcutables and libraries.
ADD_BIICODE_TARGETS()

ACTIVATE_CPP14()

# You can safely delete lines from here...

###############################################################################
# REFERENCE #
###############################################################################
#
# This CMakeLists.txt file helps defining your block building and compiling
# To learn more about the CMake use with biicode, visit http://docs.biicode.com/c++.html
#
# ----------------------------------------------------
# NEW FEATURE! Include cmake files from remote blocks:
# -----------------------------------------------------
# Now you can handle cmake dependencies alike you do with c/c++:
#
# INCLUDE(user/block/myrecipe) # include myrecipe.cmake from remote user/block
#
# > EXAMPLE: Include our recipes and activate C++11 in your block (http://www.biicode.com/biicode/cmake)
#
# INCLUDE(biicode/cmake/tools) # Include tools.cmake file from "cmake" block from the "biicode" user
# ACTIVATE_CPP11(INTERFACE ${BII_BLOCK_TARGET})
#
# Remember to run "bii find" to download out cmake tools file
#
# ---------------------
# INIT_BIICODE_BLOCK()
# ---------------------
# This function creates several helper variables as ${BII_BLOCK_NAME} and ${BII_BLOCK_USER}
# Also it loads variables from the cmake/bii_user_block_vars.cmake
# ${BII_LIB_SRC} File list to create the library
# ${BII_LIB_TYPE} Empty (default, STATIC most casess) STATIC or SHARED
# ${BII_LIB_DEPS} Dependencies to other libraries (user2_block2, user3_blockX)
# ${BII_LIB_SYSTEM_HEADERS} System linking requirements as windows.h, pthread.h, etc
#
# You can use or modify them here, for example, to add or remove files from targets based on OS
# Or use typical cmake configurations done BEFORE defining targets. Examples:
# ADD_DEFINITIONS(-DFOO)
# FIND_PACKAGE(OpenGL QUIET)
# You can add INCLUDE_DIRECTORIES here too
#
# ---------------------
# ADD_BIICODE_TARGETS()
# ---------------------
#
# This function creates the following variables:
# ${BII_BLOCK_TARGET} Interface (no files) target for convenient configuration of all
# targets in this block, as the rest of targets always depend on it
# has name in the form "user_block_interface"
# ${BII_LIB_TARGET} Target library name, usually in the form "user_block". May not exist
# if BII_LIB_SRC is empty
# ${BII_BLOCK_TARGETS} List of all targets defined in this block
# ${BII_BLOCK_EXES} List of executables targets defined in this block
# ${BII_exe_name_TARGET}: Executable target (e.g. ${BII_main_TARGET}. You can also use
# directly the name of the executable target (e.g. user_block_main)
#
# > EXAMPLE: Add include directories to all targets of this block
#
# TARGET_INCLUDE_DIRECTORIES(${BII_BLOCK_TARGET} INTERFACE myincludedir)
#
# You can add private include directories to the Lib (if existing)
#
# > EXAMPLE: Link with pthread:
#
# TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE pthread)
# or link against library:
# TARGET_LINK_LIBRARIES(${BII_LIB_TARGET} PUBLIC pthread)
# or directly use the library target name:
# TARGET_LINK_LIBRARIES(user_block PUBLIC pthread)
#
# NOTE: This can be also done adding pthread to ${BII_LIB_DEPS}
# BEFORE calling ADD_BIICODE_TARGETS()
#
# > EXAMPLE: how to activate C++11
#
# IF(APPLE)
# TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE "-std=c++11 -stdlib=libc++")
# ELSEIF (WIN32 OR UNIX)
# TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE "-std=c++11")
# ENDIF(APPLE)
#
# > EXAMPLE: Set properties to target
#
# SET_TARGET_PROPERTIES(${BII_BLOCK_TARGET} PROPERTIES COMPILE_DEFINITIONS "IOV_MAX=255")
#


46 changes: 46 additions & 0 deletions biicode.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Biicode configuration file

[requirements]
google/gtest: 10
messmer/blockstore
messmer/cmake: 1
messmer/cpp-utils

[parent]
# The parent version of this block. Must match folder name. E.g.
# user/block # No version number means not published yet
# You can change it to publish to a different track, and change version, e.g.
# user/block(track): 7

[paths]
# Local directories to look for headers (within block)
# /
# include

[dependencies]
# Manual adjust file implicit dependencies, add (+), remove (-), or overwrite (=)
# hello.h + hello_imp.cpp hello_imp2.cpp
# *.h + *.cpp

test/main.cpp + test/*.cpp

[mains]
# Manual adjust of files that define an executable
# !main.cpp # Do not build executable from this file
# main2.cpp # Build it (it doesnt have a main() function, but maybe it includes it)

[hooks]
# These are defined equal to [dependencies],files names matching bii*stage*hook.py
# will be launched as python scripts at stage = {post_process, clean}
# CMakeLists.txt + bii/my_post_process1_hook.py bii_clean_hook.py

[includes]
# Mapping of include patterns to external blocks
# hello*.h: user3/depblock # includes will be processed as user3/depblock/hello*.h

[data]
# Manually define data files dependencies, that will be copied to bin for execution
# By default they are copied to bin/user/block/... which should be taken into account
# when loading from disk such data
# image.cpp + image.jpg # code should write open("user/block/image.jpg")

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <blobstore/implementations/onblocks/BlobOnBlocks.h>
#include "BlobOnBlocks.h"

#include <blobstore/implementations/onblocks/datanodestore/DataNode.h>
#include "datanodestore/DataNode.h"

using std::unique_ptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_BLOBONBLOCKS_H_
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_BLOBONBLOCKS_H_

#include "blobstore/interface/Blob.h"
#include "../../interface/Blob.h"

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <blobstore/implementations/onblocks/datanodestore/DataLeafNode.h>
#include <blobstore/implementations/onblocks/datanodestore/DataNodeStore.h>
#include "datanodestore/DataLeafNode.h"
#include "datanodestore/DataNodeStore.h"
#include "BlobStoreOnBlocks.h"

#include "BlobOnBlocks.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef BLOBSTORE_IMPLEMENTATIONS_BLOCKED_BLOBSTOREONBLOCKS_H_
#define BLOBSTORE_IMPLEMENTATIONS_BLOCKED_BLOBSTOREONBLOCKS_H_

#include "blobstore/interface/BlobStore.h"
#include "blockstore/interface/BlockStore.h"
#include "../../interface/BlobStore.h"
#include "messmer/blockstore/interface/BlockStore.h"

namespace blobstore {
namespace onblocks {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "DataInnerNode.h"
#include "DataNodeStore.h"


using std::unique_ptr;
using blockstore::Block;
using blockstore::Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODE_H_

#include "DataNodeView.h"
#include "blockstore/utils/Data.h"
#include "messmer/blockstore/utils/Data.h"

namespace blobstore {
namespace onblocks {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "DataInnerNode.h"
#include "DataLeafNode.h"
#include "DataNodeStore.h"
#include "blockstore/interface/BlockStore.h"
#include "blockstore/interface/Block.h"
#include "blockstore/utils/BlockStoreUtils.h"
#include "messmer/blockstore/interface/BlockStore.h"
#include "messmer/blockstore/interface/Block.h"
#include "messmer/blockstore/utils/BlockStoreUtils.h"


using blockstore::BlockStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODESTORE_H_

#include <memory>
#include "fspp/utils/macros.h"
#include "messmer/cpp-utils/macros.h"

namespace blockstore{
class Block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODEVIEW_H_
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODEVIEW_H_

#include "blockstore/interface/Block.h"
#include "blobstore/implementations/onblocks/BlobStoreOnBlocks.h"
#include "messmer/blockstore/interface/Block.h"
#include "../BlobStoreOnBlocks.h"

#include "fspp/utils/macros.h"
#include "messmer/cpp-utils/macros.h"

#include <memory>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "DataTree.h"

#include "blobstore/implementations/onblocks/datanodestore/DataNodeStore.h"
#include "blobstore/implementations/onblocks/datanodestore/DataInnerNode.h"
#include "blobstore/implementations/onblocks/datanodestore/DataLeafNode.h"
#include "../datanodestore/DataNodeStore.h"
#include "../datanodestore/DataInnerNode.h"
#include "../datanodestore/DataLeafNode.h"

#include "impl/GetLowestRightBorderNodeWithLessThanKChildrenOrNull.h"

#include "fspp/utils/pointer.h"
#include "messmer/cpp-utils/pointer.h"

using blockstore::Key;
using blobstore::onblocks::datanodestore::DataNodeStore;
Expand All @@ -18,8 +18,8 @@ using std::unique_ptr;
using std::dynamic_pointer_cast;
using std::function;

using fspp::dynamic_pointer_move;
using fspp::ptr::optional_ownership_ptr;
using cpputils::dynamic_pointer_move;
using cpputils::optional_ownership_ptr;

namespace blobstore {
namespace onblocks {
Expand Down Expand Up @@ -49,10 +49,10 @@ unique_ptr<DataLeafNode> DataTree::addDataLeafAt(DataInnerNode *insertPos) {
}

optional_ownership_ptr<DataNode> DataTree::createChainOfInnerNodes(unsigned int num, DataLeafNode *leaf) {
optional_ownership_ptr<DataNode> chain = fspp::ptr::WithoutOwnership<DataNode>(leaf);
optional_ownership_ptr<DataNode> chain = cpputils::WithoutOwnership<DataNode>(leaf);
for(unsigned int i=0; i<num; ++i) {
auto newnode = _nodeStore->createNewInnerNode(*chain);
chain = fspp::ptr::WithOwnership<DataNode>(std::move(newnode));
chain = cpputils::WithOwnership<DataNode>(std::move(newnode));
}
return chain;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREE_H_

#include <memory>
#include "fspp/utils/macros.h"
#include "messmer/cpp-utils/macros.h"
#include "impl/GetLowestRightBorderNodeWithLessThanKChildrenOrNull.h"

namespace blockstore {
Expand Down Expand Up @@ -34,7 +34,7 @@ class DataTree {
std::unique_ptr<datanodestore::DataNode> _rootNode;

std::unique_ptr<datanodestore::DataLeafNode> addDataLeafAt(datanodestore::DataInnerNode *insertPos);
fspp::ptr::optional_ownership_ptr<datanodestore::DataNode> createChainOfInnerNodes(unsigned int num, datanodestore::DataLeafNode *leaf);
cpputils::optional_ownership_ptr<datanodestore::DataNode> createChainOfInnerNodes(unsigned int num, datanodestore::DataLeafNode *leaf);
std::unique_ptr<datanodestore::DataLeafNode> addDataLeafToFullTree();

DISALLOW_COPY_AND_ASSIGN(DataTree);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "DataTreeStore.h"
#include "blobstore/implementations/onblocks/datanodestore/DataNodeStore.h"
#include "blobstore/implementations/onblocks/datanodestore/DataLeafNode.h"
#include "../datanodestore/DataNodeStore.h"
#include "../datanodestore/DataLeafNode.h"
#include "DataTree.h"

using std::unique_ptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREESTORE_DATATREESTORE_H_

#include <memory>
#include "fspp/utils/macros.h"
#include "messmer/cpp-utils/macros.h"

namespace blockstore{
class Key;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "GetLowestRightBorderNodeWithLessThanKChildrenOrNull.h"

#include "blobstore/implementations/onblocks/datanodestore/DataInnerNode.h"
#include "blobstore/implementations/onblocks/datanodestore/DataLeafNode.h"
#include "blobstore/implementations/onblocks/datanodestore/DataNodeStore.h"
#include "../../datanodestore/DataInnerNode.h"
#include "../../datanodestore/DataLeafNode.h"
#include "../../datanodestore/DataNodeStore.h"

#include "fspp/utils/pointer.h"
#include "messmer/cpp-utils/pointer.h"

using std::unique_ptr;
using fspp::dynamic_pointer_move;
using fspp::ptr::optional_ownership_ptr;
using cpputils::dynamic_pointer_move;
using cpputils::optional_ownership_ptr;
using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datanodestore::DataInnerNode;
using blobstore::onblocks::datanodestore::DataLeafNode;
Expand All @@ -27,8 +27,8 @@ unique_ptr<DataInnerNode> getLastChildAsInnerNode(DataNodeStore *nodeStore, cons
}

optional_ownership_ptr<DataInnerNode> GetLowestRightBorderNodeWithLessThanKChildrenOrNull::run(DataNodeStore *nodeStore, DataNode *rootNode) {
optional_ownership_ptr<DataInnerNode> currentNode = fspp::ptr::WithoutOwnership(dynamic_cast<DataInnerNode*>(rootNode));
optional_ownership_ptr<DataInnerNode> result = fspp::ptr::null<DataInnerNode>();
optional_ownership_ptr<DataInnerNode> currentNode = cpputils::WithoutOwnership(dynamic_cast<DataInnerNode*>(rootNode));
optional_ownership_ptr<DataInnerNode> result = cpputils::null<DataInnerNode>();
for (unsigned int i=0; i < rootNode->depth(); ++i) {
auto lastChild = getLastChildAsInnerNode(nodeStore, *currentNode);
if (currentNode->numChildren() < DataInnerNode::MAX_STORED_CHILDREN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef TEST_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREESTORE_IMPL_GETLOWESTRIGHTBORDERNODEWITHLESSTHANKCHILDRENORNULL_H_
#define TEST_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREESTORE_IMPL_GETLOWESTRIGHTBORDERNODEWITHLESSTHANKCHILDRENORNULL_H_

#include "fspp/utils/OptionalOwnershipPointer.h"
#include "messmer/cpp-utils/optional_ownership_ptr.h"

namespace blobstore {
namespace onblocks {
Expand All @@ -18,7 +18,7 @@ class GetLowestRightBorderNodeWithLessThanKChildrenOrNull {
public:
//Returns the lowest right border node with less than k children (not considering leaves).
//Returns nullptr, if all right border nodes have k children (the tree is full)
static fspp::ptr::optional_ownership_ptr<datanodestore::DataInnerNode> run(datanodestore::DataNodeStore *nodeStore, datanodestore::DataNode *rootNode);
static cpputils::optional_ownership_ptr<datanodestore::DataInnerNode> run(datanodestore::DataNodeStore *nodeStore, datanodestore::DataNode *rootNode);
};

}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>
#include <memory>

#include "blockstore/utils/Key.h"
#include "messmer/blockstore/utils/Key.h"

namespace blobstore {

Expand Down
3 changes: 0 additions & 3 deletions src/blobstore/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/blobstore/implementations/CMakeLists.txt

This file was deleted.

6 changes: 0 additions & 6 deletions src/blobstore/implementations/onblocks/CMakeLists.txt

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3350e93

Please sign in to comment.