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:
34  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 
45  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 
74  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__
vrv::MeterSigGrp::IsScoreDefElement
bool IsScoreDefElement() const override
Override the method since check is required.
Definition: metersiggrp.h:50
vrv::Object::GetParent
Object * GetParent()
Get the parent of the Object.
Definition: object.h:379
vrv::Measure
This class represents a measure in a page-based score (Doc).
Definition: measure.h:37
vrv::MeterSigGrp::FilterList
void FilterList(ListOfConstObjects &childList) const override
Filter the flat list and keep only meterSigGrp elements.
vrv::MeterSig
This class models the MEI <meterSig> element.
Definition: metersig.h:27
vrv::Object
This class represents a basic object.
Definition: object.h:59
vrv::MeterSigGrp
This class represents a MEI meterSigGrp.
Definition: metersiggrp.h:28
vrv::Object::GetFirstAncestor
Object * GetFirstAncestor(const ClassId classId, int maxSteps=-1)
Return the first ancestor of the specified type.
vrv::MeterSigGrp::IsSupportedChild
bool IsSupportedChild(ClassId classId) override
Base method for checking if a child can be added.
vrv::Functor
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
vrv::ObjectListInterface
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:873
vrv::ConstFunctor
This abstract class is the base class for all const functors.
Definition: functor.h:126
vrv::MeterSigGrp::Accept
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
vrv::MeterSigGrp::GetSimplifiedMeterSig
MeterSig * GetSimplifiedMeterSig() const
Get simplified (i.e.
vrv::MeterSigGrp::AddAlternatingMeasureToVector
void AddAlternatingMeasureToVector(const Measure *measure)
Add specified measureId to the m_alternatingMeasures vector.
vrv::MeterSigGrp::SetMeasureBasedCount
void SetMeasureBasedCount(const Measure *measure)
Set counter for the alternating meterSigGrp based on the provided measureId.
vrv::MeterSigGrp::Clone
Object * Clone() const override
Method call for copying child classes.
Definition: metersiggrp.h:37
vrv::LayerElement
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:46
vrv::MeterSigGrp::Reset
void Reset() override
Virtual reset method.