/usr/include/sbml/math/ASTBase.h is in libsbml5-dev 5.16.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 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | /**
* @cond doxygenLibsbmlInternal
*
* @file ASTBase.h
* @brief Base Node for Abstract Syntax Tree (AST) class.
* @author Sarah Keating
*
* <!--------------------------------------------------------------------------
* 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-2017 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 (C) 2009-2012 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* 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 ASTBase
* @sbmlbrief{core} Base node for AST classes.
*/
#ifndef ASTBase_h
#define ASTBase_h
#include <sbml/common/extern.h>
#include <sbml/SBMLError.h>
#include <sbml/math/ASTTypes.h>
#include <sbml/xml/XMLInputStream.h>
#include <sbml/xml/XMLOutputStream.h>
#include <sbml/ExpectedAttributes.h>
#ifdef __cplusplus
#include <vector>
#include <string>
LIBSBML_CPP_NAMESPACE_BEGIN
class ASTBasePlugin;
class SBase;
class LIBSBML_EXTERN ASTBase
{
public:
ASTBase (int type = AST_UNKNOWN);
ASTBase (SBMLNamespaces* sbmlns, int type = AST_UNKNOWN);
/**
* Copy constructor
*
* @param orig the instance to copy.
*/
ASTBase (const ASTBase& orig);
/**
* Assignment operator for ASTNode.
*
* @param rhs the object whose values are used as the basis of the
* assignment.
*/
ASTBase& operator=(const ASTBase& rhs);
/**
* Destroys this ASTNode, including any child nodes.
*/
virtual ~ASTBase ();
/**
* Creates a copy (clone).
*/
virtual ASTBase* deepCopy () const = 0;
void loadASTPlugins(const SBMLNamespaces* sbmlns);
/**
* Get the type of this ASTNode. The value returned is one of the
* enumeration values such as @sbmlconstant{AST_LAMBDA, ASTNodeType_t}, @sbmlconstant{AST_PLUS, ASTNodeType_t},
* etc.
*
* @return the type of this ASTNode.
*/
virtual ASTNodeType_t getType () const;
virtual int getExtendedType() const;
bool isSetType();
/**
* Sets the type of this ASTNode to the given type code. A side-effect
* of doing this is that any numerical values previously stored in this
* node are reset to zero.
*
* @param type the type to which this node should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
*/
virtual int setType (ASTNodeType_t type);
virtual int setType(int type);
/* helper functions to establish types */
virtual bool isAvogadro() const;
virtual bool isBoolean() const;
bool isBinaryFunction() const;
virtual bool isConstant() const;
bool isExponential() const;
bool isCiNumber() const;
bool isConstantNumber() const;
bool isCSymbolFunction() const;
bool isCSymbolNumber() const;
virtual bool isFunction() const;
virtual bool isInteger() const;
virtual bool isLambda() const;
virtual bool isLogical() const;
virtual bool isName() const;
bool isNaryFunction() const;
virtual bool isNumber() const;
virtual bool isOperator() const;
virtual bool isPiecewise() const;
virtual bool isQualifier() const;
virtual bool isRational() const;
virtual bool isReal() const;
virtual bool isRelational() const;
virtual bool isSemantics() const;
bool isUnaryFunction() const;
virtual bool isUnknown() const;
bool isUserFunction() const;
virtual bool representsBvar() const;
int setIsBvar(bool isbvar);
bool isNumberNode() const;
bool isFunctionNode() const;
bool isTopLevelMathMLFunctionNodeTag(const std::string& name) const;
bool isTopLevelMathMLNumberNodeTag(const std::string& name) const;
/* functions to read and write */
virtual void write(XMLOutputStream& stream) const;
virtual bool read(XMLInputStream& stream, const std::string& reqd_prefix="");
virtual void addExpectedAttributes(ExpectedAttributes& attributes,
XMLInputStream& stream);
virtual bool readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes,
XMLInputStream& stream, const XMLToken& element);
virtual void logError (XMLInputStream& stream, const XMLToken& element,
SBMLErrorCode_t code,
const std::string& msg = "");
//bool readAttributes(const XMLAttributes att);
/* functions to keep note of whether this instance of an AST is a child */
// removed as this could cause issues when manipulating ASTs
#if (0)
bool isChild() const;
#endif
// this is now a no-op but left for backwards compatibility reasons
// since it did trickle up to the exposed ASTNode class
virtual void setIsChildFlag(bool flag);
// functions for MathML attributes
std::string getClass() const;
std::string getId() const;
std::string getStyle() const;
SBase* getParentSBMLObject() const;
bool isSetClass() const;
bool isSetId() const;
bool isSetStyle() const;
bool isSetParentSBMLObject() const;
int setClass(std::string className);
int setId(std::string id);
int setStyle(std::string style);
int setParentSBMLObject(SBase* sb);
int unsetClass();
int unsetId();
int unsetStyle();
int unsetParentSBMLObject();
virtual ASTBase* getFunction() const;
//int setCharacter(char value);
//char getCharacter() const;
// ------------------------------------------------------------------
//
// public functions for EXTENSION
//
// ------------------------------------------------------------------
virtual void addPlugin(ASTBasePlugin* plugin);
virtual void addPlugin(const std::string& package);
/**
* Returns a plug-in object (extension interface) for an SBML Level 3
* package extension with the given package name or URI.
*
* @param package the name or URI of the package.
*
* @return the plug-in object (the libSBML extension interface) of
* a package extension with the given package name or URI.
*/
virtual ASTBasePlugin* getPlugin(const std::string& package);
/**
* Returns a plug-in object (extension interface) for an SBML Level 3
* package extension with the given package name or URI.
*
* @param package the name or URI of the package.
*
* @return the plug-in object (the libSBML extension interface) of a
* package extension with the given package name or URI.
*/
virtual const ASTBasePlugin* getPlugin(const std::string& package) const;
/**
* Returns the nth plug-in object (extension interface) for an SBML Level 3
* package extension.
*
* @param n the index of the plug-in to return.
*
* @return the plug-in object (the libSBML extension interface) of
* a package extension with the given package name or URI.
*/
virtual ASTBasePlugin* getPlugin(unsigned int n);
/**
* Returns the nth plug-in object (extension interface) for an SBML Level 3
* package extension.
*
* @param n the index of the plug-in to return.
*
* @return the plug-in object (the libSBML extension interface) of a
* package extension with the given package name or URI.
*/
virtual const ASTBasePlugin* getPlugin(unsigned int n) const;
/**
* Returns the number of plug-in objects (extenstion interfaces) for SBML
* Level 3 package extensions known.
*
* @return the number of plug-in objects (extension interfaces) of
* package extensions known by this instance of libSBML.
*/
unsigned int getNumPlugins() const;
int getTypeFromName(const std::string& name) const;
const char * getNameFromType(int type) const;
int setUserData(void *userData);
void *getUserData() const;
bool isSetUserData() const;
int unsetUserData();
//virtual void syncMembersFrom(ASTBase* rhs);
virtual void writeNodeOfType(XMLOutputStream& stream, int type,
bool inChildNode = false) const;
virtual bool isWellFormedNode() const;
virtual bool hasCorrectNumberArguments() const;
virtual int getTypeCode () const;
virtual const std::string& getPackageName() const;
int setPackageName(const std::string& name);
virtual bool hasCnUnits() const;
virtual const std::string& getUnitsPrefix() const;
/**
* Returns @c true if this is a package function which should be written as
* "functionname(argumentlist)", @c false otherwise.
*/
virtual bool isPackageInfixFunction() const;
/**
* Returns @c true if this is a package function which should be written
* special syntax that the package knows about, @c false otherwise.
*/
virtual bool hasPackageOnlyInfixSyntax() const;
/**
* Returns the precedence of the functions within the package
*/
virtual int getL3PackageInfixPrecedence() const;
/**
* Returns @c true if this is a package function which needs no special
* consideration when writng as infix, @c false otherwise.
*/
virtual bool hasUnambiguousPackageInfixGrammar(const ASTNode *child) const;
virtual double getValue() const;
protected:
void resetPackageName();
void checkPrefix(XMLInputStream& stream, const std::string& reqd_prefix,
const XMLToken& element);
void writeStartEndElement(XMLOutputStream& stream) const;
void writeConstant(XMLOutputStream& stream, const std::string & name) const;
void writeStartElement(XMLOutputStream& stream) const;
void writeAttributes(XMLOutputStream& stream) const;
virtual void writeENotation ( double mantissa
, long exponent
, XMLOutputStream& stream ) const;
virtual void writeENotation ( const std::string& mantissa
, const std::string& exponent
, XMLOutputStream& stream ) const;
void writeNegInfinity(XMLOutputStream& stream) const;
virtual void syncMembersFrom(ASTBase* rhs);
virtual void syncMembersAndResetParentsFrom(ASTBase* rhs);
virtual void syncPluginsFrom(ASTBase* rhs);
virtual void syncMembersOnlyFrom(ASTBase* rhs);
virtual void syncCoreMembersOnlyFrom(ASTBase* rhs);
/* member variables */
/*
* removed as caused issues when manipulating ASTs
*/
// bool mIsChildFlag;
ASTNodeType_t mType;
int mTypeFromPackage;
std::string mPackageName;
// additional MathML attributes
std::string mId;
std::string mClass;
std::string mStyle;
SBase * mParentSBMLObject;
void * mUserData;
std::string mEmptyString;
bool mIsBvar;
//char mChar;
//----------------------------------------------------------------------
//
// Additional data members for Extension
//
//----------------------------------------------------------------------
//
// ASTBasePlugin derived classes will be stored in mPlugins.
std::vector<ASTBasePlugin*> mPlugins;
/* functions and friends to facilitate extensions */
virtual unsigned int getNumChildren() const;
//virtual double getValue() const;
friend class ASTNumber;
friend class ASTFunction;
friend class ASTCSymbol;
friend class ASTNode;
private:
void clearPlugins();
};
LIBSBML_CPP_NAMESPACE_END
#endif /* __cplusplus */
#endif /* ASTNode_h */
/** @endcond */
|