From GridLAB-D Wiki
// $Id$ // Copyright (c) <<<YEAR>>> <<<COMPANY>>> // Template valid as of Hassayampa (Version 3.0) #include "<<<CLASS>>>.h" EXPORT_CREATE(<<<CLASS>>>); EXPORT_INIT(<<<CLASS>>>); // TODO add optional functions declarations CLASS <<<CLASS>>>::oclass = NULL; <<<CLASS>>> *<<<CLASS>>>::defaults = NULL; // TODO add declaration of class globals <<<CLASS>>>::<<<CLASS>>>(MODULE *module) { if ( oclass!=NULL ) exception("cannot register class more than once"); oclass = gld_class::create(module,"<<<CLASS>>>",sizeof(<<<CLASS>>>),<<<OPTIONS>>>); if ( oclass==NULL ) exception("class registration failed"); oclass->trl = <<<TRL>>>; if ( gl_publish_variable(oclass, <<<VARIABLESPECS>>>, NULL)<1 ) exception("unable to publish properties"); memset(defaults=this,0,sizeof(*this)); // TODO set defaults } <<<CLASS>>>::create(void) { memcpy(this,defaults,sizeof(*this)); // TODO set defaults return SUCCESS; // return FAILED on create error } <<<CLASS>>>::init(OBJECT *parent) { // TODO initialize object return SUCCESS; // return FAILED on create error } // TODO add implementations of optional class functions