Skip to content

Commit

Permalink
changed eval to macro in Atom
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Aug 31, 2020
1 parent 84d7656 commit 0206b80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PDBTools"
uuid = "e29189f1-7114-4dbd-93d0-c5673a921a58"
authors = ["Leandro Martinez <leandro@iqm.unicamp.br>"]
version = "0.8.0"
version = "0.8.1"

[deps]
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Expand Down
41 changes: 22 additions & 19 deletions src/Atom.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@

AtomData = quote
index :: Int64 # The sequential index of the atoms in the file
index_pdb :: Int64 # The index as written in the PDB file (might be anything)
name :: String
resname :: String
chain :: String
resnum :: Int64 # Number of residue as written in PDB file
residue :: Int64 # Sequential residue (molecule) number in file
x :: Float64
y :: Float64
z :: Float64
b :: Float64
occup :: Float64
model :: Int64
segname :: String # Segment name (cols 73:76)
macro SharedAtomData()
ex = quote
index :: Int64 # The sequential index of the atoms in the file
index_pdb :: Int64 # The index as written in the PDB file (might be anything)
name :: String
resname :: String
chain :: String
resnum :: Int64 # Number of residue as written in PDB file
residue :: Int64 # Sequential residue (molecule) number in file
x :: Float64
y :: Float64
z :: Float64
b :: Float64
occup :: Float64
model :: Int64
segname :: String # Segment name (cols 73:76)
end
esc(ex)
end

# Mutable structure used to read data only

@eval mutable struct MutableAtom
$AtomData
mutable struct MutableAtom
@SharedAtomData()
end
MutableAtom() = empty_struct(MutableAtom)

# Immutable structure used for critical code

@eval struct Atom
$AtomData
struct Atom
@SharedAtomData()
end

# Initialize mutable from immutable and vice-versa
Expand Down

2 comments on commit 0206b80

@lmiq
Copy link
Member Author

@lmiq lmiq commented on 0206b80 Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/20602

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.1 -m "<description of version>" 0206b80086cf568f4d1f76bec4fa165ec6b3020e
git push origin v0.8.1

Please sign in to comment.