Verovio
Source code documentation
metersiggrp.h
1 // Name: metersiggrp.h
3 // Author: Andriy Makarchuk
4 // Created: 2021
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_METERSIGGRP_H__
9 #define __VRV_METERSIGGRP_H__
10 
11 #include "atts_cmn.h"
12 #include "atts_mei.h"
13 #include "atts_shared.h"
14 #include "layerelement.h"
15 
16 namespace vrv {
17 
18 class Measure;
19 
20 //----------------------------------------------------------------------------
21 // MeterSigGrp
22 //----------------------------------------------------------------------------
23 
28 class MeterSigGrp : public LayerElement,
29  public ObjectListInterface,
30  public AttBasic,
31  public AttMeterSigGrpLog,
32  public AttVisibility {
33 public:
39  MeterSigGrp();
40  virtual ~MeterSigGrp();
41  Object *Clone() const override { return new MeterSigGrp(*this); }
42  void Reset() override;
43  std::string GetClassName() const override { return "meterSigGrp"; }
45 
50  bool IsSupportedChild(ClassId classId) override;
52 
54  bool IsScoreDefElement() const override { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); }
55 
59  void AddAlternatingMeasureToVector(const Measure *measure);
60 
65 
69  void SetMeasureBasedCount(const Measure *measure);
70 
71  //----------//
72  // Functors //
73  //----------//
74 
79  FunctorCode Accept(Functor &functor) override;
80  FunctorCode Accept(ConstFunctor &functor) const override;
81  FunctorCode AcceptEnd(Functor &functor) override;
82  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
84 
85 protected:
89  void FilterList(ListOfConstObjects &childList) const override;
90 
91 private:
92  // vector with alternating measures to be used only with meterSigGrpLog_FUNC_alternating
93  std::vector<const Measure *> m_alternatingMeasures;
94  // counter for the meterSig to be used with meterSigGrpLog_FUNC_alternating
95  int m_count = 0;
96 }; // MeterSigGrp
97 
98 } // namespace vrv
99 
100 #endif // __VRV_METERSIGGRP_H__
This abstract class is the base class for all const functors.
Definition: functor.h:126
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class represents a MEI meterSigGrp.
Definition: metersiggrp.h:32
void FilterList(ListOfConstObjects &childList) const override
Filter the flat list and keep only meterSigGrp elements.
bool IsScoreDefElement() const override
Override the method since check is required.
Definition: metersiggrp.h:54
Object * Clone() const override
Method call for copying child classes.
Definition: metersiggrp.h:41
void Reset() override
Virtual reset method.
MeterSig * GetSimplifiedMeterSig() const
Get simplified (i.e.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool IsSupportedChild(ClassId classId) override
Base method for checking if a child can be added.
void AddAlternatingMeasureToVector(const Measure *measure)
Add specified measureId to the m_alternatingMeasures vector.
void SetMeasureBasedCount(const Measure *measure)
Set counter for the alternating meterSigGrp based on the provided measureId.
This class models the MEI <meterSig> element.
Definition: metersig.h:34
This class represents a basic object.
Definition: object.h:62
Object * GetFirstAncestor(const ClassId classId, int maxSteps=-1)
Return the first ancestor of the specified type.
Object * GetParent()
Get the parent of the Object.
Definition: object.h:384
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:894