Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny authored Apr 29, 2024
2 parents c26a42e + 046fad5 commit dc10210
Show file tree
Hide file tree
Showing 27 changed files with 132 additions and 126 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ jobs:
python_unit_testing: OFF
shared_libs: ON
unit_testing: ON
context: PATH=/usr/local/opt/llvm/bin:$PATH CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
context: PATH=/opt/homebrew/opt/llvm/bin:$PATH CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++
target: code_coverage
- name: 'Memory checks'
os: ubuntu-latest
Expand Down Expand Up @@ -274,6 +274,10 @@ jobs:
steps:
- name: Check out libOpenCOR
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
Expand All @@ -285,7 +289,9 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
- name: Install LLVM
if: ${{ matrix.target == 'code_coverage' }}
run: brew install --overwrite llvm
run: |
brew install --overwrite llvm
brew info llvm
- name: Install Clang
if: ${{ matrix.name == 'Code analysis' }}
run: |
Expand Down
8 changes: 4 additions & 4 deletions src/api/libopencor/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,20 @@ class LIBOPENCOR_EXPORT File: public Logger
*
* Return the contents of this file.
*
* @return The contents, as an @ref UnsignedCharVector, of this file.
* @return The contents, as an @ref UnsignedChars, of this file.
*/

UnsignedCharVector contents();
UnsignedChars contents();

/**
* @brief Set the contents of this file.
*
* Set the contents of this file.
*
* @param pContents The contents, as an @ref UnsignedCharVector, of this file.
* @param pContents The contents, as an @ref UnsignedChars, of this file.
*/

void setContents(const UnsignedCharVector &pContents);
void setContents(const UnsignedChars &pContents);

private:
class Impl; /**< Forward declaration of the implementation class, @private. */
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/issue.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class LIBOPENCOR_EXPORT Issue

Impl *mPimpl;

explicit Issue(const std::string &pDescription, Type pType); /**< Constructor, @private. */
explicit Issue(Type pType, const std::string &pDescription); /**< Constructor, @private. */
};

} // namespace libOpenCOR
16 changes: 8 additions & 8 deletions src/api/libopencor/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ class LIBOPENCOR_EXPORT Logger
*
* Return the issues.
*
* @return The issues, as an @ref IssuePtrVector.
* @return The issues, as an @ref IssuePtrs.
*/

IssuePtrVector issues() const;
IssuePtrs issues() const;

/**
* @brief Return whether there are some errors.
Expand All @@ -80,10 +80,10 @@ class LIBOPENCOR_EXPORT Logger
*
* Return the errors.
*
* @return The errors, as a @ref IssuePtrVector of type @ref Issue::Type::ERROR.
* @return The errors, as a @ref IssuePtrs of type @ref Issue::Type::ERROR.
*/

IssuePtrVector errors() const;
IssuePtrs errors() const;

/**
* @brief Return whether there are some warnings.
Expand All @@ -100,10 +100,10 @@ class LIBOPENCOR_EXPORT Logger
*
* Return the warnings.
*
* @return The warnings, as a @ref IssuePtrVector of type @ref Issue::Type::WARNING.
* @return The warnings, as a @ref IssuePtrs of type @ref Issue::Type::WARNING.
*/

IssuePtrVector warnings() const;
IssuePtrs warnings() const;

/**
* @brief Return whether there are some messages.
Expand All @@ -120,10 +120,10 @@ class LIBOPENCOR_EXPORT Logger
*
* Return the messages.
*
* @return The messages, as a @ref IssuePtrVector of type @ref Issue::Type::MESSAGE.
* @return The messages, as a @ref IssuePtrs of type @ref Issue::Type::MESSAGE.
*/

IssuePtrVector messages() const;
IssuePtrs messages() const;

protected:
class Impl; /**< Forward declaration of the implementation class, @private. */
Expand Down
12 changes: 6 additions & 6 deletions src/api/libopencor/seddocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ class LIBOPENCOR_EXPORT SedDocument: public Logger
*
* Return the models.
*
* @return The models, as a @ref SedModelPtrVector.
* @return The models, as a @ref SedModelPtrs.
*/

SedModelPtrVector models() const;
SedModelPtrs models() const;

/**
* @brief Add the model to this simulation experiment description.
Expand Down Expand Up @@ -148,10 +148,10 @@ class LIBOPENCOR_EXPORT SedDocument: public Logger
*
* Return the simulations.
*
* @return The simulations, as a @ref SedSimulationPtrVector.
* @return The simulations, as a @ref SedSimulationPtrs.
*/

SedSimulationPtrVector simulations() const;
SedSimulationPtrs simulations() const;

/**
* @brief Add the simulation to this simulation experiment description.
Expand Down Expand Up @@ -192,10 +192,10 @@ class LIBOPENCOR_EXPORT SedDocument: public Logger
*
* Return the tasks.
*
* @return The tasks, as a @ref SedAbstractTaskPtrVector.
* @return The tasks, as a @ref SedAbstractTaskPtrs.
*/

SedAbstractTaskPtrVector tasks() const;
SedAbstractTaskPtrs tasks() const;

/**
* @brief Add the task to this simulation experiment description.
Expand Down
20 changes: 10 additions & 10 deletions src/api/libopencor/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ using SolverSecondOrderRungeKuttaPtr = std::shared_ptr<SolverSecondOrderRungeKut

// Vectors.

using IssuePtrVector = std::vector<IssuePtr>; /**< Type definition for a vector of @ref Issue pointers. */
using SedAbstractTaskPtrVector = std::vector<SedAbstractTaskPtr>; /**< Type definition for a vector of @ref SedAbstractTask pointers. */
using SedDataDescriptionPtrVector = std::vector<SedDataDescriptionPtr>; /**< Type definition for a vector of @ref SedDataDescription pointers. */
using SedDataGeneratorPtrVector = std::vector<SedDataGeneratorPtr>; /**< Type definition for a vector of @ref SedDataGenerator pointers. */
using SedInstanceTaskPtrVector = std::vector<SedInstanceTaskPtr>; /**< Type definition for a vector of @ref SedInstanceTask pointers. */
using SedModelPtrVector = std::vector<SedModelPtr>; /**< Type definition for a vector of @ref SedModel pointers. */
using SedOutputPtrVector = std::vector<SedOutputPtr>; /**< Type definition for a vector of @ref SedOutput pointers. */
using SedSimulationPtrVector = std::vector<SedSimulationPtr>; /**< Type definition for a vector of @ref SedSimulation pointers. */
using SedStylePtrVector = std::vector<SedStylePtr>; /**< Type definition for a vector of @ref SedStyle pointers. */
using UnsignedCharVector = std::vector<unsigned char>; /**< Type definition for a vector of unsigned characters. */
using IssuePtrs = std::vector<IssuePtr>; /**< Type definition for a vector of @ref Issue pointers. */
using SedAbstractTaskPtrs = std::vector<SedAbstractTaskPtr>; /**< Type definition for a vector of @ref SedAbstractTask pointers. */
using SedDataDescriptionPtrs = std::vector<SedDataDescriptionPtr>; /**< Type definition for a vector of @ref SedDataDescription pointers. */
using SedDataGeneratorPtrs = std::vector<SedDataGeneratorPtr>; /**< Type definition for a vector of @ref SedDataGenerator pointers. */
using SedInstanceTaskPtrs = std::vector<SedInstanceTaskPtr>; /**< Type definition for a vector of @ref SedInstanceTask pointers. */
using SedModelPtrs = std::vector<SedModelPtr>; /**< Type definition for a vector of @ref SedModel pointers. */
using SedOutputPtrs = std::vector<SedOutputPtr>; /**< Type definition for a vector of @ref SedOutput pointers. */
using SedSimulationPtrs = std::vector<SedSimulationPtr>; /**< Type definition for a vector of @ref SedSimulation pointers. */
using SedStylePtrs = std::vector<SedStylePtr>; /**< Type definition for a vector of @ref SedStyle pointers. */
using UnsignedChars = std::vector<unsigned char>; /**< Type definition for a vector of unsigned characters. */

} // namespace libOpenCOR
2 changes: 1 addition & 1 deletion src/bindings/javascript/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void fileApi()
.function("setContents", emscripten::optional_override([](libOpenCOR::FilePtr &pThis, uintptr_t pContents, size_t pSize) {
auto contents = reinterpret_cast<unsigned char *>(pContents);

pThis->setContents(libOpenCOR::UnsignedCharVector(contents, contents + pSize));
pThis->setContents(libOpenCOR::UnsignedChars(contents, contents + pSize));
}));

EM_ASM({
Expand Down
18 changes: 9 additions & 9 deletions src/bindings/javascript/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ EMSCRIPTEN_BINDINGS(libOpenCOR)
{
// Vectors.

emscripten::register_vector<libOpenCOR::IssuePtr>("IssuePtrVector");
emscripten::register_vector<libOpenCOR::SedAbstractTaskPtr>("SedAbstractTaskPtrVector");
emscripten::register_vector<libOpenCOR::SedDataDescriptionPtr>("SedDataDescriptionPtrVector");
emscripten::register_vector<libOpenCOR::SedDataGeneratorPtr>("SedDataGeneratorPtrVector");
emscripten::register_vector<libOpenCOR::SedInstanceTaskPtr>("SedInstanceTaskPtrVector");
emscripten::register_vector<libOpenCOR::SedModelPtr>("SedModelPtrVector");
emscripten::register_vector<libOpenCOR::SedOutputPtr>("SedOutputPtrVector");
emscripten::register_vector<libOpenCOR::SedSimulationPtr>("SedSimulationPtrVector");
emscripten::register_vector<libOpenCOR::SedStylePtr>("SedStylePtrVector");
emscripten::register_vector<libOpenCOR::IssuePtr>("IssuePtrs");
emscripten::register_vector<libOpenCOR::SedAbstractTaskPtr>("SedAbstractTaskPtrs");
emscripten::register_vector<libOpenCOR::SedDataDescriptionPtr>("SedDataDescriptionPtrs");
emscripten::register_vector<libOpenCOR::SedDataGeneratorPtr>("SedDataGeneratorPtrs");
emscripten::register_vector<libOpenCOR::SedInstanceTaskPtr>("SedInstanceTaskPtrs");
emscripten::register_vector<libOpenCOR::SedModelPtr>("SedModelPtrs");
emscripten::register_vector<libOpenCOR::SedOutputPtr>("SedOutputPtrs");
emscripten::register_vector<libOpenCOR::SedSimulationPtr>("SedSimulationPtrs");
emscripten::register_vector<libOpenCOR::SedStylePtr>("SedStylePtrs");

// APIs.

Expand Down
8 changes: 4 additions & 4 deletions src/file/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ void File::Impl::retrieveContents()
}
#endif

void File::Impl::setContents(const UnsignedCharVector &pContents)
void File::Impl::setContents(const UnsignedChars &pContents)
{
mContents = pContents;

mContentsRetrieved = true;
}

UnsignedCharVector File::Impl::contents()
UnsignedChars File::Impl::contents()
{
#ifndef __EMSCRIPTEN__
retrieveContents();
Expand Down Expand Up @@ -207,12 +207,12 @@ std::string File::path() const
return pimpl()->path();
}

UnsignedCharVector File::contents()
UnsignedChars File::contents()
{
return pimpl()->contents();
}

void File::setContents(const UnsignedCharVector &pContents)
void File::setContents(const UnsignedChars &pContents)
{
pimpl()->setContents(pContents);

Expand Down
6 changes: 3 additions & 3 deletions src/file/file_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class File::Impl: public Logger::Impl
std::string mUrl;

bool mContentsRetrieved = false;
UnsignedCharVector mContents;
UnsignedChars mContents;

CellmlFilePtr mCellmlFile;
SedmlFilePtr mSedmlFile;
Expand All @@ -53,8 +53,8 @@ class File::Impl: public Logger::Impl
void retrieveContents();
#endif

UnsignedCharVector contents();
void setContents(const UnsignedCharVector &pContents);
UnsignedChars contents();
void setContents(const UnsignedChars &pContents);
};

} // namespace libOpenCOR
2 changes: 1 addition & 1 deletion src/file/filemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FileManager
FilePtr file(const std::string &pFileNameOrUrl) const;

private:
FileVector mFiles;
Files mFiles;
};

} // namespace libOpenCOR
8 changes: 4 additions & 4 deletions src/logger/issue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ limitations under the License.

namespace libOpenCOR {

Issue::Impl::Impl(std::string pDescription, Type pType)
Issue::Impl::Impl(Type pType, const std::string &pDescription)
: mType(pType)
, mDescription(std::move(pDescription))
, mDescription(pDescription)
{
}

Issue::Issue(const std::string &pDescription, Type pType)
: mPimpl(new Impl {pDescription, pType})
Issue::Issue(Type pType, const std::string &pDescription)
: mPimpl(new Impl {pType, pDescription})
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/logger/issue_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Issue::Impl
Type mType;
std::string mDescription;

explicit Impl(std::string pDescription, Type pType);
explicit Impl(Type pType, const std::string &pDescription);
~Impl() = default;
};

Expand Down
Loading

0 comments on commit dc10210

Please sign in to comment.