コード例 #1
0
IfElseBlock::IfElseBlock(InputSource& input,
                         ErrorHandler& errorHandler,
                         Symbols& symbols,
                         Option& option,
                         State& state) :
  ifCondition(0), ifStatement(0), elseStatement(0)
{

  // if case
  XABSL_DEBUG_INIT(errorHandler.message("creating if statement"));

  ifCondition = BooleanExpression::create(input, errorHandler, symbols, option, state);
  if(errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if condition");
    return;
  }

  ifStatement = Statement::createStatement(input, errorHandler, symbols, option, state);
  if(errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if statement");
    return;
  }

  // else case
  XABSL_DEBUG_INIT(errorHandler.message("creating else statement"));

  elseStatement = Statement::createStatement(input, errorHandler, symbols, option, state);
  if(errorHandler.errorsOccurred)
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create else statement");

}
コード例 #2
0
SubsequentOptionReachedTargetStateCondition::SubsequentOptionReachedTargetStateCondition(
  ErrorHandler& errorHandler,
  State& state)
  : state(state)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a \"subsequent-option-reached-target-state\" element"));
}
コード例 #3
0
ConflictCondition::ConflictCondition(
  ErrorHandler& errorHandler,
  State& state)
  : state(state)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a \"conflict\" element"));
}
コード例 #4
0
DecimalValue::DecimalValue(InputSource& input, 
                                       ErrorHandler& errorHandler)
{
  value = input.readValue();
  
  XABSL_DEBUG_INIT(errorHandler.message("created decimal value: \"%.2f\"",value));
}
コード例 #5
0
DecimalInputSymbolRef::DecimalInputSymbolRef(InputSource& input, 
                                                               Array<Action*>& actions,
                                                               ErrorHandler& errorHandler,
                                                               OptionParameters& optionParameters,
                                                               Symbols& symbols,
                                                               unsigned long& timeOfOptionExecution,
                                                               unsigned long& timeOfStateExecution) :
  symbol(0), parameters(0)
{
  char buf[100];
  input.readString(buf,99);
  
  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal input symbol \"%s\"",buf));
  
  if (!symbols.decimalInputSymbols.exists(buf))
  {
    errorHandler.error("XabslDecimalInputSymbolRef::DecimalInputSymbolRef(): decimal input symbol \"%s\" was not registered",buf);
    return;
  }
  
  symbol = symbols.decimalInputSymbols[buf];

  parameters = new ParameterAssignment(&symbol->parameters, errorHandler);

  parameters->create(input, optionParameters, symbols, timeOfOptionExecution, timeOfStateExecution, actions);
}
コード例 #6
0
EnumeratedInputSymbolRef::EnumeratedInputSymbolRef(const Enumeration* enumeration,
    InputSource& input,
    ErrorHandler& errorHandler,
    Symbols& symbols,
    Option& option,
    State& state) :
  symbol(0), parameters(0)
{
  char buf[100];
  input.readString(buf, 99);

  XABSL_DEBUG_INIT(errorHandler.message("creating reference to enumerated input symbol \"%s\"", buf));

  if(!symbols.enumeratedInputSymbols.exists(buf))
  {
    errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumerated input symbol \"%s\" was not registered at the engine", buf);
    return;
  }

  symbol = symbols.enumeratedInputSymbols[buf];
  this->enumeration = symbol->enumeration;

  if(enumeration != NULL && enumeration != this->enumeration)
  {
    errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumeration input symbol \"%s\" does not match enumeration type \"%s\"", buf, enumeration->n);
  }

  parameters = new ParameterAssignment(&symbol->parameters, errorHandler);

  parameters->create(input, symbols, option, state);
}
コード例 #7
0
BooleanValue::BooleanValue(InputSource& input,
                           ErrorHandler& errorHandler)
{
  char buf[6];
  input.readString(buf, 5);

  value = (strcmp("true", buf) == 0);

  XABSL_DEBUG_INIT(errorHandler.message("created boolean value: \"%s\"", value ? "true" : "false"));
}
コード例 #8
0
TransitionToState::TransitionToState(InputSource& input,    
                                                 ErrorHandler& errorHandler,
                                                 Array<State*>& states)
{
  char buf[100];
  input.readString(buf,99);
  
  nextState = states[buf];
  
  XABSL_DEBUG_INIT(errorHandler.message("creating a transition to state \"%s\"",nextState->n));
}
コード例 #9
0
IfElseBlock::IfElseBlock(InputSource& input,    
                                     Array<Action*>& actions,
                                     ErrorHandler& errorHandler,
                                     Array<State*>& states,
                                     OptionParameters& parameters,
                                     Symbols& symbols,    
                                     unsigned long& timeOfOptionExecution,
                                     unsigned long& timeOfStateExecution) :
ifCondition(0), ifStatement(0), elseStatement(0)
{
  
  // if case
  XABSL_DEBUG_INIT(errorHandler.message("creating if statement"));
  
  ifCondition = BooleanExpression::create(input, actions, errorHandler, 
    parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
  if (errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if condition");
    return;
  }
  
  ifStatement = Statement::createStatement(input,actions, errorHandler,
    states,parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
  if (errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if statement");
    return;
  }
    
  // else case
  XABSL_DEBUG_INIT(errorHandler.message("creating else statement"));
  
  elseStatement = Statement::createStatement(input, actions,
    errorHandler, states, parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
  if (errorHandler.errorsOccurred)
    errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create else statement");
  
}
コード例 #10
0
BooleanOutputSymbolRef::BooleanOutputSymbolRef(InputSource& input, 
                                                               ErrorHandler& errorHandler,
                                                               Symbols& symbols)
{
  char buf[100];
  input.readString(buf,99);
  
  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to a boolean output symbol \"%s\"",buf));
  
  if (!symbols.booleanOutputSymbols.exists(buf))
  {
    errorHandler.error("XabslBooleanOutputSymbolRef::BooleanOutputSymbolRef(): boolean output symbol \"%s\" was not registered",buf);
    return;
  }
  
  symbol = symbols.booleanOutputSymbols[buf];
}
コード例 #11
0
BooleanOptionParameterRef::BooleanOptionParameterRef(InputSource& input, 
                                                   ErrorHandler& errorHandler,
                                                   Option& option)
{
  char buf[100];
  input.readString(buf,99);
  
  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to boolean option parameter \"%s\"",buf));
  
  if (!option.parameters->boolean.exists(buf))
  {
    errorHandler.error("XabslBooleanOptionParameterRef::BooleanOptionParameterRef(): boolean option parameter \"%s\" does not exist",buf);
    return;
  }
  
  parameter = option.parameters->boolean.getPElement(buf)->e;
}
コード例 #12
0
DecimalOptionParameterRef::DecimalOptionParameterRef(InputSource& input, 
                                                   ErrorHandler& errorHandler,
                                                   OptionParameters& parameters)
{
  char buf[100];
  input.readString(buf,99);
  
  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal option parameter \"%s\"",buf));
  
  if (!parameters.decimal.exists(buf))
  {
    errorHandler.error("XabslDecimalOptionParameterRef::DecimalOptionParameterRef(): decimal option parameter \"%s\" does not exist",buf);
    return;
  }
  
  parameter = parameters.decimal.getPElement(buf)->e;
}
コード例 #13
0
ConditionalEnumeratedExpression::ConditionalEnumeratedExpression(const Enumeration* enumeration,
    InputSource& input, 
    Array<Action*>& actions,
    ErrorHandler& errorHandler,
    OptionParameters& parameters,
    Symbols& symbols,
    unsigned long& timeOfOptionExecution,
    unsigned long& timeOfStateExecution)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a question mark operator"));

  condition = BooleanExpression::create(input,actions,errorHandler,parameters, symbols,
    timeOfOptionExecution,timeOfStateExecution);

  if (condition == 0) 
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): created condition is 0");
    return;
  }
  else if (errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create condition");
    delete condition;
    return;
  }

  if (!EnumeratedExpression::createOperand(expression1,enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression1");
    return;
  }
  
  if (!EnumeratedExpression::createOperand(expression2,enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression2");
    return;
  }
  this->enumeration = enumeration;
}
コード例 #14
0
EnumeratedOptionParameterRef::EnumeratedOptionParameterRef(const Enumeration* enumeration,
    InputSource& input,
    ErrorHandler& errorHandler,
    Option& option)
{
  char buf[100];
  input.readString(buf, 99);

  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to enumerated option parameter \"%s\"", buf));

  if(!option.parameters->enumerated.exists(buf))
  {
    errorHandler.error("XabslEnumeratedOptionParameterRef::EnumeratedOptionParameterRef(): enumerated option parameter \"%s\" does not exist", buf);
    return;
  }

  parameter = option.parameters->enumerated.getPElement(buf)->e;
  this->enumeration = option.parameters->enumerations[buf];
  if(enumeration != NULL && enumeration != this->enumeration)
  {
    errorHandler.error("XabslEnumeratedOptionParameterRef::EnumeratedOptionParameterRef(): enumeration input symbol \"%s\" does not match enumeration type \"%s\"", buf, enumeration->n);
  }
}
コード例 #15
0
BooleanInputSymbolRef::BooleanInputSymbolRef(InputSource& input, 
                                                               ErrorHandler& errorHandler,
                                                               Symbols& symbols,
                                                               Option& option,
                                                               State& state) :
  symbol(0), parameters(0)
{
  char buf[100];
  input.readString(buf,99);
  
  XABSL_DEBUG_INIT(errorHandler.message("creating reference to boolean input symbol \"%s\"",buf));
  
  if (!symbols.booleanInputSymbols.exists(buf))
  {
    errorHandler.error("XabslBooleanInputSymbolRef::XabslBooleanInputSymbolRef(): boolean input symbol \"%s\" was not registered at the engine",buf);
    return;
  }
  
  symbol = symbols.booleanInputSymbols[buf];

  parameters = new ParameterAssignment(&symbol->parameters, errorHandler);

  parameters->create(input, symbols, option, state);
}
コード例 #16
0
ConditionalEnumeratedExpression::ConditionalEnumeratedExpression(const Enumeration* enumeration,
    InputSource& input,
    ErrorHandler& errorHandler,
    Symbols& symbols,
    Option& option,
    State& state)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a question mark operator"));

  condition = BooleanExpression::create(input, errorHandler, symbols, option, state);

  if(condition == 0)
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): created condition is 0");
    return;
  }
  else if(errorHandler.errorsOccurred)
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create condition");
    delete condition;
    return;
  }

  if(!EnumeratedExpression::createOperand(expression1, enumeration, input, errorHandler, symbols, option, state))
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression1");
    return;
  }

  if(!EnumeratedExpression::createOperand(expression2, enumeration, input, errorHandler, symbols, option, state))
  {
    errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression2");
    return;
  }
  this->enumeration = enumeration;
}
コード例 #17
0
EnumeratedOutputSymbolRef::EnumeratedOutputSymbolRef(const Enumeration* enumeration,
    InputSource& input,
    ErrorHandler& errorHandler,
    Symbols& symbols)
{
  char buf[100];
  input.readString(buf, 99);

  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to an enumerated output symbol \"%s\"", buf));

  if(!symbols.enumeratedOutputSymbols.exists(buf))
  {
    errorHandler.error("XabslEnumeratedOutputSymbolRef::EnumeratedOutputSymbolRef(): enumerated output symbol \"%s\" was not registered", buf);
    return;
  }

  symbol = symbols.enumeratedOutputSymbols[buf];
  this->enumeration = symbol->enumeration;

  if(enumeration != NULL && enumeration != this->enumeration)
  {
    errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumeration input symbol \"%s\" does not match enumeration type \"%s\"", buf, enumeration->n);
  }
}
コード例 #18
0
TimeRef::TimeRef(ErrorHandler& errorHandler,
                             unsigned long& time) :
time(time)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a reference to state or option execution time"));
}
コード例 #19
0
SubsequentOptionReachedTargetStateCondition::SubsequentOptionReachedTargetStateCondition(Array<Action*>& actions,
                                                   ErrorHandler& errorHandler)
                                                   : actions(actions)
{
  XABSL_DEBUG_INIT(errorHandler.message("creating a \"subsequent-option-reached-target-state\" element"));
}
コード例 #20
0
ファイル: XabslAgent.cpp プロジェクト: pranet/bhuman2009fork
  Agent::Agent(const char* name, Behavior* rootOption,
                         ErrorHandler& errorHandler)
: NamedItem(name), rootOption(rootOption), errorHandler(errorHandler)
{
  XABSL_DEBUG_INIT(errorHandler.message("created agent \"%s\" with root option \"%s\"", n, rootOption->n));
}