mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
a79aa29030
Summary: In a future patch we will want to pass the uniondatapackstore around to other objects who will contribute to the lifetime. Let's change it to a shared_ptr so that becomes easy. Let's also make the destructor virtual, so we can pass different types of stores around and have them be destructed correctly. Test Plan: Ran the tests Reviewers: #mercurial, simonfar Reviewed By: simonfar Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4603893 Signature: t1:4603893:1487847173:2fc3505032ea8c30cf9e0f76ac4e75d64513d87d
34 lines
711 B
C++
34 lines
711 B
C++
// py-structs.h - c++ headers for store python objects
|
|
//
|
|
// Copyright 2017 Facebook, Inc.
|
|
//
|
|
// This software may be used and distributed according to the terms of the
|
|
// GNU General Public License version 2 or any later version.
|
|
//
|
|
// no-check-code
|
|
|
|
#ifndef CSTORE_PY_STRUCTS
|
|
#define CSTORE_PY_STRUCTS
|
|
|
|
#include <memory>
|
|
|
|
#include "datapackstore.h"
|
|
#include "uniondatapackstore.h"
|
|
|
|
struct py_datapackstore {
|
|
PyObject_HEAD;
|
|
|
|
DatapackStore datapackstore;
|
|
};
|
|
|
|
struct py_uniondatapackstore {
|
|
PyObject_HEAD;
|
|
|
|
std::shared_ptr<UnionDatapackStore> uniondatapackstore;
|
|
|
|
// Keep a reference to the python objects so we can decref them later.
|
|
std::vector<PythonObj> substores;
|
|
};
|
|
|
|
#endif //CSTORE_PY_STRUCTS
|