예제 #1
0
//
// evaluate
//
Value * IsInstance_Method::evaluate (Ocl_Context & res, 
                                     GAME::Mga::Object caller)
{
  GAME::Mga::FCO obj = GAME::Mga::FCO::_narrow (caller);

  bool type = obj->is_instance ();
  
  return new Boolean_Value (type);
	
}
예제 #2
0
//
// evaluate
//
Value * IsInstance_Method::evaluate (Ocl_Context & res, 
                                     Value * caller)
{
  Object_Value * iv = dynamic_cast <Object_Value *> (caller);

  bool type = false;
  
	if (iv != 0)
	{
		GAME::Mga::Object val = iv->value ();
    GAME::Mga::FCO obj = GAME::Mga::FCO::_narrow (caller);

    type = obj->is_instance ();
  }
 
  return new Boolean_Value (type);
}
//
// handle_object_created
//
int CBML_Connection_Generation_Handler::
handle_object_created (GAME::Mga::Object_in obj)
{
  if (this->is_importing_)
    return 0;

  GAME::Mga::FCO fco = GAME::Mga::FCO::_narrow (obj);

  // This event handler only works with non-instance elements.
  if (fco->is_instance ())
    return 0;

  const std::string metaname = obj->meta ()->name ();

  if (metaname == meta::Action ||
      metaname == meta::RequestAction ||
      metaname == meta::OutputAction ||
      metaname == meta::QueryAction ||
      metaname == meta::CallAction)
  {
    this->create_state_and_connect (fco, "Effect");
  }
  else if (metaname == meta::InputAction ||
           metaname == meta::MultiInputAction)
  {
    // We need to make sure there is not an active state selected
    // before continuing. This is because we are starting a new
    // workflow in the behavior.
    if (!this->active_state_.is_nil ())
      this->active_state_ = 0;

    this->create_state_and_connect (fco, "InputEffect");
  }
  else if (0 == this->state_transition_map_.find (metaname.c_str ()))
  {
    this->active_state_ = fco;
  }

  return 0;
}