Beispiel #1
0
// Create a clone of the target and add it to the ingredients.
void MHGroup::MakeClone(MHRoot *pTarget, MHRoot *pRef, MHEngine *engine)
{
    MHIngredient *pClone = pTarget->Clone(engine); // Clone it.
    pClone->m_ObjectReference.m_GroupId.Copy(m_ObjectReference.m_GroupId); // Group id is the same as this.
    pClone->m_ObjectReference.m_nObjectNo = ++m_nLastId; // Create a new object id.
    m_Items.Append(pClone);
    // Set the object reference result to the newly constructed ref.
    pRef->SetVariableValue(pClone->m_ObjectReference);
    pClone->Preparation(engine); // Prepare the clone.
}
Beispiel #2
0
// Preparation - sets up the run-time representation.  Sets m_fAvailable and generates IsAvailable event.
void MHGroup::Preparation(MHEngine *engine)
{
    // Prepare the ingredients first if they are initially active or are initially available programs. 
    for (int i = 0; i < m_Items.Size(); i++) {
        MHIngredient *pIngredient = m_Items.GetAt(i);
        if (pIngredient->InitiallyActive() || pIngredient->InitiallyAvailable()) {
            pIngredient->Preparation(engine);
        }
    }
    MHRoot::Preparation(engine); // Prepare the root object and send the IsAvailable event.
}