Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 create interfaces for frames #5

Merged
merged 13 commits into from
Nov 11, 2023
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- '1.8'
- nightly
- '1.9'
- '1'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
Expand All @@ -45,7 +48,7 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
Expand Down
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name = "JSMDInterfaces"
uuid = "6b30ee2f-618e-4a15-bf4e-7df7b496e609"
authors = ["JSMD Team"]
version = "1.3.1"
version = "1.4.0"

[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

[compat]
julia = "1"
Expand Down
22 changes: 18 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
using JSMDInterfaces
using Documenter

const CI = get(ENV, "CI", "false") == "true"

makedocs(;
modules=[JSMDInterfaces],
authors="Andrea Pasquale <[email protected]> and Michele Ceresoli <[email protected]>",
sitename="JSMDInterfaces.jl",
format=Documenter.HTML(; prettyurls=CI, highlights=["yaml"], ansicolor=true),
pages=["Home" => "index.md",
"Interfaces" => "interfaces.md"
"Interfaces" => [
"interfaces/Errors.md",
"interfaces/Interface.md",
"interfaces/FilesIO.md",
"interfaces/Graphs.md",
"interfaces/Frames.md",
"interfaces/Math.md",
"interfaces/Ephemeris.md",
"interfaces/Models.md"
]
],
)

deploydocs(;
repo="github.com/JuliaSpaceMissionDesign/JSMDInterfaces.jl", branch="gh-pages"
)
if CI
deploydocs(;
repo="github.com/JuliaSpaceMissionDesign/JSMDInterfaces.jl", branch="gh-pages"
)
end
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# JSMDInterfaces.jl

_An interface package for the JSMD ecosystem_
_An interface-only package for the JSMD ecosystem_

SMDInterfacesUtils.jl handles all the interface definitions for the [JSMD](https://github.com/JuliaSpaceMissionDesign) ecosystem. It is a low-level and low dependency library made to be
JSMDInterfacesUtils.jl handles all the interface definitions for the [JSMD](https://github.com/JuliaSpaceMissionDesign) ecosystem. It is a low-level and low dependency library made to be
depended on by the higher-level libraries to supply a common interface.

21 changes: 0 additions & 21 deletions docs/src/interfaces.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/src/interfaces/Ephemeris.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ephemeris
```@autodocs
Modules = [JSMDInterfaces.Ephemeris]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Errors
```@autodocs
Modules = [JSMDInterfaces.Errors]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/FilesIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# FilesIO
```@autodocs
Modules = [JSMDInterfaces.FilesIO]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Frames.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Frames
```@autodocs
Modules = [JSMDInterfaces.Frames]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Graphs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Graph
```@autodocs
Modules = [JSMDInterfaces.Graph]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Interface
```@autodocs
Modules = [JSMDInterfaces.Interface]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Math
```@autodocs
Modules = [JSMDInterfaces.Math]
```
4 changes: 4 additions & 0 deletions docs/src/interfaces/Models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Models
```@autodocs
Modules = [JSMDInterfaces.Models]
```
25 changes: 5 additions & 20 deletions src/Ephemeris.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Ephemeris
export AbstractEphemerisProvider, load, ephem_compute!, ephem_orient!, EphemerisError

using JSMDInterfaces.Errors: @custom_error, AbstractGenericException
using JSMDInterfaces.Interface
import JSMDInterfaces.FilesIO: load

@custom_error struct EphemerisError <: AbstractGenericException
Expand Down Expand Up @@ -61,7 +62,7 @@ end

Load ephemeris files.
"""
function load(provider::Type{<:AbstractEphemerisProvider}, files)
@interface function load(provider::Type{<:AbstractEphemerisProvider}, files)
return provider(files)
end

Expand All @@ -74,13 +75,7 @@ for fun in (
:ephem_timescale,
)
@eval begin
function ($fun)(eph::AbstractEphemerisProvider)
throw(
NotImplementedError(
"$($fun) shall be implemented for type $(typeof(eph))",
),
)
end
@interface function ($fun)(eph::AbstractEphemerisProvider) end
export $fun
end
end
Expand All @@ -101,14 +96,9 @@ respect to `center` at the Julian Date `jd0 + time`.
- `order` -- The order of derivatives from 0 (position) to 3 (position, velocity,
acceleration and jerk).
"""
function ephem_compute!(
@interface function ephem_compute!(
res, eph::AbstractEphemerisProvider, ::Number, ::Number, ::Int, ::Int, ::Int
)
throw(
NotImplementedError(
"`ephem_compute!` shall be implemented for type $(typeof(eph)).",
),
)
end

"""
Expand All @@ -127,14 +117,9 @@ the `target` axes at epoch `jd0 + time`.
- `order` -- The order of derivatives from 0 (angles) to 3 (angles, angles rate, etc...).

"""
function ephem_orient!(
@interface function ephem_orient!(
res, ::AbstractEphemerisProvider, ::Number, ::Number, ::Int, ::Int, ::Int
)
throw(
NotImplementedError(
"`ephem_orient!` shall be implemented for type $(typeof(eph)).",
),
)
end

end
2 changes: 1 addition & 1 deletion src/Errors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ macro custom_error(expr)
return esc(
quote
"""
$($(name))
$($(ename))

A type representing $($(descr)).
"""
Expand Down
24 changes: 20 additions & 4 deletions src/FilesIO.jl
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
module FilesIO

using JSMDInterfaces.Interface
using JSMDInterfaces.Graph: AbstractJSMDGraphNode

export load, filepath, filepaths

abstract type AbstractFile end

# Generic files

"""
filepaths(files::AbstractFile)

Return the path of all the files loaded within `file`.
"""
function filepaths(::AbstractFile) end
@interface function filepaths(::AbstractFile) end

"""
filepath(files::AbstractFile, idx::Int=1)

Return the path of the `idx`-th file within `files`.
"""
function filepath(::AbstractFile, idx::Int=1) end
@interface function filepath(::AbstractFile, idx::Int=1) end

"""
load(files::T) where T <: AbstractFile

Generic loader of different file/s formats.
"""
function load(::AbstractFile) end
function load(::Type{T}, files::String...) where {T<:AbstractFile} end
@interface function load(::AbstractFile) end
@interface function load(::Type{T}, files::String...) where {T<:AbstractFile} end

"""
filetype(ftype, suptype)
Expand Down Expand Up @@ -59,4 +64,15 @@ macro filetype(ftype, suptype)
)
end

# JSMD interface

abstract type AbstractArchiveNode <: AbstractJSMDGraphNode end

"""
function load(::AbstractArchiveNode)

Generic loader for JSMD archive nodes.
"""
@interface function load(::AbstractArchiveNode) end

end
Loading