Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #854 MetaDataStorage class is made copyable/movable #855

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' into feature/854_metadatastorage_is_not_movable
  • Loading branch information
Dmitry Malysh authored Jul 31, 2023
commit 4df3a6b6c34e1bcbe1277a3f995f7476159c393b
3 changes: 3 additions & 0 deletions core/indigo-core/molecule/metadata_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef __metadata_storage__
#define __metadata_storage__

#include <cstdint>
#include <memory>
#include <vector>

Expand All @@ -40,6 +41,8 @@ namespace indigo
{
public:
DECL_ERROR;
void clone(const MetaDataStorage& other);
void append(const MetaDataStorage& other);

using MetadataVector = std::vector<std::shared_ptr<MetaObject>>;

Expand Down
15 changes: 14 additions & 1 deletion core/indigo-core/molecule/src/metadata_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ int MetaDataStorage::addMetaObject(MetaObject* pobj)
return index;
}

const MetaObject& MetaDataStorage::getMetaObject(uint32_t meta_type, int index) const
void MetaDataStorage::append(const MetaDataStorage& other)
{
const auto& meta = other.metaData();
for (int i = 0; i < meta.size(); i++)
addMetaObject(meta[i]->clone());
}

void MetaDataStorage::clone(const MetaDataStorage& other)
{
resetMetaData();
append(other);
}

int MetaDataStorage::getMetaObjectIndex(uint32_t meta_type, int index) const
{
switch (meta_type)
{
Expand Down
1 change: 0 additions & 1 deletion core/indigo-core/reaction/src/reaction_json_saver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void ReactionJsonSaver::saveReactionWithMetaData(BaseReaction& rxn, BaseMolecule
merged.mergeWithMolecule(rxn.getBaseMolecule(i), 0, 0);

merged.meta() = rxn.meta();

StringBuffer s;
JsonWriter writer(pretty_json);
writer.Reset(s);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.