Skip to content

Inconsistent use of strings and string_view in Categories #945

@wdconinc

Description

@wdconinc

There is a bit of an inconsistency on how one works with Categories on Frames:

  • getAvailableCategories returns std::vector<std::string_view>:
    virtual std::vector<std::string_view> getAvailableCategories() const = 0;
  • but then readFrame and getEntries on the category requires a string anyway:
    virtual podio::Frame readFrame(const std::string& name, size_t index,
    const std::vector<std::string>& collsToRead) = 0;
    virtual size_t getEntries(const std::string& name) const = 0;

We're not clear on what the motivation for this choice is, but it forces us to do an explicit conversion where we feel we could just as well continue using string_view:

    for (const auto& _category : podio_source->getAvailableCategories()) {
      std::string category = _category;
      std::size_t n = podio_source->getEntries(category);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions