libNuML  1.1.1
Library for reading / writing NuML documents
NUMLList.h
Go to the documentation of this file.
1 /*
2 * ****************************************************************************
3 * This file is part of libNUML. Please visit http://code.google.com/p/numl/for more
4 * information about NUML, and the latest version of libNUML.
5 * Copyright (c) 2013 The University of Manchester.
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation. A copy of the license agreement is
10 * provided in the file named "LICENSE.txt" included with this software
11 * distribution and also available online as http://www.gnu.org/licenses/lgpl.html
12 *
13 * Contributors:
14 * Joseph O. Dada, The University of Manchester - initial API and implementation
15 * ****************************************************************************
16 **/
17 
24 #ifndef NUMLLIST_H_
25 #define NUMLLIST_H_
26 
27 #include <numl/common/extern.h>
28 #include <numl/common/numlfwd.h>
29 #include <numl/NUMLTypeCodes.h>
30 
31 
32 
33 
34 
35 #include <vector>
36 
37 #include <numl/NMBase.h>
38 
39 #ifdef __cplusplus
40 LIBNUML_CPP_NAMESPACE_BEGIN
41 
42 /*
43  *
44  */
46 public:
47 
65  NUMLList (unsigned int level, unsigned int version);
66 
88  NUMLList (NUMLNamespaces* numlns);
89 
90  NUMLList();
91  virtual ~NUMLList();
92 
96  NUMLList (const NUMLList& orig);
97 
98 
102  NUMLList& operator=(const NUMLList& rhs);
103 
104 
114  virtual bool accept (NUMLVisitor& v) const;
115 
116 
122  virtual NMBase* clone () const;
123 
124 
136  void append (const NMBase* item);
137 
138 
150  void appendAndOwn (NMBase* item);
151 
152 
162  virtual const NMBase* get (unsigned int n) const;
163 
164 
174  virtual NMBase* get (unsigned int n);
175 
176 
177 #if 0
178 
189  virtual const NMBase* get (const std::string& sid) const;
190 #endif
191 
192 
193 #if 0
194 
205  virtual NMBase* get (const std::string& sid);
206 #endif
207 
208 
221  void clear (bool doDelete = true);
222 
223 
234  virtual NMBase* remove (unsigned int n);
235 
236 
237 #if 0
238 
250  virtual NMBase* remove (const std::string& sid);
251 #endif
252 
253 
259  unsigned int size () const;
260 
261 
268  virtual void setNUMLDocument (NUMLDocument* d);
269 
270 
276  virtual void setParentNUMLObject (NMBase* sb);
277 
278 
279 
310 // virtual int getTypeCode () const;
311 
312 
341  // virtual int getItemTypeCode () const;
342 
343 
344 
345 
346 
347 
368  virtual NUMLTypeCode_t getTypeCode () const;
369 
370 
389  virtual NUMLTypeCode_t getItemTypeCode () const;
390 
391 
398  virtual const std::string& getElementName () const;
399 
400 
406  virtual void writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
407 
408 
409 protected:
410 
416  virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes);
417 
428  virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
429 
430  std::vector<NMBase*> mItems;
431 
432 
433 };
434 
435 LIBNUML_CPP_NAMESPACE_END
436 
437 #endif /* __cplusplus */
438 
439 #ifndef SWIG
440 
441 LIBNUML_CPP_NAMESPACE_BEGIN
443 
444 //TODO
445 
447 LIBNUML_CPP_NAMESPACE_END
448 
449 #endif /* !SWIG */
450 
451 #endif /* NUMLLIST_H_ */
numlfwd.h
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: extern.h:112
NMBase
This is the base class for all numl objects.
Definition: NMBase.h:70
extern.h
NUMLNamespaces
namespace class
Definition: NUMLNamespaces.h:46
NUMLDocument
This represents the numl document that contains all information.
Definition: NUMLDocument.h:106
LIBNUML_EXTERN
#define LIBNUML_EXTERN
Begin svn Header.
Definition: extern.h:104
NMBase::getElementName
virtual const std::string & getElementName() const =0
Returns the XML element name of this object.
NMBase::writeElements
virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
Subclasses should override this method to write out their contained NUML objects as XML elements.
Definition: NMBase.cpp:1694
NMBase::accept
virtual bool accept(NUMLVisitor &v) const =0
Accepts the given NUMLVisitor for this instance of NMBase.
NMBase::readAttributes
virtual void readAttributes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes &attributes)
Subclasses should override this method to read values from the given XMLAttributes set into their spe...
Definition: NMBase.cpp:2135
NUMLTypeCodes.h
END_C_DECLS
#define END_C_DECLS
Definition: extern.h:113
NUMLList::mItems
std::vector< NMBase * > mItems
Definition: NUMLList.h:430
NMBase::writeAttributes
virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
Subclasses should override this method to write their XML attributes to the XMLOutputStream.
Definition: NMBase.cpp:2160
NUMLTypeCode_t
NUMLTypeCode_t
An enumeration of NUML types to help identify NUML objects at runtime.
Definition: NUMLTypeCodes.h:33
NMBase.h
NMBase::getTypeCode
virtual NUMLTypeCode_t getTypeCode() const
Returns the libnuml type code for this object.
Definition: NMBase.cpp:624
NUMLList
Parent class for the various NUML list classes e.g. Operations, Result, ResultComponent etc.
Definition: NUMLList.h:45
NMBase::setNUMLDocument
virtual void setNUMLDocument(NUMLDocument *d)
Sets the parent NUMLDocument of this NUML object.
Definition: NMBase.cpp:435
NMBase::operator=
NMBase & operator=(const NMBase &orig)
Assignment operator for NMBase.
Definition: NMBase.cpp:168
NMBase::setParentNUMLObject
virtual void setParentNUMLObject(NMBase *sb)
Sets the parent NUML object of this NUML object.
Definition: NMBase.cpp:486
NMBase::clone
virtual NMBase * clone() const =0
Creates and returns a deep copy of this NMBase object.
NUMLVisitor
Implementation of the Visitor design pattern, for operations on NUML objects.
Definition: NUMLVisitor.h:72