FlashGraph-ng
A new frontier in large-scale graph analysis and data mining
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
EM_vv_store.h
1 #ifndef __EM_VV_STORE_H__
2 #define __EM_VV_STORE_H__
3 
4 /*
5  * Copyright 2015 Open Connectome Project (http://openconnecto.me)
6  * Written by Da Zheng (zhengda1936@gmail.com)
7  *
8  * This file is part of FlashMatrix.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "vv_store.h"
24 #include "EM_object.h"
25 #include "EM_vector.h"
26 
27 namespace fm
28 {
29 
30 namespace detail
31 {
32 
33 class EM_vv_store: public vv_store, public EM_object
34 {
35  EM_vv_store(const scalar_type &type): vv_store(type, false) {
36  }
37  EM_vv_store(const std::vector<off_t> &offs,
38  EM_vec_store::ptr store): vv_store(offs, store) {
39  }
40 public:
41  typedef std::shared_ptr<EM_vv_store> ptr;
42  typedef std::shared_ptr<const EM_vv_store> const_ptr;
43 
44  static ptr create(const scalar_type &type) {
45  return ptr(new EM_vv_store(type));
46  }
47  static ptr create(const std::vector<off_t> &offs, EM_vec_store::ptr store) {
48  return ptr(new EM_vv_store(offs, store));
49  }
50 
51  virtual std::vector<safs::io_interface::ptr> create_ios() const {
52  printf("create I/O from %p in vv store\n", &get_data());
53  return dynamic_cast<const EM_object &>(get_data()).create_ios();
54  }
55 
56  virtual vec_store::ptr shallow_copy() {
57  return ptr(new EM_vv_store(*this));
58  }
59  virtual vec_store::const_ptr shallow_copy() const {
60  return const_ptr(new EM_vv_store(*this));
61  }
62 };
63 
64 }
65 
66 }
67 
68 #endif