Vous avez re莽u un message "Your GitLab account has been locked ..." ? Pas d'inqui茅tude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 84238873 authored by Alexis Brenon's avatar Alexis Brenon
Browse files

馃毀馃摑 Complete documentation

parent 16703a57
......@@ -31,8 +31,7 @@ local class = torch.class('ArcadesComponent', arcades)
-- @see utils.Logger
-- @tfield utils.Logger self._logger
---
-- @section end
--- @section end
--- Object constructor.
--
......@@ -144,8 +143,8 @@ function class.load(dump)
return recursive_load(dump)
end
--- Static Methods
-- @section static-methods
--- Static Functions
-- @section static-functions
--- Dump an object.
--
......
--- SVG placeholder base class.
--
-- @classmod utils.placeholder.PlaceHolder
-- @alias class
-- @author Alexis BRENON <brenon.alexis+arcades@gmail.com>
local torch = require('torch')
local module = {}
local class, _ = torch.class('PlaceHolder', module)
--- Fields
-- @section fields
--- Identifier of the sensor represented by this `PlaceHolder`.
-- @string self.sensor_id
--- Current value of the `PlaceHolder`.
-- @field self.value
--- String representation of the current `value`.
-- @tfield string self.string_value
--- List of values to used to format `string` to build `string_value`.
-- @tfield table self.placed_values
--- @{string_value|String representation} template.
-- @tfield string self.string
--- @section end
--- Placeholder constructor.
--
-- @tparam Doc element @{penlight/libraries/pl.xml.html/|XML element} to parse
-- @param spec TODO see child classes
function class:__init(element, spec)
self.sensor_id = spec.sensor_id
self.value = nil
......@@ -13,11 +42,20 @@ function class:__init(element, spec)
self:_prepare_string(element)
end
--- Return the string representation of the `PlaceHolder`.
--
-- If available, just return the current @{string_value|string representation}
-- or build and save it if necessary.
-- @treturn string `string_value`
function class:__tostring__()
self.string_value = self.string_value or string.format(self.string, table.unpack(self.placed_values))
return self.string_value
end
--- Abstract Methods
-- @section abstract-methods
--- Change current value of the `PlaceHolder`.
function class:set_value()
error(string.format(
"%s: abstract method not implemented.",
......@@ -26,6 +64,10 @@ function class:set_value()
2)
end
--- Get a random value from the `PlaceHolder`.
--
-- The value is sampled from the range of acceptable values
-- for this kind of `PlaceHolder`.
function class:get_random_value()
error(
string.format(
......@@ -35,6 +77,9 @@ function class:get_random_value()
2)
end
--- Initialize `string` and `placed_values` from given
-- @{penlight/libraries/pl.xml.html/|XML element}.
-- @tparam Doc _ @{penlight/libraries/pl.xml.html/|XML element}
function class:_prepare_string(_)
error(string.format(
"%s: abstract method not implemented.",
......@@ -43,6 +88,18 @@ function class:_prepare_string(_)
2)
end
--- Static Functions
-- @section static-functions
--- Dump attributes of an XML element.
--
-- Use this function to retrieve attributes of an
-- element if you need to build a new one with same attributes.
-- You can leave out some of them passing a map indexed with
-- names of attributes to dismiss.
-- @tparam Doc e @{penlight/libraries/pl.xml.html/|XML element}
-- @tparam[opt={}] {[string]=boolean} except Set of attributes to dismiss
-- @treturn string Suitable string to append to an XML string
function class.dump_attribs(e, except)
except = except or {}
local result = ""
......
--- A package related to placeholder used to custumize the SVG on the fly
-- @module utils.placeholder
-- @alias package
--- SVG symbols wrappers.
-- Classes used to easily change parts of an SVG document.
-- @package utils.placeholder
-- @author Alexis BRENON <alexis.brenon@imag.fr>
return require('arcades.utils.package_loader')(...)
......@@ -57,7 +57,7 @@
# local this_mod = project_hierarchy_current_root and project_hierarchy_current_root.self or {}
# ldoc.log("##", this_mod.kind, this_mod.name, "##")
# local module_kinds = {"Data Types", "Fields", "Metamethods", "Public Methods", "Private Methods", "Static Fields", "Static Functions"}
# local module_kinds = {"Data Types", "Fields", "Metamethods", "Abstract Methods", "Public Methods", "Private Methods", "Static Fields", "Static Functions"}
# local module_kinds_set = {}
# for i, kind in ldoc.ipairs(module_kinds) do module_kinds_set[kind] = i end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment