From GridLAB-D Wiki
New in 3.2!
Load methods - Procedure to handle loader pseudo-properties
Synopsis
- module/class.h
#include "gridlabd.h"
class class : public gld_object { // ... public: int class::method(PROPERTY *prop, char *value); // ... }
- module/class.cpp
EXPORT_LOADMETHOD(class,method);
class::class(MODULE *module) { // ... if ( !gl_publish_loadmethod(oclass,"method",loadmethod_class_method) ) throw "module/class::class(MODULE*): unable to publish method method"; // ... }
int class::method(char *value) { // parse value // return 0 on failure // return 1 on success return 0; }
Description
Whenever the loader encounters a property name that is defined as a load method, it's value is dispatched to the load methods defined in the associated class. These properties are called pseudo-properties and can occur more than once in any given object.
Return value
The notifier returns 0 if the pseudo-property value is not parsed successfully and 1 if it is parsed successfully.
History
Load methods were introduced in ticket 797 and deployed in Jojoba (Version 3.2).
See also
- Guide to Programming GridLAB-D
- Introduction
- Creating a module
- Creating a class
- Special Topics
- Source documentation
- Validation
- Debugging
- Code templates