Skip to content

Commit

Permalink
Merge pull request #581 from agarny/issue578
Browse files Browse the repository at this point in the history
API: merged the `OrderedEntity` class into the `Reset` class. Closes #578.
  • Loading branch information
nickerso committed Mar 18, 2020
2 parents f54b1c6 + 7401468 commit d3b43dc
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 192 deletions.
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/model.cpp
${CMAKE_CURRENT_SOURCE_DIR}/namedentity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/orderedentity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/printer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/reset.cpp
Expand All @@ -83,7 +82,6 @@ set(GIT_API_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/logger.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/model.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/namedentity.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/orderedentity.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/parser.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/printer.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/reset.h
Expand Down
79 changes: 0 additions & 79 deletions src/api/libcellml/orderedentity.h

This file was deleted.

37 changes: 35 additions & 2 deletions src/api/libcellml/reset.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ limitations under the License.

#include "libcellml/entity.h"
#include "libcellml/exportdefinitions.h"
#include "libcellml/orderedentity.h"
#include "libcellml/types.h"

#include <string>
Expand All @@ -29,7 +28,7 @@ namespace libcellml {
* @brief The Reset class.
* The Reset class is for describing a CellML reset.
*/
class LIBCELLML_EXPORT Reset: public OrderedEntity
class LIBCELLML_EXPORT Reset: public Entity
{
public:
~Reset() override; /**< Destructor */
Expand Down Expand Up @@ -58,6 +57,40 @@ class LIBCELLML_EXPORT Reset: public OrderedEntity
*/
static ResetPtr create(int order) noexcept;

/**
* @brief Set the order of this reset.
*
* Sets the order for this reset.
*
* @param order The order to set.
*/
void setOrder(int order);

/**
* @brief Get the order of this reset.
*
* Returns the order of this reset.
*
* @return The order.
*/
int order() const;

/**
* @brief Mark the order as unset.
*
* Marks the order value as unset .
*/
void unsetOrder();

/**
* @brief Test to determine whether the order is set or unset.
*
* Returns whether the order value is in a set state or not.
*
* @return @c true if the order is set, @c false otherwise.
*/
bool isOrderSet();

/**
* @brief Set the @c Variable for this @c Reset.
*
Expand Down
32 changes: 0 additions & 32 deletions src/bindings/interface/orderedentity.i

This file was deleted.

14 changes: 13 additions & 1 deletion src/bindings/interface/reset.i
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@
#define LIBCELLML_EXPORT

%import "createconstructor.i"
%import "orderedentity.i"
%import "entity.i"
%import "types.i"

%feature("docstring") libcellml::Reset
"The Reset class is for describing a CellML reset.";

%feature("docstring") libcellml::Reset::order
"Returns the order for this reset as an integer value.";

%feature("docstring") libcellml::Reset::setOrder
"Set the order for this reset. The order value must be an integer.";

%feature("docstring") libcellml::Reset::unsetOrder
"Sets the state of the order to unset.";

%feature("docstring") libcellml::Reset::isOrderSet
"Returns True if the order is set, False otherwise.";

%feature("docstring") libcellml::Reset::setVariable
"Sets the :class: variable for this reset.";

Expand Down
1 change: 0 additions & 1 deletion src/bindings/interface/types.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Only meant to be included, shouldn't be passed to cmake as a module!
%shared_ptr(libcellml::Logger)
%shared_ptr(libcellml::Model)
%shared_ptr(libcellml::NamedEntity)
%shared_ptr(libcellml::OrderedEntity)
%shared_ptr(libcellml::Parser)
%shared_ptr(libcellml::Printer)
%shared_ptr(libcellml::Reset)
Expand Down
1 change: 0 additions & 1 deletion src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ set(SWIG_INTERFACE_SRCS
../interface/logger.i
../interface/model.i
../interface/namedentity.i
../interface/orderedentity.i
../interface/parser.i
../interface/printer.i
../interface/reset.i
Expand Down
67 changes: 0 additions & 67 deletions src/orderedentity.cpp

This file was deleted.

32 changes: 27 additions & 5 deletions src/reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ namespace libcellml {
*/
struct Reset::ResetImpl
{
int mOrder = 0; /**< An integer for determining relative order.*/
int mOrder = 0; /**< The relative order of the reset.*/
bool mOrderSet = false; /**< Whether the relative order of the reset has been set.*/
VariablePtr mVariable; /**< The associated variable for the reset.*/
VariablePtr mTestVariable; /**< The associated test_variable for the reset.*/
std::string mTestValue = ""; /**< The MathML string for the test_value.*/
std::string mTestValueId = ""; /**< The id of the test_value block */
std::string mResetValue = ""; /**< The MathML string for the reset_value.*/
std::string mResetValueId = ""; /**< The id of the reset_value block */
std::string mTestValue; /**< The MathML string for the test_value.*/
std::string mTestValueId; /**< The id of the test_value block */
std::string mResetValue; /**< The MathML string for the reset_value.*/
std::string mResetValueId; /**< The id of the reset_value block */
};

Reset::Reset()
Expand Down Expand Up @@ -65,6 +66,27 @@ Reset::~Reset()
delete mPimpl;
}

void Reset::setOrder(int order)
{
mPimpl->mOrder = order;
mPimpl->mOrderSet = true;
}

int Reset::order() const
{
return mPimpl->mOrder;
}

void Reset::unsetOrder()
{
mPimpl->mOrderSet = false;
}

bool Reset::isOrderSet()
{
return mPimpl->mOrderSet;
}

void Reset::setVariable(const VariablePtr &variable)
{
mPimpl->mVariable = variable;
Expand Down
3 changes: 1 addition & 2 deletions tests/bindings/python/test_reset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#
# Tests the bindings for OrderedEntity, which is the base class for all
# entities that can be ordered relative to one another.
# Tests the Reset class bindings
#
import unittest

Expand Down

0 comments on commit d3b43dc

Please sign in to comment.