= !LoadParam = [[ArchivePage]] A functor that enables us to (very) easy load many different Types of data onto all objects in orxonox. !LoadParam can be found source:trunk/src/lib/util/loading/load_param.h#HEAD == Usage == this loads from class className the parameter from the XML file parameterName, and sends the output to paramFunction. * using the __Lumberjack-Method__: {{{ #!cpp LoadParam(XMLROOT, PARAMNAME, OBJECT, CLASS, FUNCTIONNAME) }}} * XMLROOT: normaly the root, where a given parameter is located under * PARAMNAME: the Parameter in the XML file * OBJECT: The Object to which we would load the Information (normally this) * CLASS: the class we want to load it to * FUNCTIONNAME: The name of the function we want to load Actually the two Function up there do exactly the same Thing. (only with the second one, you can do more elaborate things.) At the end you could also specify some default Values, by just adding them, as you would as parameters of the selected Function. == Document what you do == There is also the possibility to document what you are doing. Just use a trailing {{{ #!cpp .describe("what this does"). }}} and we can easily write a full featured documentation. == what is cool about it == Because !LoadParam is a Functor with multiple input methods it comprehends (normally) what arguments must be given to the Function, and will split your input (in the XML-file) into what it needs. == Example == {{{ #!cpp /** \brief loads the Parameters of a Campaign \param root: The XML-element to load from */ void Campaign::loadParams(const TiXmlElement* root) { static_cast(this)->loadParams(root); LoadParam(root, "identifier", this, Campaign, setStoryID, false) .describe("A Unique Identifier for this Campaign") ->defaultValues(1, 0); LoadParam(root, "WorldList", this, Campaign, loadWorldListParams) .describe("A List of Worlds to be loaded in this Campaign"); } }}} Loads the following: {{{ #!xml string -- the name of the Object at hand (Default: "") int -- A Unique Identifier for this Campaign (Default: 0) XML-Element -- A List of Worlds to be loaded in this Campaign }}} as you can see also gets loaded, this is because Campaign is derived from [wiki:BaseObject BaseObject], and as you can see in the loadParams function, its loadParams also gets called. also you may have noticed the Default arguments of , because you specified 0 as default (output may differ, from the above)