// What you MUST DO in the constructor of your device: // 1) Set the Nametag, Maker and Killer in the lifeptrs struct. // What you SHOULD do in the constructor: // 2) Call SetLinks() with the # of inputs and outputs your device is going to use // ...if you dont do #2, you will use the default # of inputs your parent class assigns Pillars::Pillars(void) { lifeptrs.maker = PillarsMaker; lifeptrs.killer = PillarsKiller; strncpy(lifeptrs.nametag, "PIL1", 4); SetLinks(3, 1); // This is how you would add a parameter to a device that is managed by the generic dlg system // This adds a floating point parameter. You can add floats, ints, bools, or enums. AddParam(Parameter("Dummy Parameter", 0.0f, 0.0f, 1.0f)); }
// DEPRECATED, use SetLeafTaxIds void CBlast_def_line::SetTaxIds(const CBlast_def_line::TTaxIds& t) { // Clear the 'links' field. We may be setting new values there anyway. ResetLinks(); // Next step depends on size of input set. if (t.empty()) { // If it's empty, clear the 'taxid' field too. ResetTaxid(); } else if (t.size() == 1) { // Or if it has a single value, set 'taxid' to that value. SetTaxid(*t.begin()); } else { // Otherwise, set the 'taxid' field to the FIRST value in the set, // UNLESS the following conditions are all met: // (1) 'taxid' has a value; // (2) that value is non-zero; // (3) it's already present in the input set. bool overwrite = true; if (IsSetTaxid()) { const TTaxid taxid = GetTaxid(); if (taxid != 0) { TTaxIds::iterator it = t.find(taxid); if (it != t.end()) { overwrite = false; } } } // If the above conditions were not met, overwrite the existing // 'taxid'. if (overwrite) { SetTaxid(*t.begin()); } // Save all of the input set to the 'links' field. ITERATE(TTaxIds, itr, t) { SetLinks().push_back(*itr); } }