Method: Proj::Database#celestial_bodies
- Defined in:
- lib/proj/database.rb
#celestial_bodies(authority = nil) ⇒ Array<CelestialBody>
Returns a list of celestial bodies from the database
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/proj/database.rb', line 193 def celestial_bodies( = nil) out_result_count = FFI::MemoryPointer.new(:int) ptr = Api.proj_get_celestial_body_list_from_database(self.context, , out_result_count) body_ptrs = ptr.read_array_of_pointer(out_result_count.read_int) result = body_ptrs.map do |body_ptr| # First read the pointer to a structure struct = Api::ProjCelestialBodyInfo.new(body_ptr) # Now map this to a Ruby Struct CelestialBody.new(struct[:auth_name], struct[:name]) end Api.proj_celestial_body_list_destroy(ptr) result end |