Exemple #1
0
   void cxios_set_variable_data_char(const char* varId, int varIdSize, const char* data, int dataSizeIn, bool* isVarExisted)
   {
      std::string varIdStr, dataStr;
      if (!cstr2string(varId, varIdSize, varIdStr)) return;
      if (!cstr2string(data, dataSizeIn, dataStr))
      {
        *isVarExisted = false;
        return;
      }

      CTimer::get("XIOS").resume();
      CTimer::get("XIOS set variable data").resume();

      CContext* context = CContext::getCurrent();
      *isVarExisted = CVariable::has(context->getId(), varIdStr);

      if (*isVarExisted)
      {
        CVariable::get(context->getId(), varIdStr)->setData<string>(dataStr);
        //CVariable::get(context->getId(), varIdStr)->sendValue();
      }

      CTimer::get("XIOS set variable data").suspend();
      CTimer::get("XIOS").suspend();
   }
Exemple #2
0
   void cxios_get_variable_data_logic(const char* varId, int varIdSize, bool* data, bool* isVarExisted)
   {
      std::string varIdStr;
      if (!cstr2string(varId, varIdSize, varIdStr)) return;

      CTimer::get("XIOS").resume();
      CTimer::get("XIOS get variable data").resume();

      CContext* context = CContext::getCurrent();
      *isVarExisted = CVariable::has(context->getId(), varIdStr);

      if (*isVarExisted)
      {
        *data = CVariable::get(context->getId(), varIdStr)->getData<bool>();
      }

      CTimer::get("XIOS get variable data").suspend();
      CTimer::get("XIOS").suspend();
   }
Exemple #3
0
   void cxios_get_variable_data_char(const char* varId, int varIdSize, char* data, int dataSizeIn, bool* isVarExisted)
   {
      std::string varIdStr;
      if (!cstr2string(varId, varIdSize, varIdStr)) return;

      CTimer::get("XIOS").resume();
      CTimer::get("XIOS get variable data").resume();

      CContext* context = CContext::getCurrent();
      *isVarExisted = CVariable::has(context->getId(), varIdStr);

      if (*isVarExisted)
      {
        int dataSizeOut = CVariable::get(context->getId(), varIdStr)->getData<string>().length();
        strncpy(data, CVariable::get(context->getId(), varIdStr)->getData<string>().c_str(), std::min(dataSizeIn, dataSizeOut));
      }

      CTimer::get("XIOS get variable data").suspend();
      CTimer::get("XIOS").suspend();
   }