1 /**
2 * @file RenderGraphicalObjectPlugin.cpp
3 * @brief Implementation of RenderGraphicalObjectPlugin, the plugin class of
4 * the render package for the GraphicalObject element.
5 * @author Frank T. Bergmann
6 *
7 *<!---------------------------------------------------------------------------
8 * This file is part of libSBML. Please visit http://sbml.org for more
9 * information about SBML, and the latest version of libSBML.
10 *
11 * Copyright (C) 2020 jointly by the following organizations:
12 * 1. California Institute of Technology, Pasadena, CA, USA
13 * 2. University of Heidelberg, Heidelberg, Germany
14 * 3. University College London, London, UK
15 *
16 * Copyright (C) 2019 jointly by the following organizations:
17 * 1. California Institute of Technology, Pasadena, CA, USA
18 * 2. University of Heidelberg, Heidelberg, Germany
19 *
20 * Copyright (C) 2013-2018 jointly by the following organizations:
21 * 1. California Institute of Technology, Pasadena, CA, USA
22 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
23 * 3. University of Heidelberg, Heidelberg, Germany
24 *
25 * Copyright (C) 2009-2013 jointly by the following organizations:
26 * 1. California Institute of Technology, Pasadena, CA, USA
27 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
28 *
29 * This library is free software; you can redistribute it and/or modify it
30 * under the terms of the GNU Lesser General Public License as published by
31 * the Free Software Foundation. A copy of the license agreement is provided
32 * in the file named "LICENSE.txt" included with this software distribution
33 * and also available online as http://sbml.org/software/libsbml/license.html
34 *------------------------------------------------------------------------- -->
35 */
36
37 #include <sbml/packages/render/extension/RenderGraphicalObjectPlugin.h>
38
39 #include <iostream>
40 using namespace std;
41
42
43 #ifdef __cplusplus
44
45 LIBSBML_CPP_NAMESPACE_BEGIN
46
47 /*
48 * Constructor
49 */
RenderGraphicalObjectPlugin(const std::string & uri,const std::string & prefix,RenderPkgNamespaces * renderns)50 RenderGraphicalObjectPlugin::RenderGraphicalObjectPlugin (const std::string &uri,
51 const std::string &prefix,
52 RenderPkgNamespaces *renderns)
53 : SBasePlugin(uri,prefix, renderns)
54 , mObjectRole("")
55
56 {
57 }
58
59
60 /*
61 * Copy constructor. Creates a copy of this SBase object.
62 */
RenderGraphicalObjectPlugin(const RenderGraphicalObjectPlugin & orig)63 RenderGraphicalObjectPlugin::RenderGraphicalObjectPlugin(const RenderGraphicalObjectPlugin& orig)
64 : SBasePlugin(orig)
65 , mObjectRole(orig.mObjectRole)
66 {
67
68 }
69
70
71 /*
72 * Destroy this object.
73 */
~RenderGraphicalObjectPlugin()74 RenderGraphicalObjectPlugin::~RenderGraphicalObjectPlugin () {}
75
76 /*
77 * Assignment operator for RenderGraphicalObjectPlugin.
78 */
79 RenderGraphicalObjectPlugin&
operator =(const RenderGraphicalObjectPlugin & orig)80 RenderGraphicalObjectPlugin::operator=(const RenderGraphicalObjectPlugin& orig)
81 {
82 if(&orig!=this)
83 {
84 this->SBasePlugin::operator =(orig);
85 this->mObjectRole = orig.mObjectRole;
86 }
87 return *this;
88 }
89
90
91 /*
92 * Creates and returns a deep copy of this RenderGraphicalObjectPlugin object.
93 *
94 * @return a (deep) copy of this RenderGraphicalObjectPlugin object
95 */
96 RenderGraphicalObjectPlugin*
clone() const97 RenderGraphicalObjectPlugin::clone () const
98 {
99 return new RenderGraphicalObjectPlugin(*this);
100 }
101
102
103
104
105 /*
106 *
107 * (EXTENSION) Additional public functions
108 *
109 */
110
111 /*
112 * Returns the object role string for the object.
113 */
114 const std::string&
getObjectRole() const115 RenderGraphicalObjectPlugin::getObjectRole() const
116 {
117 return mObjectRole;
118 }
119
120 /*
121 * Sets the object role string for the object.
122 */
123 void
setObjectRole(const std::string & role)124 RenderGraphicalObjectPlugin::setObjectRole(const std::string& role)
125 {
126 mObjectRole = role;
127 }
128
129 /*
130 * Returns whether the object role has been set or not.
131 */
132 bool
isSetObjectRole() const133 RenderGraphicalObjectPlugin::isSetObjectRole() const
134 {
135 return !mObjectRole.empty();
136 }
137
138 /** @cond doxygenLibsbmlInternal */
139 void
addExpectedAttributes(ExpectedAttributes & attributes)140 RenderGraphicalObjectPlugin::addExpectedAttributes(ExpectedAttributes& attributes)
141 {
142 //
143 // required attribute is not defined for SBML Level 2 or lesser.
144 //
145 attributes.add("objectRole");
146 }
147 /** @endcond */
148
149 /** @cond doxygenLibsbmlInternal */
150 void
readAttributes(const XMLAttributes & attributes,const ExpectedAttributes & expectedAttributes)151 RenderGraphicalObjectPlugin::readAttributes (const XMLAttributes& attributes,
152 const ExpectedAttributes& expectedAttributes)
153 {
154 SBasePlugin::readAttributes(attributes, expectedAttributes);
155 attributes.readInto("objectRole", mObjectRole, getErrorLog(), false, getLine(), getColumn());
156 }
157 /** @endcond */
158
159 /** @cond doxygenLibsbmlInternal */
160 void
writeAttributes(XMLOutputStream & stream) const161 RenderGraphicalObjectPlugin::writeAttributes (XMLOutputStream& stream) const
162 {
163 if ( !getObjectRole().empty() )
164 {
165 stream.writeAttribute("objectRole", getPrefix(), mObjectRole);
166 }
167 }
168 /** @endcond */
169
170 /** @cond doxygenLibsbmlInternal */
171
172 bool
accept(SBMLVisitor & v) const173 RenderGraphicalObjectPlugin::accept (SBMLVisitor& v) const
174 {
175 return true;
176 }
177
178 /** @endcond */
179
180
181
182
183
184 LIBSBML_CPP_NAMESPACE_END
185
186 #endif /* __cplusplus */
187