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 #779: remove NonCopyable and shallow copy operations in Array<> #821

Draft
wants to merge 42 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b0a254f
int[2] arrays removal
even1024 Aug 5, 2022
7a385c9
bool & char array separated
even1024 Aug 5, 2022
8fc764e
bool & char array separated
even1024 Aug 5, 2022
dfbdbd6
int array separated
even1024 Aug 5, 2022
7708663
memcmp
even1024 Aug 5, 2022
e633d84
pop eliminate
even1024 Aug 6, 2022
c6a5c75
working on push
even1024 Aug 7, 2022
fb98799
working on push
even1024 Aug 7, 2022
0e00453
working on push
even1024 Aug 7, 2022
3e6cbf2
working on push
even1024 Aug 7, 2022
6c8a63c
perfect forwarding
even1024 Aug 8, 2022
213367d
clang fix
even1024 Aug 8, 2022
11300fe
clang fix
even1024 Aug 8, 2022
14d2bef
destructor fix
even1024 Aug 8, 2022
d25066b
destructor fix
even1024 Aug 9, 2022
668b129
clang fix
even1024 Aug 9, 2022
85d900e
clang fix
even1024 Aug 9, 2022
285e088
working to eliminate push
even1024 Aug 9, 2022
a4d71d8
clang fix
even1024 Aug 9, 2022
c6f1e47
working to eliminate push.
even1024 Aug 9, 2022
250521f
working to eliminate push.
even1024 Aug 10, 2022
5112239
clang fix
even1024 Aug 10, 2022
45e3636
correct method names for containers
even1024 Aug 10, 2022
d223ac9
push elimination
even1024 Aug 10, 2022
84674e9
clang fix
even1024 Aug 10, 2022
64ebaf9
bingo fix
even1024 Aug 11, 2022
b1fccae
bingo fix
even1024 Aug 11, 2022
d33132d
constructors fix
even1024 Aug 12, 2022
b0995b5
clang fix
even1024 Aug 12, 2022
14ef685
clang fix
even1024 Aug 12, 2022
7b24408
copy and concat
even1024 Aug 17, 2022
c9fb4dc
push back
even1024 Aug 17, 2022
c0f5fe0
push back
even1024 Aug 17, 2022
ba50cc6
push back
even1024 Aug 17, 2022
be6ae99
push back
even1024 Aug 17, 2022
c8cc428
push back
even1024 Aug 17, 2022
2437e12
only resize
even1024 Aug 18, 2022
4127c18
double
even1024 Aug 18, 2022
53ee0d8
array.h
even1024 Aug 22, 2022
5571727
basic types
even1024 Aug 22, 2022
8a37651
basic types 1
even1024 Aug 22, 2022
dede3bd
basic types 1
even1024 Aug 22, 2022
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
2 changes: 1 addition & 1 deletion api/c/bingo-nosql/src/bingo_container_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ int ContainerSet::_findSimilarInc(const byte* query, SimCoef& sim_coef, double m
if (coef < min_coef)
continue;

sim_indices.push(SimResult(indices[i], (float)coef));
sim_indices.push_back(SimResult(indices[i], (float)coef));
}

return sim_indices.size();
Expand Down
16 changes: 5 additions & 11 deletions api/c/bingo-nosql/src/bingo_matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,7 @@ void TopNSimMatcher::_findTopN()
while (BaseSimilarityMatcher::next())
{
cnt++;
res = &_current_results.push();
res->id = _current_id;
res->sim_value = _current_sim_value;
res = &_current_results.emplace_back(_current_id, _current_sim_value);
cur_cell = currentCell();
if ((cnt > hits_limit * 2) && ((max_cell - cur_cell) > cells_count / 2))
{
Expand Down Expand Up @@ -1109,9 +1107,7 @@ void TopNSimMatcher::_findTopN()
while (BaseSimilarityMatcher::next())
{
cnt++;
res = &_current_results.push();
res->id = _current_id;
res->sim_value = _current_sim_value;
res = &_current_results.emplace_back(_current_id, _current_sim_value);

if (cnt > hits_limit * 2)
{
Expand Down Expand Up @@ -1186,9 +1182,7 @@ void TopNSimMatcher::_findTopN()
while (BaseSimilarityMatcher::next())
{
cnt++;
res = &_current_results.push();
res->id = _current_id;
res->sim_value = _current_sim_value;
res = &_current_results.emplace_back(_current_id, _current_sim_value);
cur_cell = currentCell();
if ((cnt > hits_limit * 2) && (max_cell - cur_cell) > cells_count / 2)
{
Expand Down Expand Up @@ -1246,7 +1240,7 @@ void TopNSimMatcher::_findTopN()
for (i = 0; i < _current_results.size(); i++)
{
_result_ids.push(_current_results[i].id);
_result_sims.push(_current_results[i].sim_value);
_result_sims.push_back(_current_results[i].sim_value);

if (i == (hits_limit - 1))
break;
Expand All @@ -1268,7 +1262,7 @@ void TopNSimMatcher::_initModelDistribution(Array<float>& model_thrs, Array<int>
{
for (int i = 0; i < 9; i++)
{
model_thrs.push(_2FLOAT(1.0 - 0.1 * (i + 1)));
model_thrs.push_back(_2FLOAT(1.0 - 0.1 * (i + 1)));
model_nhits_per_block.push(5 * 2 ^ (i));
}
}
Expand Down
8 changes: 4 additions & 4 deletions api/c/bingo-nosql/src/bingo_multibit_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void MultibitTree::_build()

QS_DEF(Array<bool>, is_mb);
is_mb.clear_resize(_fp_size * 8);
is_mb.zerofill();
is_mb.fill(false);

_tree_ptr = _buildNode(indices, is_mb, 0);
}
Expand All @@ -160,7 +160,7 @@ void MultibitTree::_findLinear(_MultibitNode* node, const byte* query, int query
if (coef < min_coef)
continue;

sim_indices.push(SimResult(indices[fp_indices[i]], (float)coef));
sim_indices.push_back(SimResult(indices[fp_indices[i]], (float)coef));
}
}

Expand Down Expand Up @@ -207,9 +207,9 @@ void MultibitTree::_findSimilarInNode(MMFPtr<_MultibitNode> node_ptr, const byte
_findSimilarInNode(node->right, query, query_bit_number, sim_coef, min_coef, right_indices, right_m01, right_m10);

for (int i = 0; i < left_indices.size(); i++)
sim_indices.push(left_indices[i]);
sim_indices.push_back(left_indices[i]);
for (int i = 0; i < right_indices.size(); i++)
sim_indices.push(right_indices[i]);
sim_indices.push_back(right_indices[i]);
}

MultibitTree::MultibitTree(int fp_size) : _fp_size(fp_size)
Expand Down
4 changes: 4 additions & 0 deletions api/c/bingo-nosql/src/bingo_sim_coef.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ namespace bingo
int id;
float sim_value;

SimResult() : id(0), sim_value(0)
{
}

SimResult(int new_id, float new_sim_value) : id(new_id), sim_value(new_sim_value)
{
}
Expand Down
2 changes: 1 addition & 1 deletion api/c/bingo-nosql/src/bingo_sim_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int SimStorage::getIncSimilar(const byte* query, SimCoef& sim_coef, double min_c
continue;
size_t id = _inc_id_buffer[i];

sim_fp_indices.push(SimResult(id, _2FLOAT(coef)));
sim_fp_indices.push_back(SimResult(id, _2FLOAT(coef)));
}

return sim_fp_indices.size();
Expand Down
2 changes: 1 addition & 1 deletion api/c/bingo-nosql/src/mmf/mmf_mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void MMFMapping::getAll(size_t id1, Array<size_t>& id2_array)
for (i = 0; i < it->count; i++)
{
if (it->buf[i].first == id1)
id2_array.push(it->buf[i].second);
id2_array.push_back(it->buf[i].second);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/c/indigo-inchi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(${PROJECT_NAME}-object

if (NOT EMSCRIPTEN)
add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:${PROJECT_NAME}-object>)
target_link_libraries(${PROJECT_NAME} PRIVATE indigo indigo-core)
target_link_libraries(${PROJECT_NAME} PRIVATE indigo)
target_include_directories(${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/)

Expand Down
16 changes: 8 additions & 8 deletions api/c/indigo/src/indigo_abbreviations_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,19 +687,19 @@ namespace indigo

if (on_right && !on_left)
{
options.push(Options(RIGHT, RIGHT));
options.push(Options(LEFT, LEFT));
options.push_back(Options(RIGHT, RIGHT));
options.push_back(Options(LEFT, LEFT));
}
else
{
if (on_right)
options.push(Options(RIGHT, RIGHT));
options.push_back(Options(RIGHT, RIGHT));
if (on_left)
{
options.push(Options(LEFT, LEFT));
options.push(Options(LEFT, RIGHT));
options.push(Options(RIGHT, RIGHT));
options.push(Options(LEFT, LEFT, 2));
options.push_back(Options(LEFT, LEFT));
options.push_back(Options(LEFT, RIGHT));
options.push_back(Options(RIGHT, RIGHT));
options.push_back(Options(LEFT, LEFT, 2));
}
}

Expand All @@ -709,7 +709,7 @@ namespace indigo
{
Options opt = options[i];
opt.ignore_case = true;
options.push(opt);
options.push_back(opt);
}

bool found = false;
Expand Down
5 changes: 5 additions & 0 deletions api/c/indigo/src/indigo_deconvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,11 @@ IndigoDecompositionMatch::IndigoDecompositionMatch() : IndigoObject(DECOMPOSITIO
{
}

IndigoDecompositionMatch::IndigoDecompositionMatch(const IndigoDecompositionMatch& other) : IndigoObject(DECOMPOSITION_MATCH), deco(0), _completeScaffold(false)
{
copy(const_cast<IndigoDecompositionMatch&>(other));
}

bool IndigoDeconvolution::_matchAtoms(Graph& g1, Graph& g2, const int*, int sub_idx, int super_idx, void* userdata)
{
if (userdata == 0)
Expand Down
6 changes: 2 additions & 4 deletions api/c/indigo/src/indigo_deconvolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class DLLEXPORT IndigoDecompositionMatch : public IndigoObject
{
public:
IndigoDecompositionMatch();
IndigoDecompositionMatch(const IndigoDecompositionMatch& other);

Array<int> visitedAtoms;
Array<int> scaffoldBonds;
Array<int> scaffoldAtoms;
Expand All @@ -196,10 +198,6 @@ class DLLEXPORT IndigoDecompositionMatch : public IndigoObject
Molecule mol_scaffold;

IndigoDeconvolution* deco;

private:
IndigoDecompositionMatch(const IndigoDecompositionMatch&); // no implicit copy

bool _completeScaffold;
};

Expand Down
10 changes: 5 additions & 5 deletions api/c/indigo/src/indigo_molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,8 +2051,8 @@ CEXPORT float indigoAlignAtoms(int molecule, int natoms, int* atom_ids, float* d

for (i = 0; i < natoms; i++)
{
points.push(mol.getAtomXyz(atom_ids[i]));
goals.push(Vec3f(desired_xyz[i * 3], desired_xyz[i * 3 + 1], desired_xyz[i * 3 + 2]));
points.push_back(mol.getAtomXyz(atom_ids[i]));
goals.push_back(Vec3f(desired_xyz[i * 3], desired_xyz[i * 3 + 1], desired_xyz[i * 3 + 2]));
}

if (points.size() < 1)
Expand Down Expand Up @@ -3307,13 +3307,13 @@ CEXPORT int indigoSetSGroupBrackets(int sgroup, int brk_style, float x1, float y

psg->brk_style = brk_style;
psg->brackets.clear();
Vec2f* brackets = psg->brackets.push();
std::array<Vec2f, 2> brackets;
brackets[0].set(x1, y1);
brackets[1].set(x2, y2);
brackets = psg->brackets.push();
psg->brackets.push_back(brackets);
brackets[0].set(x3, y3);
brackets[1].set(x4, y4);

psg->brackets.push_back(brackets);
return 1;
}
INDIGO_END(-1);
Expand Down
2 changes: 1 addition & 1 deletion api/c/indigo/src/indigo_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "reaction/reaction.h"

using IndigoObjectTypesMap = std::map<int, const char* const>;
class IndigoObjectTypes : public IndigoObjectTypesMap, public NonCopyable
class IndigoObjectTypes : public IndigoObjectTypesMap
{
public:
IndigoObjectTypes();
Expand Down
2 changes: 1 addition & 1 deletion bingo/oracle/src/oracle/bingo_fingerprints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void BingoFingerprints::addFingerprint(OracleEnv& env, const byte* fp)
}
ptr += 8 * _chunk_qwords;
}
_pending_block.mapping.push(_pending_block.mapping.size());
_pending_block.mapping.push_back(_pending_block.mapping.size());
_pending_block.used++;
}

Expand Down
6 changes: 3 additions & 3 deletions bingo/oracle/src/oracle/bingo_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void BingoStorage::validateForInsert(OracleEnv& env)
continue;
}

_Block& block = _blocks.push();
_Block& block = _blocks.emplace_back();

block.size = length;
} while (statement.fetch());
Expand Down Expand Up @@ -244,7 +244,7 @@ void BingoStorage::validate(OracleEnv& env)
_index.copy((_Addr*)_shmem_array[0]->ptr(), length / sizeof(_Addr));
}

_Block& block = _blocks.push();
_Block& block = _blocks.emplace_back();

block.size = length;
} while (statement.fetch());
Expand Down Expand Up @@ -305,7 +305,7 @@ void BingoStorage::_insertLOB(OracleEnv& env, int no)

if (no > 0)
{
_Block& block = _blocks.push();
_Block& block = _blocks.emplace_back();

block.size = 0;
}
Expand Down
14 changes: 7 additions & 7 deletions bingo/oracle/src/oracle/mango_shadow_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ void MangoShadowTable::addMolecule(OracleEnv& env, const char* rowid, int blockn
_main_table_statement->append(")");
}

_pending_rid.push();
_pending_rid.emplace_back();
strncpy(_pending_rid.top(), rowid, 19);
_pending_blockno.push(blockno);
_pending_offset.push(offset);
_pending_gross.push();
_pending_gross.emplace_back();
strncpy(_pending_gross.top(), gross, 512);
_pending_mass.push(molecular_mass);
_pending_mass.push_back(molecular_mass);

_pending_cmf.push(env);
_pending_cmf.top().assignBytes(data_cmf, len_cmf);
Expand Down Expand Up @@ -130,9 +130,9 @@ void MangoShadowTable::addMolecule(OracleEnv& env, const char* rowid, int blockn

for (int i = 0; i < hash.size(); i++)
{
_pending_comp_hash.push();
_pending_comp_hash.emplace_back();
snprintf(_pending_comp_hash.top(), 9, "%08X", hash[i].hash);
_pending_comp_rid.push();
_pending_comp_rid.emplace_back();
strncpy(_pending_comp_rid.top(), rowid, 19);
_pending_comp_count.push(hash[i].count);
_components_table_statement_count++;
Expand Down Expand Up @@ -205,10 +205,10 @@ void MangoShadowTable::_flushMain(OracleEnv& env)
if (_pending_xyz[i].get() != 0)
{
memcpy(xyz.ptr() + i * (maxallocsize_xyz + 4), _pending_xyz[i].get(), _pending_xyz[i].getAllocSize() + 4);
xyz_ind.push(0); // OCI_IND_NOTNULL
xyz_ind.push_back(0); // OCI_IND_NOTNULL
}
else
xyz_ind.push(-1); // OCI_IND_NULL
xyz_ind.push_back(-1); // OCI_IND_NULL
}

_main_table_statement->bindRawPtrByName(":cmf", (OCIRaw*)cmf.ptr(), maxallocsize_cmf, 0);
Expand Down
4 changes: 2 additions & 2 deletions bingo/postgres/src/pg_am/pg_bingo_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class BingoImportHandler : public BingoPgCommon::BingoSessionHandler
for (int col_idx = 0; col_idx < _importColumns.size(); ++col_idx)
{
q_nulls.push(0);
q_oids.push(_importColumns[col_idx].type);
q_oids.push_back(_importColumns[col_idx].type);

if (col_idx != 0)
query_string.printf(", ");
Expand Down Expand Up @@ -397,7 +397,7 @@ class BingoImportHandler : public BingoPgCommon::BingoSessionHandler
q_values.clear();
for (int q_idx = 0; q_idx < _importData.size(); ++q_idx)
{
q_values.push(_importData[q_idx]->getDatum());
q_values.push_back(_importData[q_idx]->getDatum());
if (q_values[q_idx] == 0)
{
q_nulls[q_idx] = 'n';
Expand Down
Loading