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
45LIBNUML_CPP_NAMESPACE_BEGIN
46
47class ResultComponent;
49class Dimension;
51class NUMLVisitor;
52
53/*
54 *
55 */
56
58public:
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
313protected:
315
316 std::string mId;
319
320};
321
323{
324public:
325
331 virtual ResultComponents* clone () const;
332
333
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
503protected:
504
509 virtual NMBase* createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream);
510
511
512};
513
514LIBNUML_CPP_NAMESPACE_END
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
526LIBNUML_CPP_NAMESPACE_BEGIN
528
529//TODO
533
537
539LIBNUML_CPP_NAMESPACE_END
540
541#endif /* !SWIG */
542
543#endif /* RESULTCOMPONENT_H_ */
NUMLTypeCode_t
An enumeration of NUML types to help identify NUML objects at runtime.
Definition: NUMLTypeCodes.h:34
@ NUML_RESULTCOMPONENTS
Definition: NUMLTypeCodes.h:40
LIBNUML_EXTERN CompositeDescription_t * ResultComponent_createCompositeDescription(ResultComponent_t *rComp)
Definition: ResultComponent.cpp:725
LIBNUML_EXTERN DimensionDescription_t * ResultComponent_createDimensionDescription(ResultComponent_t *rComp)
Definition: ResultComponent.cpp:718
This class stores the atomic description.
Definition: AtomicDescription.h:42
This class stores the atomic values.
Definition: AtomicValue.h:40
this class stores the component descriptions
Definition: CompositeDescription.h:58
This class stores the composite values.
Definition: CompositeValue.h:50
This class stores the dimension description.
Definition: DimensionDescription.h:59
this class stores the dimension information
Definition: Dimension.h:54
This is the base class for all numl objects.
Definition: NMBase.h:71
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:1715
virtual int setId(const std::string &sid)
Definition: NMBase.cpp:413
virtual NUMLTypeCode_t getTypeCode() const
Returns the libnuml type code for this object.
Definition: NMBase.cpp:624
virtual int getElementPosition() const
The NUML XML Schema is written such that the order of child elements is significant.
Definition: NMBase.cpp:2041
virtual const std::string & getElementName() const =0
Returns the XML element name of this object.
virtual bool accept(NUMLVisitor &v) const =0
Accepts the given NUMLVisitor for this instance of NMBase.
virtual NMBase * clone() const =0
Creates and returns a deep copy of this NMBase object.
virtual void setNUMLDocument(NUMLDocument *d)
Sets the parent NUMLDocument of this NUML object.
Definition: NMBase.cpp:435
virtual void setParentNUMLObject(NMBase *sb)
Sets the parent NUML object of this NUML object.
Definition: NMBase.cpp:486
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
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
virtual const std::string & getId() const
Definition: NMBase.cpp:220
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
This represents the numl document that contains all information.
Definition: NUMLDocument.h:107
Parent class for the various NUML list classes e.g.
Definition: NUMLList.h:45
namespace class
Definition: NUMLNamespaces.h:47
Implementation of the Visitor design pattern, for operations on NUML objects.
Definition: NUMLVisitor.h:73
stores the result component
Definition: ResultComponent.h:57
std::string mId
Definition: ResultComponent.h:316
DimensionDescription mDimensionDescription
Definition: ResultComponent.h:317
Dimension mDimension
Definition: ResultComponent.h:318
Definition: ResultComponent.h:323
virtual NUMLTypeCode_t getTypeCode() const
Returns the libNUML type code for this NUML object.
Definition: ResultComponent.h:353
stores the tuple description
Definition: TupleDescription.h:45
stores tuple information
Definition: Tuple.h:45
#define BEGIN_C_DECLS
Definition: extern.h:112
#define LIBNUML_EXTERN
Begin svn Header.
Definition: extern.h:104
#define END_C_DECLS
Definition: extern.h:113
CLASS_OR_STRUCT ResultComponent ResultComponent_t
Definition: numlfwd.h:148
CLASS_OR_STRUCT DimensionDescription DimensionDescription_t
Definition: numlfwd.h:154
CLASS_OR_STRUCT CompositeDescription CompositeDescription_t
Definition: numlfwd.h:160