Skip to content

Commit

Permalink
Add functions to search
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Verbytskyi committed Apr 4, 2024
1 parent dd82a27 commit be23704
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 0 additions & 8 deletions protobufIO/src/Readerprotobuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ bool Readerprotobuf::read_digest() {
return false;
}

int nbytes = m_in_zcstream->ByteCount();

if (!m_md_pb.ParseFromBoundedZeroCopyStream(m_in_zcstream, MDBytesLength)) {
return false;
}
Expand All @@ -149,8 +147,6 @@ bool Readerprotobuf::read_Header() {
return false;
}

int nbytes = m_in_zcstream->ByteCount();

if (!m_hdr_pb.ParseFromBoundedZeroCopyStream(m_in_zcstream,
m_md_pb.bytes())) {
// if we fail to read a message then close the stream to indicate failed
Expand All @@ -173,8 +169,6 @@ bool Readerprotobuf::read_GenRunInfo() {

set_run_info(std::make_shared<HepMC3::GenRunInfo>());

int nbytes = m_in_zcstream->ByteCount();

if (!m_gri_pb.ParseFromBoundedZeroCopyStream(m_in_zcstream,
m_md_pb.bytes())) {
close();
Expand All @@ -195,8 +189,6 @@ bool Readerprotobuf::read_GenEvent(bool skip, GenEvent &evt) {
return false;
}

int nbytes = m_in_zcstream->ByteCount();

if (!m_evt_pb.ParseFromBoundedZeroCopyStream(m_in_zcstream,
m_md_pb.bytes())) {
close();
Expand Down
4 changes: 2 additions & 2 deletions protobufIO/src/protobufUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void GenEvent::read_data(HepMC3_pb::GenEventData const &data) {
}

// Restore links
for (unsigned int i = 0; i < data.links1_size(); ++i) {
for (unsigned int i = 0; i < (unsigned int)data.links1_size(); ++i) {
const int id1 = data.links1(i);
const int id2 = data.links2(i);
/* @note:
Expand Down Expand Up @@ -410,7 +410,7 @@ void GenEvent::read_data(HepMC3_pb::GenEventData const &data) {

// Read attributes
std::lock_guard<std::recursive_mutex> lock(m_lock_attributes);
for (unsigned int i = 0; i < data.attribute_id_size(); ++i) {
for (unsigned int i = 0; i < (unsigned int)data.attribute_id_size(); ++i) {
/// Disallow empty strings
const std::string name = data.attribute_name(i);
if (name.length() == 0)
Expand Down
21 changes: 21 additions & 0 deletions search/include/HepMC3/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ class Feature : public GenericFeature<Feature_type> {
Feature(Evaluator_type functor) : GenericFeature<Feature_type>(functor) {}
/// @brief Copy
Feature(const Feature &copy) : GenericFeature<Feature_type>(copy) {}
/** @brief Move constructor */
Feature(Feature && ) = default;
/** @brief = */
Feature& operator=(const Feature&) = default;
/** @brief = */
Feature& operator=(Feature&&) = default;

/// @brief Abs function
Feature<Feature_type> abs() const {
Expand Down Expand Up @@ -229,6 +235,13 @@ class Feature<Feature_type, typename std::enable_if<std::is_integral<Feature_typ
Feature(Evaluator_type functor) : GenericFeature<Feature_type>(functor) {}
/// @brief Feature
Feature(const Feature &copy) : GenericFeature<Feature_type>(copy) {}
/** @brief Move constructor */
Feature(Feature && ) = default;
/** @brief = */
Feature& operator=(const Feature&) = default;
/** @brief = */
Feature& operator=(Feature&&) = default;


/// @brief abs function
Feature<Feature_type> abs() const {
Expand Down Expand Up @@ -298,6 +311,14 @@ class Feature<Feature_type, typename std::enable_if<std::is_floating_point<Featu
/// @brief Copy
Feature(const Feature &copy) : GenericFeature<Feature_type>(copy) {}

/** @brief Move constructor */
Feature(Feature && ) = default;
/** @brief = */
Feature& operator=(const Feature&) = default;
/** @brief = */
Feature& operator=(Feature&&) = default;


/// @brief abs function
Feature<Feature_type> abs() const {
EvaluatorPtr functor = m_internal;
Expand Down

0 comments on commit be23704

Please sign in to comment.