Exemplo n.º 1
0
DWORD FFGLPluginInstance::InstantiateGL(const FFGLViewportStruct *viewport)
{
    if (m_instanceid!=INVALIDINSTANCE) {
		DEBUGPRINT(("HEY!  InstantiateGL called when already instantiated!?"));
        //already instantiated
        return FF_SUCCESS;
    }

    //instantiate 1 of the plugins
    m_instanceid = m_main(FF_INSTANTIATEGL, (DWORD)viewport, 0).ivalue;

    //if it instantiated ok, return success
    if (m_instanceid==INVALIDINSTANCE)
        return FF_FAIL;

    //make default param assignments
    int i;
	int numparams = m_plugindef->m_numparams;
    for (i=0; i<numparams; i++) {
        plugMainUnion result = m_main(FF_GETPARAMETERDEFAULT,(DWORD)i,0);
        if (result.ivalue!=FF_FAIL) {
		    DWORD ffParameterType = m_main(FF_GETPARAMETERTYPE,(DWORD)i,0).ivalue;
		    if (ffParameterType!=FF_TYPE_TEXT) {
	            SetFloatParameter(i,result.fvalue);
			} else {
	            SetStringParameter(i,result.svalue);
			}
        }
    }

    return FF_SUCCESS;
}
Exemplo n.º 2
0
//------------------------------------------------------------------------------
// bool SetStringParameter(const std::string &label, const std::string &value)
//------------------------------------------------------------------------------
bool GroundTrackPlot::SetStringParameter(const std::string &label,
                                         const std::string &value)
{
   #if DBGLVL_PARAM_STRING
   MessageInterface::ShowMessage
      ("GroundTrackPlot::SetStringParameter()<%s> label=%s, value=%s \n",
       instanceName.c_str(), label.c_str(), value.c_str());
   #endif
   
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 3
0
bool FFGLPluginInstance::setparam(std::string pnm, std::string v)
{
	int pnum = m_plugindef->getParamNum(pnm);
	if ( pnum >= 0 ) {
		SetStringParameter(pnum, v);
	    return true;
	} else {
	    VizErrorOutput("Didn't find FFGL parameter pnm=%s in plugin=%s\n",pnm.c_str(),m_plugindef->GetPluginName().c_str());
	    return false;
	}
}
Exemplo n.º 4
0
//------------------------------------------------------------------------------
bool Variable::SetStringParameter(const wxString &label,
                                 const wxString &value)
{
   #ifdef DEBUG_VARIABLE_SET
   MessageInterface::ShowMessage
      (wxT("Variable::SetStringParameter() label=%s value=%s\n"),
       label.c_str(), value.c_str());
   #endif
   
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 5
0
//------------------------------------------------------------------------------
// bool SetStringParameter(const wxString &label,
//                         const wxString &value)
//------------------------------------------------------------------------------
bool StringVar::SetStringParameter(const wxString &label,
                                   const wxString &value)
{
   #ifdef DEBUG_STRINGVAR
   MessageInterface::ShowMessage
      (wxT("StringVar::SetStringParameter() label=%s value='%s'\n"),
       label.c_str(), value.c_str());
   #endif
   
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 6
0
//------------------------------------------------------------------------------
bool  CalculatedPoint::SetStringParameter(const std::string &label,
                                          const std::string &value,
                                          const Integer index) 
{
   return SetStringParameter(GetParameterID(label),value,index);
}
Exemplo n.º 7
0
//------------------------------------------------------------------------------
// bool SetStringParameter(const wxString &label,
//                         const wxString &value)
//------------------------------------------------------------------------------
bool PointMassForce::SetStringParameter(const wxString &label,
                                        const wxString &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 8
0
//---------------------------------------------------------------------------
// bool SetStringParameter(const std::string &label, const std::string &value)
//---------------------------------------------------------------------------
bool SolarPowerSystem::SetStringParameter(const std::string &label,
                                  const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 9
0
//------------------------------------------------------------------------------
bool Minimize::InterpretAction()
{
   #ifdef DEBUG_MINIMIZE // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ debug ~~~~
      MessageInterface::ShowMessage("Interpreting Minimize command ...\n");
      MessageInterface::ShowMessage("generatingString = %s",
         generatingString.c_str());
   #endif // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end debug ~~~~
   /// @todo: Clean up this hack for the Minimize::InterpretAction method
   // Sample string:  "Minimize myDC(Sat1.SMA = 21545.0, {Tolerance = 0.1});"
   /// @todo clean that up - because that's not even right ^^^^^
   
      // Clean out any old data
   wrapperObjectNames.clear();
   ClearWrappers();

   StringArray chunks = InterpretPreface();

   #ifdef DEBUG_MINIMIZE_PARSING
      MessageInterface::ShowMessage("Preface chunks as\n");
      for (StringArray::iterator i = chunks.begin(); i != chunks.end(); ++i)
         MessageInterface::ShowMessage("   \"%s\"\n", i->c_str());
      MessageInterface::ShowMessage("\n");
   #endif
   
   // Find and set the solver object name
   // This is the only setting in Vary that is not in a wrapper
   StringArray currentChunks = parser.Decompose(chunks[1], "()", false);
   if (!GmatStringUtil::HasNoBrackets(currentChunks.at(0), false))
      throw CommandException(
            "Solver name for Minimize command may not contain brackets, braces, or parentheses."); 
      
   SetStringParameter(OPTIMIZER_NAME, currentChunks[0]);
   if (currentChunks.size() < 2)
      throw CommandException("Missing field or value for Minimize command.");
 
    // The remaining text in the instruction is the variable definition and 
   // parameters, all contained in currentChunks[1].  Deal with those next.
   std::string cc = GmatStringUtil::Strip(currentChunks[1]);
   Integer ccEnd = cc.size() - 1;
   if ((cc.at(0) != '(') || (cc.at(ccEnd) != ')'))
      throw CommandException(
           "Missing parentheses, or unexpected characters found, around argument to Minimize command.");
   if (!GmatStringUtil::IsBracketBalanced(cc, "()"))
      throw CommandException("Parentheses unbalanced in Minimize command.");
   if ((cc.find('[') != cc.npos) || (cc.find(']') != cc.npos) ||
       (cc.find('{') != cc.npos) || (cc.find('}') != cc.npos) )
      throw CommandException("Minimize command may not contain brackets or braces.");

   std::string noSpaces     = GmatStringUtil::RemoveAll(cc,' ');
   currentChunks = parser.Decompose(noSpaces, "()", true, true);
   
   #ifdef DEBUG_MINIMIZE_PARSING
      MessageInterface::ShowMessage(
         "Minimize: after Decompose, current chunks = \n");
      for (Integer jj = 0; jj < (Integer) currentChunks.size(); jj++)
         MessageInterface::ShowMessage("   %s\n",
                                       currentChunks[jj].c_str());
   #endif

   if (currentChunks.size() == 0)
      throw CommandException("The objective function name is missing in the "
               "Minimize command\n");

   // First chunk is the objectiveName
   objectiveName = currentChunks[0];
      
   #ifdef DEBUG_MINIMIZE_PARSE // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ debug ~~~~
      MessageInterface::ShowMessage("Minimize::InterpretAction() exiting\n");
   #endif // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end debug ~~~~
      
   interpreted   = true;

   return true;
}
Exemplo n.º 10
0
void NXConnection::SetSessionId(string sessionid)
{
  SetStringParameter(pSession, NX_SessionId, sessionid.c_str());
  SetStringParameter(pSession, NX_ProxySessionId, sessionid.c_str());
}
Exemplo n.º 11
0
//------------------------------------------------------------------------------
bool BatchEstimator::SetStringParameter(const std::string &label,
                                        const std::string &value,
                                        const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 12
0
//------------------------------------------------------------------------------
bool NonlinearConstraint::InterpretAction()
{
   bool tooMuch = false;
   // Clean out any old data
   wrapperObjectNames.clear();
   ClearWrappers();

   StringArray chunks = InterpretPreface();

   #ifdef DEBUG_NLC_PARSING
      MessageInterface::ShowMessage(wxT("Preface chunks as\n"));
      for (StringArray::iterator i = chunks.begin(); i != chunks.end(); ++i)
         MessageInterface::ShowMessage(wxT("   \"%s\"\n"), i->c_str());
      MessageInterface::ShowMessage(wxT("\n"));
   #endif
   
   // Find and set the solver object name
   // This is the only setting in Vary that is not in a wrapper
   StringArray currentChunks = parser.Decompose(chunks[1], wxT("()"), false);
   if (!GmatStringUtil::HasNoBrackets(currentChunks.at(0), false))
      throw CommandException(
            wxT("Solver name for NonlinearConstraint command may not contain brackets, braces, or parentheses.")); 
   SetStringParameter(OPTIMIZER_NAME, currentChunks[0]);
   if (currentChunks.size() < 2)
      throw CommandException(wxT("Missing field or value for NonlinearConstraint command."));
   if (currentChunks.size() > 2) tooMuch = true;
   wxString cc = GmatStringUtil::Strip(currentChunks[1]);
   Integer ccEnd = cc.size() - 1;
   if ((tooMuch) || (cc.at(0) != wxT('(')) || (cc.at(ccEnd) != wxT(')')))
      throw CommandException(
           wxT("Missing parentheses, or unexpected characters found, around logical expression argument to NonlinearConstraint command."));
   if (!GmatStringUtil::IsBracketBalanced(cc, wxT("()")))
      throw CommandException(wxT("Parentheses unbalanced in NonlinearConstraint command."));
   // @todo - if tolerance allowed later, will need to not check for braces here ...
   if ((cc.find(wxT('[')) != cc.npos) || (cc.find(wxT(']')) != cc.npos) ||
       (cc.find(wxT('{')) != cc.npos) || (cc.find(wxT('}')) != cc.npos) )
      throw CommandException(wxT("NonlinearConstraint command may not contain brackets or braces."));
   
   wxString noSpaces2     = GmatStringUtil::RemoveAll(cc,wxT(' '));
   //wxString noSpaces2     = GmatStringUtil::RemoveAll(currentChunks[1],' ');
   currentChunks = parser.SeparateBrackets(noSpaces2, wxT("()"), wxT(","), false);
   
   #ifdef DEBUG_NLC_PARSING
      MessageInterface::ShowMessage(
         wxT("NLC:  noSpaces2 = %s\n"), noSpaces2.c_str());
      MessageInterface::ShowMessage(
         wxT("NLC: after SeparateBrackets, current chunks = \n"));
      for (Integer jj = 0; jj < (Integer) currentChunks.size(); jj++)
         MessageInterface::ShowMessage(wxT("   %s\n"),
                                       currentChunks[jj].c_str());
   #endif
   bool testForMore = false;
   if ((Integer) currentChunks.size() > 1) testForMore = true;
   Integer end;
   wxString constraintStr = currentChunks[0];
   Integer opSize = 1;
   if ((end = constraintStr.find(wxT(">="), 0)) != (Integer) constraintStr.npos)
   {
      op = GREATER_THAN_OR_EQUAL;
      isInequality = true;
      isIneqString = wxT("IneqConstraint");
      opSize       = 2;
      #ifdef DEBUG_NONLINEAR_CONSTRAINT_INIT
         MessageInterface::ShowMessage(wxT("NLC:InterpretAction: greater_than_or_equal\n"));
      #endif
   }
   else if ((end = constraintStr.find(wxT("<="), 0)) != (Integer) constraintStr.npos)
   {
      op = LESS_THAN_OR_EQUAL;
      isInequality = true;
      isIneqString = wxT("IneqConstraint");
      opSize       = 2;
      #ifdef DEBUG_NONLINEAR_CONSTRAINT_INIT
         MessageInterface::ShowMessage(wxT("NLC:InterpretAction: less_than_or_equal\n"));
      #endif
   }
   else if ((end = constraintStr.find(wxT("=>"), 0)) != (Integer) constraintStr.npos)
   {
      wxString errmsg = wxT("The string \"=>\" is an invalid conditonal operator");
      errmsg            += wxT(" in a NonlinearConstraint command.\n");
      errmsg            += wxT("The allowed values are [=, <=, >=]\n");
      throw CommandException(errmsg);
   }
   else if ((end = constraintStr.find(wxT("=<"), 0)) != (Integer) constraintStr.npos)
   {
      wxString errmsg = wxT("The string \"=<\" is an invalid conditonal operator");
      errmsg            += wxT(" in a NonlinearConstraint command.\n");
      errmsg            += wxT("The allowed values are [=, <=, >=]\n");
      throw CommandException(errmsg);
   }
   else if ((end = constraintStr.find(wxT("=="), 0)) != (Integer) constraintStr.npos)
   {
      wxString errmsg = wxT("The string \"==\" is an invalid conditonal operator");
      errmsg            += wxT(" in a NonlinearConstraint command.\n");
      errmsg            += wxT("The allowed values are [=, <=, >=]\n");
      throw CommandException(errmsg);
   }
   else if ((end = constraintStr.find(wxT("="), 0)) != (Integer) constraintStr.npos)
   {
      //end = constraintStr.find("=", 0);
      op = EQUAL;
      isInequality = false;
      isIneqString = wxT("EqConstraint");
      #ifdef DEBUG_NONLINEAR_CONSTRAINT_INIT
         MessageInterface::ShowMessage(wxT("NLC:InterpretAction: equal\n"));
      #endif
   }
   else
   {
      wxString errmsg = wxT("The conditional operator is missing or invalid ");
      errmsg            += wxT(" in a NonlinearConstraint command.\n");
      errmsg            += wxT("The allowed values are [=, <=, >=]\n");
      throw CommandException(errmsg);
   }
   arg1Name = constraintStr.substr(0,end);
   arg2Name = constraintStr.substr(end+opSize, (constraintStr.npos - end + opSize - 1));
   #ifdef DEBUG_NLC_PARSING
      MessageInterface::ShowMessage(wxT("... arg1Name = %s\n"), arg1Name.c_str());
      MessageInterface::ShowMessage(wxT("... operator = %s\n"), OP_STRINGS[(Integer)op].c_str());
      MessageInterface::ShowMessage(wxT("... arg2Name = %s\n"), arg2Name.c_str());
   #endif
   // Currently, this should not happen ..... 
   if (testForMore)
   {
      wxString noSpaces     = GmatStringUtil::RemoveAll(currentChunks[1],wxT(' '));
      currentChunks = parser.SeparateBrackets(noSpaces, wxT("{}"), wxT(","), false);
      
      #ifdef DEBUG_NLC_PARSING
         MessageInterface::ShowMessage(
            wxT("NLC: After SeparateBrackets, current chunks = \n"));
         for (Integer jj = 0; jj < (Integer) currentChunks.size(); jj++)
            MessageInterface::ShowMessage(wxT("   %s\n"),
                                          currentChunks[jj].c_str());
      #endif
      
      // currentChunks now holds all of the pieces - no need for more separation  
      
      wxString lhs, rhs;
      for (StringArray::iterator i = currentChunks.begin(); 
           i != currentChunks.end(); ++i)
      {
         SeparateEquals(*i, lhs, rhs);
         
         if (IsSettable(lhs))
            SetStringParameter(GetParameterID(lhs), rhs);
         else
         {
            throw CommandException(wxT("The setting \"") + lhs + 
               wxT("\" is not a valid setting for a ") + typeName + 
               wxT(" command.\n"));
         }
      }
   }
   
   interpreted = true;
  
   return true;
}
Exemplo n.º 13
0
//------------------------------------------------------------------------------
bool SpiceAttitude::SetStringParameter(const std::string label,
                                       const std::string &value,
                                       const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 14
0
//------------------------------------------------------------------------------
bool RFHardware::SetStringParameter(const std::string &label,
                                   const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 15
0
//------------------------------------------------------------------------------
bool BodyFixedPoint::SetStringParameter(const Integer id,
                                       const std::string &value,
                                       const Integer index)
{
   return SetStringParameter(id, value, index);
}
Exemplo n.º 16
0
//------------------------------------------------------------------------------
bool BodyFixedPoint::SetStringParameter(const std::string &label,
                                           const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 17
0
//------------------------------------------------------------------------------
// bool SetStringParameter(const std::string &label, const std::string &value)
//------------------------------------------------------------------------------
bool Array::SetStringParameter(const std::string &label, const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 18
0
//------------------------------------------------------------------------------
bool DataInterface::SetStringParameter(const std::string& label,
      const std::string& value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 19
0
/**
 * Change the value of a string parameter.
 *
 * @param <id> The integer ID for the parameter.
 * @param <value> The new string for this parameter.
 *
 * @return true if the string is stored, throw if the parameter is not stored.
 */
bool Solver::SetStringParameter(const wxString &label, 
                                const wxString &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 20
0
bool ObjectReferencedAxes::SetStringParameter(const std::string &label,
                                              const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 21
0
//------------------------------------------------------------------------------
// bool SetStringParameter(const wxString &label,
//                         const wxString &value)
//------------------------------------------------------------------------------
bool CallFunction::SetStringParameter(const wxString &label,
                                const wxString &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 22
0
//------------------------------------------------------------------------------
bool FileInterface::SetStringParameter(const std::string& label,
      const std::string& value, const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 23
0
//------------------------------------------------------------------------------
// virtual bool SetStringParameter(const wxString &label,
//                                 const wxString &value,
//                                 const Integer index)
//------------------------------------------------------------------------------
bool CallFunction::SetStringParameter(const wxString &label,
                                const wxString &value,
                                const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 24
0
//---------------------------------------------------------------------------
// bool SetStringParameter(const std::string &label, const std::string &value)
//---------------------------------------------------------------------------
bool ChemicalTank::SetStringParameter(const std::string &label,
                                  const std::string &value)
{
   return SetStringParameter(GetParameterID(label), value);
}
Exemplo n.º 25
0
//------------------------------------------------------------------------------
bool GroundStation::SetStringParameter(const std::string & label,
      const std::string & value, const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 26
0
//------------------------------------------------------------------------------
bool SolverSequenceCommand::SetStringParameter(const std::string& label,
      const std::string& value, const Integer index)
{
   return SetStringParameter(GetParameterID(label), value, index);
}
Exemplo n.º 27
0
bool NXConnection::SetParameters( NXSettings* sets )
{
  string sTmp = "";

  ClearParameters( pSession );

  sTmp = options->GetNXPersonalDirectory();

  NX_LOG_LOGDEBUG( "setting 'NX_PersonalDirectory' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_PersonalDirectory, sTmp.c_str() );

  NX_LOG_LOGDEBUG( "checking cookie...");

  sTmp = options->GetNXCookieFilePath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_CookieTempFilePath' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_CookieTempFilePath, sTmp.c_str() );

  if( GetExistingSessionCookie( pSession ) != NX_Ok )
  {
    if( GenerateSessionCookie( pSession ) != NX_Ok )
    {
      NX_LOG_LOGERROR( "session cookie NOT found... and cannot create a new one." );
      return false;
    }
  }
  NX_LOG_LOGDEBUG( "cookie found...");

  sTmp = options->GetNXSshPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshPath' to '" + sTmp + "'.");
  SetStringParameter( pSession, NX_SshPath, options->GetNXSshPath().c_str() );

  sTmp = options->GetNXSshKeyPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshKeyPath' to '" + sTmp + "'.");
  SetStringParameter( pSession, NX_SshKeyPath, sTmp.c_str() );

  sTmp = options->GetNXSshLogPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshLogPath' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_SshLogPath, sTmp.c_str() );

#ifndef WIN32
SetBoolParameter(pSession, NX_ProxyUseOptionsFile, true);
#endif

  /* Convert other Paramaters */
  SettingsToParameters stp( sets, pSession );
  stp.Convert();

  SetStringParameter( pSession, NX_ProxyPath, options->GetNXProxyPath().c_str() );
  SetStringParameter( pSession, NX_ProxyLibraryPath, options->GetNXLibDirectory().c_str() );
  SetStringParameter( pSession, NX_ProxyMode, "S" );

#if defined (WIN32)
    /* XServer */
  string xspath = options->GetNXBinDirectory() + "\\nxwin.exe";
 
  SetStringParameter( pSession, NX_XServerPath, xspath.c_str() );
  SetStringParameter( pSession, NX_XServerName, "nxwin.exe" );
  SetStringParameter( pSession, NX_XServerPort, ":0" );
  SetStringParameter( pSession, NX_ProxyDisplay, ":0" );
 
  SetStringParameter( pSession, NX_XServer_FirstCustomOption, "-emulate3buttons" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 1, "-agent" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 2, "-hide" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 3 , "-noreset" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 4 , "-ac" );
#endif
  return true;
}