# Class branch

- Defined in File model.hpp

## Inheritance Relationships

### Base Type

- `public std::vector< sugar >`

## Class Documentation

class branch : public std::vector<sugar>

  A branch is a list of sugars.

  A list is how it is stored, but a branch is like a branch in a tree, with potentially lots of sub branches. Each sugar is linked to a sugar up in the branch with its (almost always) C1 atom.

  Public Functions

  branch(structure &structure, const std::string &asym_id, const std::string &entity_id)

    constructor

  branch(const branch&) = delete
  branch &operator=(const branch&) = delete
  void link_atoms()

    Update the link atoms in all sugars in this branch.

  std::string name() const

    Return the name of the branch.

  float weight() const

    Return the weight of the branch based on the formulae of the sugars.

  inline std::string get_asym_id() const

    Return the asym_id.

  inline std::string get_entity_id() const

    Return the entity_id.

  inline structure &get_structure()

    Return the structure.

  inline structure &get_structure() const

    Return the structure.

  sugar &get_sugar_by_num(int nr)

    Return a reference to the sugar with number num.

  inline const sugar &get_sugar_by_num(int nr) const

    Return a const reference to the sugar with number num.

  sugar &construct_sugar(const std::string &compound_id)

    Construct a new sugar with compound ID compound_id in this branch and return a reference to the newly created sugar. Use this to create a first sugar in a branch.

  sugar &construct_sugar(const std::string &compound_id, const std::string &atom_id, int linked_sugar_nr, const std::string &linked_atom_id)

    Construct a new sugar with compound ID compound_id in this branch and return a reference to the newly created sugar. The newly created sugar will be connected to an already created sugar in the branch using the information in atom_id, linked_sugar_nr and linked_atom_id.