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, public ObjectListInterface, public AttBasic, public AttMeterSigGrpLog {
29 public:
35  MeterSigGrp();
36  virtual ~MeterSigGrp();
37  Object *Clone() const override { return new MeterSigGrp(*this); }
38  void Reset() override;
39  std::string GetClassName() const override { return "meterSigGrp"; }
41 
46  bool IsSupportedChild(ClassId classId) override;
48 
50  bool IsScoreDefElement() const override { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); }
51 
55  void AddAlternatingMeasureToVector(const Measure *measure);
56 
61 
65  void SetMeasureBasedCount(const Measure *measure);
66 
67  //----------//
68  // Functors //
69  //----------//
70 
75  FunctorCode Accept(Functor &functor) override;
76  FunctorCode Accept(ConstFunctor &functor) const override;
77  FunctorCode AcceptEnd(Functor &functor) override;
78  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
80 
81 protected:
85  void FilterList(ListOfConstObjects &childList) const override;
86 
87 private:
88  // vector with alternating measures to be used only with meterSigGrpLog_FUNC_alternating
89  std::vector<const Measure *> m_alternatingMeasures;
90  // counter for the meterSig to be used with meterSigGrpLog_FUNC_alternating
91  int m_count = 0;
92 }; // MeterSigGrp
93 
94 } // namespace vrv
95 
96 #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:28
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:50
Object * Clone() const override
Method call for copying child classes.
Definition: metersiggrp.h:37
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:61
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:383
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:893