LibMusicXML  3.18
types.h
1 /*
2  MusicXML Library
3  Copyright (C) Grame 2006-2013
4 
5  This Source Code Form is subject to the terms of the Mozilla Public
6  License, v. 2.0. If a copy of the MPL was not distributed with this
7  file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10  research@grame.fr
11 */
12 
13 #ifndef __types__
14 #define __types__
15 
16 #include "exports.h"
17 #include "xml.h"
18 #include "visitor.h"
19 
20 namespace MusicXML2
21 {
22 
28 template <int elt> class musicxml : public xmlelement
29 {
30  protected:
31  musicxml (int inputLineNumber) : xmlelement (inputLineNumber) { fType = elt; }
32 
33  public:
34  /*
35  static SMARTP<musicxml<elt> > new_musicxml()
36  { musicxml<elt>* o = new musicxml<elt>; assert(o!=0); return o; }
37  *
38  static SMARTP<musicxml<elt> > new_musicxml(const std::vector<Sxmlelement>& elts)
39  { musicxml<elt>* o = new musicxml<elt>(elts); assert(o!=0); return o; }
40  */
41 
42  static SMARTP<musicxml<elt> > new_musicxml (int inputLineNumber)
43  { musicxml<elt>* o = new musicxml<elt>(inputLineNumber); assert(o!=0); return o; }
44  static SMARTP<musicxml<elt> > new_musicxml ( const std::vector<Sxmlelement>& elts, int inputLineNumber)
45  { musicxml<elt>* o = new musicxml<elt>(elts, inputLineNumber); assert(o!=0); return o; }
46 
47  virtual void acceptIn (basevisitor& v) {
48  if (visitor<SMARTP<musicxml<elt> > >* p = dynamic_cast<visitor<SMARTP<musicxml<elt> > >*>(&v)) {
49  SMARTP<musicxml<elt> > sptr = this;
50  p->visitStart (sptr);
51  }
52  else xmlelement::acceptIn (v);
53  }
54 
55  virtual void acceptOut (basevisitor& v) {
56  if ( visitor<SMARTP<musicxml<elt> > >* p = dynamic_cast<visitor<SMARTP<musicxml<elt> > >*>(&v)) {
57  SMARTP<musicxml<elt> > sptr = this;
58  p->visitEnd (sptr);
59  }
60  else xmlelement::acceptOut (v);
61  }
62 };
63 
64 
67 }
68 
69 #endif
the smart pointer implementation
Definition: smartpointer.h:58
Definition: basevisitor.h:25
Definition: types.h:29
Definition: visitor.h:27
A generic xml element representation.
Definition: xml.h:86