/usr/include/sbml/packages/comp/extension/CompSBasePlugin.h is in libsbml5-dev 5.13.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | /**
* @file CompSBasePlugin.h
* @brief Definition of CompSBasePlugin, the plugin class of
* comp package for the Model element.
* @author Lucian Smith
*
*<!---------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2013-2016 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
* 3. University of Heidelberg, Heidelberg, Germany
*
* Copyright 2011-2012 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution
* and also available online as http://sbml.org/software/libsbml/license.html
*------------------------------------------------------------------------- -->
*
* @class CompSBasePlugin
* @sbmlbrief{comp} Extension of SBase.
*
* The CompSBasePlugin class inherits from the SBasePlugin class, and
* codifies the extensions to the SBase class defined in the @ref comp
* (“comp”) package. This extension allows the modeler to define
* one or more submodel elements which the parent SBase object replaces,
* and/or a single submodel element which replaces the parent SBase object.
* This is accomplished through the addition of an optional ListOfReplacedElements
* child, which may contain one or more ReplacedElement objects, each of which
* references a submodel object to be replaced by the containing SBase object,
* and through the addition of a single optional ReplacedBy child, which
* references a submodel object which is to replace the containing SBase object.
* If a single SBase element both contains a ListOfReplacedElements and has a ReplacedBy
* child, it and all the referenced ReplacedElement objects are to be replaced
* by the object referenced by the ReplacedBy element.
*
* @see ReplacedElement
* @see ReplacedBy
*/
#ifndef CompSBasePlugin_h
#define CompSBasePlugin_h
#ifdef __cplusplus
#include <sbml/common/extern.h>
#include <sbml/common/sbmlfwd.h>
#include <sbml/SBMLTypeCodes.h>
#include <sbml/SBMLErrorLog.h>
#include <sbml/SBase.h>
#include <sbml/xml/XMLInputStream.h>
#include <sbml/xml/XMLOutputStream.h>
#include <sbml/extension/SBasePlugin.h>
#include <iostream>
#include <string>
#include <sbml/packages/comp/extension/CompExtension.h>
#include <sbml/packages/comp/sbml/ListOfReplacedElements.h>
#include <sbml/packages/comp/sbml/ReplacedBy.h>
LIBSBML_CPP_NAMESPACE_BEGIN
class LIBSBML_EXTERN CompSBasePlugin : public SBasePlugin
{
protected:
/** @cond doxygenLibsbmlInternal */
ListOfReplacedElements* mListOfReplacedElements;
ReplacedBy* mReplacedBy;
/** @endcond */
public:
/**
* Constructor.
*/
CompSBasePlugin (const std::string &uri, const std::string &prefix, CompPkgNamespaces *compns);
/**
* Copy constructor. Creates a copy of this CompSBasePlugin object.
*/
CompSBasePlugin(const CompSBasePlugin& orig);
/**
* Destroy this object.
*/
virtual ~CompSBasePlugin ();
/**
* Assignment operator for CompSBasePlugin.
*/
CompSBasePlugin& operator=(const CompSBasePlugin& orig);
/**
* Creates and returns a deep copy of this CompSBasePlugin object.
*
* @return a (deep) copy of this CompSBasePlugin object
*/
virtual CompSBasePlugin* clone () const;
/** @cond doxygenLibsbmlInternal */
/**
* Create and return an SBML object of this class, if present.
*
* @return the SBML object corresponding to next XMLToken in the
* XMLInputStream or @c NULL if the token was not recognized.
*/
virtual SBase* createObject (XMLInputStream& stream);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Subclasses must override this method to write out their contained
* SBML objects as XML elements if they have their specific elements.
*/
virtual void writeElements (XMLOutputStream& stream) const;
/** @endcond */
/**
* Returns the first child element found that has the given @p id in the
* model-wide SId namespace, or @c NULL if no such object is found.
*
* @param id string representing the id of objects to find
*
* @return a pointer to the SBase element with the given @p id.
*/
virtual SBase* getElementBySId(const std::string& id);
/**
* Returns the first child element it can find with the given @p metaid, or
* itself if it has the given @p metaid, or @c NULL if no such object is
* found.
*
* @param metaid string representing the metaid of objects to find
*
* @return a pointer to the SBase element with the given @p metaid.
*/
virtual SBase* getElementByMetaId(const std::string& metaid);
/**
* Returns a List of all child SBase objects, including those nested to an
* arbitrary depth.
*
* @return a List of pointers to all children objects.
*/
virtual List* getAllElements(ElementFilter* filter=NULL);
#ifndef SWIG
/** @cond doxygenLibsbmlInternal */
/**
* Subclasses should override this method to get the list of
* expected attributes.
* This function is invoked from corresponding readAttributes()
* function.
*/
virtual void addExpectedAttributes(ExpectedAttributes& attributes);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Reads the attributes of corresponding package in SBMLDocument element.
*/
virtual void readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Writes the attributes of corresponding package in SBMLDocument element.
*/
virtual void writeAttributes (XMLOutputStream& stream) const;
/** @endcond */
#endif //SWIG
/*
* ============================
* Additional public functions
* ============================
*/
/**
* Returns the ListOf object that holds all replacedElements.
*
* @return the ListOf object that holds all replacedElements.
*/
const ListOfReplacedElements* getListOfReplacedElements () const;
/**
* Returns the ReplacedElement with the given index.
*
* @param n the index number of the ReplacedElement to get.
*
* @return the nth ReplacedElement in the ListOfReplacedElements. If the
* index is invalid, @c NULL is returned.
*/
ReplacedElement* getReplacedElement (unsigned int n);
/**
* Returns the ReplacedElement with the given index.
*
* @param n the index number of the ReplacedElement to get.
*
* @return the nth ReplacedElement in the ListOfReplacedElements. If the
* index is invalid, @c NULL is returned.
*/
const ReplacedElement* getReplacedElement (unsigned int n) const;
/**
* Adds a copy of the given ReplacedElement object to the list of ReplacedElements.
*
* @param replacedElement the ReplacedElement object to be added to the
* list of ReplacedElements. Fails if the added ReplacedElement is @c NULL,
* does not match the level/version/package of the parent object, or cannot
* be added to the list of replaced elements.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
*/
int addReplacedElement (const ReplacedElement* replacedElement);
/**
* Returns the number of ReplacedElements for this CompSBasePlugin.
*
* @return the number of ReplacedElements for this CompSBasePlugin.
*/
unsigned int getNumReplacedElements () const;
/**
* Remove all ReplacedElements, if any exist.
*/
virtual void clearReplacedElements();
/**
* Creates a ReplacedElement object, adds it to the end of the
* ReplacedElement objects list and returns a pointer to the newly
* created object.
*
* @return a newly created ReplacedElement object
*/
ReplacedElement* createReplacedElement ();
/**
* Removes the ReplacedElement with the given index.
*
* A pointer to the ReplacedElement that was removed is returned.
* If no ReplacedElement has been removed, @c NULL is returned.
*
* @param index the index of the ReplacedElement object to remove
*
* @return the ReplacedElement object removed. As mentioned above,
* the caller owns the returned object. @c NULL is returned if
* the given index is out of range.
*/
ReplacedElement* removeReplacedElement(unsigned int index);
/**
* Get the child ReplacedBy of this SBase.
*
* @return the const ReplacedBy child of this SBase
*/
const ReplacedBy* getReplacedBy () const;
/**
* Get the child ReplacedBy of this SBase.
*
* @return the ReplacedBy child of this SBase.
*/
ReplacedBy* getReplacedBy ();
/**
* Predicate for testing whether the ReplacedBy for this SBase is set.
*
* @return @c true if the ReplacedBy of this SBase is set, @c false
* otherwise.
*/
bool isSetReplacedBy () const;
/**
* Sets the ReplacedBy definition of this SBase to a copy of the given
* ReplacedBy object instance.
*
* This method fails if the added ReplacedBy does not match the
* level/version/package of the parent object or if the added ReplacedBy
* cannot be copied.
*
* @param replacedBy the ReplacedBy object instance to use.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
*/
int setReplacedBy (const ReplacedBy* replacedBy);
/**
* Creates a new, empty ReplacedBy, adds it to this CompSBasePlugin and
* returns the created ReplacedBy.
*
* @return the newly created ReplacedBy object instance
*/
ReplacedBy* createReplacedBy ();
/**
* Unsets the child ReplacedBy of this SBase.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int unsetReplacedBy();
/**
* Helper to log a common type of error.
*/
virtual void logInvalidId(const std::string& attribute,
const std::string& wrongattribute);
// ---------------------------------------------------------
//
// virtual functions (internal implementation) which should
// be overridden by subclasses.
//
// ---------------------------------------------------------
/** @cond doxygenLibsbmlInternal */
/**
* Sets the parent SBMLDocument of this plugin object.
*
* Subclasses which contain one or more SBase derived elements must
* override this function.
*
* @param d the SBMLDocument object to use
*
* @see connectToParent
* @see enablePackageInternal
*/
virtual void setSBMLDocument (SBMLDocument* d);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the *parent* of this SBML object to child SBML objects (if any).
* (Creates a child-parent relationship by the parent)
*
* @see setSBMLDocument
* @see enablePackageInternal
*/
virtual void connectToChild ();
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the parent SBML object of this SBML object.
* (Creates a child-parent relationship by the child)
* This function is called when a child element is
* set/added/created by its parent element (e.g. by setXXX,
* addXXX, createXXX, and connectToChild functions of the
* parent element).
*
* @param parent the SBML object to use
*/
void connectToParent (SBase* parent);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Enables/Disables the given package with child elements in this plugin
* object (if any).
* (This is an internal implementation invoked from
* SBase::enablePackageInternal() function)
*
* @note Subclasses in which one or more SBase derived elements are
* defined must override this function.
*
* @see setSBMLDocument
* @see connectToParent
*/
virtual void enablePackageInternal(const std::string& pkgURI,
const std::string& pkgPrefix, bool flag);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual bool accept(SBMLVisitor& v) const;
/** @endcond */
private:
virtual void createListOfReplacedElements();
};
LIBSBML_CPP_NAMESPACE_END
#endif /* __cplusplus */
#endif /* CompSBasePlugin_h */
|