libNuML  1.1.1
Library for reading / writing NuML documents
ResultComponent.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 RESULTCOMPONENT_H_
25 #define RESULTCOMPONENT_H_
26 
27 #include <numl/common/extern.h>
28 #include <numl/common/numlfwd.h>
29 
30 
31 //#include <string>
32 //#include <algorithm>
33 //#include <vector>
34 
35 
36 #include <numl/Dimension.h>
38 #include <numl/NMBase.h>
39 #include <string>
40 
41 #include <numl/NUMLList.h>
42 
43 
44 #ifdef __cplusplus
46 
47 class ResultComponent;
48 class ResultComponents;
49 class Dimension;
51 class NUMLVisitor;
52 
53 /*
54  *
55  */
56 
58 public:
59 
60 // ResultComponent();
78  ResultComponent (unsigned int level, unsigned int version);
79 
80 
88  virtual bool accept (NUMLVisitor& v) const;
89 
90 
96  virtual ResultComponent* clone () const;
97 
103  const std::string& getId () const;
104 
105  /*
106  *
107  * Sets the value of the "id" attribute of this NUML object.
108  *
109  * The string @p id is copied. Note that NUML has strict requirements
110  * for the syntax of identifiers. The following is summary of the
111  * definition of the NUML identifier type @c SId (here expressed in an
112  * extended form of BNF notation):
113  * @code
114  * letter ::= 'a'..'z','A'..'Z'
115  * digit ::= '0'..'9'
116  * idChar ::= letter | digit | '_'
117  * SId ::= ( letter | '_' ) idChar*
118  * @endcode
119  * The equality of NUML identifiers is determined by an exact character
120  * sequence match; i.e., comparisons must be performed in a
121  * case-sensitive manner. In addition, there are a few conditions for
122  * the uniqueness of identifiers in an NUML model. Please consult the
123  * NUML specifications for the exact formulations.
124  *
125  * @param id the striclass ResultComponents;ng to use as the identifier of this object
126  *
127  * @return integer value indicating success/failure of the
128  * function. @if clike The value is drawn from the
129  * enumeration #ResultComponentReturnValues_t. @endif The possible values
130  * returned by this function are:
131  * @li LIBNUML_OPERATION_SUCCESS
132  * @li LIBNUML_INVALID_ATTRIBUTE_VALUE
133  */
134  int setId (const std::string& sid);
135 
136  //TODO remove the following
137 
143  // virtual XMLNamespaces* getNamespaces() const ;
144 
150  virtual void setNUMLDocument (NUMLDocument* d);
151 
152 
153 
159  virtual void setParentNUMLObject (NMBase* sb);
160 
180  virtual NUMLTypeCode_t getTypeCode() const;
181 
188  virtual const std::string& getElementName () const;
189 
212 
220  DimensionDescription* createDimensionDescription ();
221 
229  CompositeDescription* createCompositeDescription();
230 
238  CompositeValue* createCompositeValue ();
239 
244  TupleDescription* createTupleDescription();
245 
250  Tuple* createTuple();
251 
256  AtomicDescription* createAtomicDescription();
257 
262  AtomicValue* createAtomicValue();
263 
269  DimensionDescription* getDimensionDescription ();
270 
276  Dimension* getDimension ();
277 
283  void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
284 
285 
286 
287  virtual ~ResultComponent();
288 
289 //protected:
294  virtual NMBase* createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream);
295 
296 
302  virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes);
303 
304 
310  virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
311 
312 
313 protected:
314  ResultComponent();
315 
316  std::string mId;
319 
320 };
321 
323 {
324 public:
325 
331  virtual ResultComponents* clone () const;
332 
333 
353  virtual NUMLTypeCode_t getTypeCode () const { return NUML_RESULTCOMPONENTS; };
354 
355 
377  virtual NUMLTypeCode_t getItemTypeCode () const;
378 
386  virtual const std::string& getElementName () const;
387 
388 
398  virtual ResultComponent * get(unsigned int n);
399 
400 
410  virtual const ResultComponent * get(unsigned int n) const;
411 
420  virtual ResultComponents * getResultComponents();
421 
422 
437  virtual ResultComponent* get (const std::string& sid);
438 
439 
454  virtual const ResultComponent* get (const std::string& sid) const;
455 
456 
467  virtual ResultComponent* remove (unsigned int n);
468 
469 
482  virtual ResultComponent* remove (const std::string& sid);
483 
484 
485 
499  virtual int getElementPosition () const;
500 
501 
502 
503 protected:
504 
509  virtual NMBase* createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream);
510 
511 
512 };
513 
515 
516 #endif /* __cplusplus */
517 
518 //LIBNUML_EXTERN
519 //ResultComponent_t *
520 //ResultComponent_createDimensionDescription(void);
521 
522 #ifndef SWIG
523 
524 #include <stdio.h>
525 
528 
529 //TODO
533 
537 
540 
541 #endif /* !SWIG */
542 
543 #endif /* RESULTCOMPONENT_H_ */
This is the base class for all numl objects.
Definition: NMBase.h:70
virtual NUMLTypeCode_t getTypeCode() const
Returns the libNUML type code for this NUML object.
Definition: ResultComponent.h:353
#define BEGIN_C_DECLS
Definition: extern.h:112
virtual NUMLTypeCode_t getItemTypeCode() const
Get the type code of the objects contained in this NUMLList.
Definition: NUMLList.cpp:361
virtual NMBase * remove(unsigned int n)
Removes the nth item from this NUMLList items and returns a pointer to it.
Definition: NUMLList.cpp:233
Dimension mDimension
Definition: ResultComponent.h:318
virtual NMBase * createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
Subclasses should override this method to create, store, and then return an NUML object corresponding...
Definition: NMBase.cpp:1714
virtual void setParentNUMLObject(NMBase *sb)
Sets the parent NUML object of this NUML object.
Definition: NMBase.cpp:485
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:1693
stores the result component
Definition: ResultComponent.h:57
virtual const std::string & getElementName() const
Returns the XML element name of this object, which for NUMLList, is always "listOf".
Definition: NUMLList.cpp:372
stores tuple information
Definition: Tuple.h:44
virtual const NMBase * get(unsigned int n) const
Get an item from the list.
Definition: NUMLList.cpp:156
#define LIBNUML_CPP_NAMESPACE_BEGIN
Definition: libnuml-namespace.h:71
std::string mId
Definition: ResultComponent.h:316
This class stores the atomic values.
Definition: AtomicValue.h:40
virtual void setNUMLDocument(NUMLDocument *d)
Sets the parent NUMLDocument of this NUML object.
Definition: NMBase.cpp:434
Parent class for the various NUML list classes e.g.
Definition: NUMLList.h:45
CLASS_OR_STRUCT CompositeDescription CompositeDescription_t
this class stores the component descriptions
Definition: numlfwd.h:160
LIBNUML_EXTERN CompositeDescription_t * ResultComponent_createCompositeDescription(ResultComponent_t *rComp)
Definition: ResultComponent.cpp:725
virtual NMBase * clone() const
Creates and returns a deep copy of this NUMLList.
Definition: NUMLList.cpp:122
stores the tuple description
Definition: TupleDescription.h:44
virtual const std::string & getId() const
Definition: NMBase.cpp:219
NUMLTypeCode_t
An enumeration of NUML types to help identify NUML objects at runtime.
Definition: NUMLTypeCodes.h:33
This represents the numl document that contains all information.
Definition: NUMLDocument.h:106
LIBNUML_EXTERN DimensionDescription_t * ResultComponent_createDimensionDescription(ResultComponent_t *rComp)
Definition: ResultComponent.cpp:718
#define LIBNUML_EXTERN
Begin svn Header.
Definition: extern.h:104
virtual const std::string & getElementName() const =0
Returns the XML element name of this object.
Implementation of the Visitor design pattern, for operations on NUML objects.
Definition: NUMLVisitor.h:72
namespace class
Definition: NUMLNamespaces.h:46
CLASS_OR_STRUCT ResultComponent ResultComponent_t
stores the result component
Definition: numlfwd.h:148
Definition: ResultComponent.h:322
This class stores the atomic description.
Definition: AtomicDescription.h:42
virtual NUMLTypeCode_t getTypeCode() const
Returns the libnuml type code for this object.
Definition: NMBase.cpp:623
This class stores the composite values.
Definition: CompositeValue.h:49
#define END_C_DECLS
Definition: extern.h:113
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:2134
this class stores the dimension information
Definition: Dimension.h:53
virtual bool accept(NUMLVisitor &v) const =0
Accepts the given NUMLVisitor for this instance of NMBase.
#define LIBNUML_CPP_NAMESPACE_END
Definition: libnuml-namespace.h:72
This class stores the dimension description.
Definition: DimensionDescription.h:58
virtual int setId(const std::string &sid)
Definition: NMBase.cpp:412
virtual int getElementPosition() const
The NUML XML Schema is written such that the order of child elements is significant.
Definition: NMBase.cpp:2040
this class stores the component descriptions
Definition: CompositeDescription.h:57
CLASS_OR_STRUCT DimensionDescription DimensionDescription_t
This class stores the dimension description.
Definition: numlfwd.h:154
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:2159
DimensionDescription mDimensionDescription
Definition: ResultComponent.h:317
Definition: NUMLTypeCodes.h:40
virtual NMBase * clone() const =0
Creates and returns a deep copy of this NMBase object.