Skip to content

Commit

Permalink
Update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Apr 18, 2023
1 parent 775a6ca commit 9019099
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions include/podio/DatamodelRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace podio {
/**
* Type alias for storing the names of all Relations and VectorMembers for all
* datatypes of an EDM. Populated for each EDM at code generation time.
* The structure is of each element in the outer vector is:
* The structure for each element in the vector is:
* - get<0>: The name of the datatype
* - get<1>: The names of all Relations, where OneToManyRelations comes before
* OneToOneRelations (in the order as they appear in the YAML file)
Expand Down Expand Up @@ -113,23 +113,34 @@ class DatamodelRegistry {
* @param name The name of the EDM that should be registered
* @param definition The datamodel definition from which this EDM has been
* generated in JSON format
* @param relationNames the names of the relations and vector members for all
* @param relationNames The names of the relations and vector members for all
* datatypes that are defined for this EDM
*
* @return The datamodel definition index for this datamodel that can be used
* for quicker lookup
*/
size_t registerDatamodel(std::string name, std::string_view definition,
const podio::RelationNameMapping& relationNames);

/**
* Get the names of the relations and vector members of a datatype
* Get the names of the relations and vector members for a given datatype.
*
* @param typeName The name of the desired type. Can be obtained e.g. via
* collection->getValueTypeName()
*
* @return Relation and vector member names for this type. The order of the
* relations is OneToMany before OneToOne relations in the order they appear
* in the YAML file. The order of the VectorMembers is as they appear in the
* YAML file
*/
RelationNames getRelationNames(std::string_view typeName) const;

private:
DatamodelRegistry() = default;
/// The stored definitions
std::vector<std::pair<std::string, std::string_view>> m_definitions{};

/// The names of the relations and vector members for all datatypes that are
/// currently loaded
std::unordered_map<std::string_view, RelationNames> m_relations{};
};
} // namespace podio
Expand Down
2 changes: 2 additions & 0 deletions src/rootUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ inline std::string refBranch(const std::string& name, size_t index) {
return name + "#" + std::to_string(index);
}

/// The branch name for a relation member of a collection
inline std::string refBranch(const std::string& name, std::string_view relName) {
return name + "_" + std::string(relName);
}
Expand All @@ -84,6 +85,7 @@ inline std::string vecBranch(const std::string& name, size_t index) {
return name + "_" + std::to_string(index);
}

/// The branch name for a vector member of a collection
inline std::string vecBranch(const std::string& name, std::string_view vecName) {
return name + "_" + std::string(vecName);
}
Expand Down

0 comments on commit 9019099

Please sign in to comment.