CPhysicManager::CPhysicManager(IEngine* _Engine):CBaseObject(_Engine){ SetParam("BaseClass","PhysicManager"); SetParam("Type","CPhysicManager"); SetParam("Name","-"); dSetErrorHandler (SilenceMessage); //затыкаем рот идиотским ошибкам dSetDebugHandler (SilenceMessage); //затыкаем рот идиотским ошибкам dSetMessageHandler (SilenceMessage); //затыкаем рот идиотским ошибкам calc_time= 0.0f; world = dWorldCreate(); dWorldSetGravity(world, 0, 0, -0.01 ); space=dHashSpaceCreate(0); contactgroup = dJointGroupCreate(0); LOGGER->LogMsg("+CPhysicManager"); ptr_world = world; ptr_contactgroup = contactgroup; dWorldSetCFM(world, 1e-5); dWorldSetERP(world, 0.2); dWorldSetContactMaxCorrectingVel(world, 0.9); dWorldSetContactSurfaceLayer(world, 0.001); dWorldSetAutoDisableFlag(world, 1); // ground = #define SHIRINA 1000 //dGeomID tmp = dCreateBox( space, SHIRINA, SHIRINA, 1); //dGeomSetPosition(tmp, SHIRINA/2, SHIRINA/2, 0); // двигаем центр координат //tmp = dCreateBox( space, 1, SHIRINA, SHIRINA); //dGeomSetPosition(tmp, 0, SHIRINA/2, SHIRINA/2); // двигаем центр координат //tmp = dCreateBox( space, SHIRINA, 1, SHIRINA); //dGeomSetPosition(tmp, SHIRINA/2, 0, SHIRINA/2); // двигаем центр координат dCreatePlane (space,0,0,1,0); //dCreatePlane (space,1,1,0,0); //dCreatePlane (space,0,1,0,0); //dCreatePlane (space,1,0,0,0); //dCreatePlane (space,0,0,20,0); //dCreatePlane (space,0,10,0,0); //dCreatePlane (space,10,0,0,0); //dCreatePlane (space,0,0,1,0); //dCreatePlane (space,0,0,1,0); //dCreatePlane (space,0,0,1,0); //dCreatePlane (space,0,0,1,0); //dCreatePlane (space,0,0,1,0); };
int TpTz::Set(char* mess, float value){ switch (FindMsg(mess)){ case 21: SetParam((double)value,m_a1,m_a2,m_b1, m_b2); return 1; case 22: SetParam(m_a,(double)value,m_a2,m_b1, m_b2); return 1; case 23: SetParam(m_a,m_a1,(double)value,m_b1, m_b2); return 1; case 24: SetParam(m_a,m_a1,m_a2,(double)value, m_b2); return 1; case 25: SetParam(m_a,m_a1,m_a2,m_b1, (double)value); return 1; default: return Filter::Set(mess,value); } }
CDBDefaultConnParams::CDBDefaultConnParams( const string& srv_name, const string& user_name, const string& passwd, I_DriverContext::TConnectionMode mode, bool reusable, const string& pool_name) { SetServerName(srv_name); SetUserName(user_name); SetPassword(passwd); SetParam( "pool_name", pool_name ); SetParam( "secure_login", ((mode & I_DriverContext::fPasswordEncrypted) != 0) ? "true" : "false" ); SetParam( "is_pooled", reusable ? "true" : "false" ); SetParam( "do_not_connect", (mode & I_DriverContext::fDoNotConnect) != 0 ? "true" : "false" ); }
/** * オープンする * @param[in] lpDevName デバイス名 * @param[in] nSpeed ボーレート * @param[in] lpcszParam パラメタ * @retval true 成功 * @retval false 失敗 */ bool CTty::Open(LPCTSTR lpDevName, UINT nSpeed, LPCTSTR lpcszParam) { Close(); if (!SetParam(lpcszParam, NULL)) { return false; } HANDLE hFile = ::CreateFile(lpDevName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) { return false; } DCB dcb; ::GetCommState(hFile, &dcb); if (nSpeed != 0) { dcb.BaudRate = nSpeed; } SetParam(lpcszParam, &dcb); dcb.fOutxCtsFlow = FALSE; dcb.fRtsControl = RTS_CONTROL_ENABLE; if (!::SetCommState(hFile, &dcb)) { ::CloseHandle(hFile); return false; } m_hFile = hFile; return true; }
NH_IRC::NH_IRC(IEngine *_Engine):CBaseObject(_Engine){ Engine=_Engine; CustomHandler=NULL; NumTryConnect=0; SetParam("BaseClass","NetProtocolHandler"); SetParam("Type","IRC_Client"); SetParam("Name","-"); SetParam("NickName","UserX"); SetParam("UserName","GuestUser"); SetParam("HostName","*"); SetParam("ServerName","*"); SetParam("RealName","User Of AmberSkynetVR"); SetParam("USERINFO","Powerful user of AmberChat, based on AmberSkyNet VR Engine (http://ambernet.sf.net)"); //Field 1: Client name and version //Field 2: Operating system name and version //Field 3: Contact for individual/organization responsible for client. //These will be combined as follows: //<marker> VERSION <field 1> <space> <field 2> <space> <field 3> <marker> SetParam("VERSION","AmberChat v0.1 (http://ambernet.sf.net)"); FillReplay(); LOGGER->LogMsg("NH_IRC: Open"); SupervisorId=0; cut_buffer=""; ExtLogName="irc_log.txt"; };
inline AdamOptimizer::AdamOptimizer(unsigned begin_num_update) : Optimizer(begin_num_update) { update_handle_ = op_map()->GetSymbolCreator("adam_update"); SetParam("beta1", 0.9f); SetParam("beta2", 0.999f); SetParam("epsilon", 1e-8); }
inline RMSPropOptimizer::RMSPropOptimizer(unsigned begin_num_update) : Optimizer(begin_num_update) { update_handle_ = op_map()->GetSymbolCreator("rmsprop_update"); alex_update_handle_ = op_map()->GetSymbolCreator("rmspropalex_update"); SetParam("gamma1", 0.9f); SetParam("gamma2", 0.9f); SetParam("epsilon", 1e-8); }
IAction::EStatus CBurstFireAction::Update(float timePassed) { if(m_pFireMode) { SetParam(CItem::sActionParamCRCs.fired, m_pFireMode->Fired()); SetParam(CItem::sActionParamCRCs.firstFire, m_pFireMode->FirstFire()); } return BaseClass::Update(timePassed); }
CDBConnParamsBase::CDBConnParamsBase(void) : m_ProtocolVersion(0) , m_Encoding(eEncoding_Unknown) , m_ServerType(eUnknown) , m_Host(0) , m_PortNumber(0) { SetParam("secure_login", "false"); SetParam("is_pooled", "false"); SetParam("do_not_connect", "false"); }
NH_IRC_DCC_SENDFILE::NH_IRC_DCC_SENDFILE(IEngine *_Engine):CBaseObject(_Engine){ SupervisorId=0; Engine=_Engine; CustomHandler=NULL; SetParam("BaseClass","NetProtocolHandler"); SetParam("Type","NH_IRC_DCC_SENDFILE"); SetParam("Name","-"); };
void L6470::setThresholdSpeed(float thresholdSpeed) { // Configure the FS_SPD register- this is the speed at which the driver ceases // microstepping and goes to full stepping. FSCalc() converts a value in steps/s // to a value suitable for this register; to disable full-step switching, you // can pass 0x3FF to this register. if(thresholdSpeed == 0.0) { SetParam(FS_SPD, 0x3FF); } else { SetParam(FS_SPD, FSCalc(thresholdSpeed)); } }
NH_IRC_DCC_CHAT::NH_IRC_DCC_CHAT(IEngine *_Engine):CBaseObject(_Engine){ SetParam("BaseClass","NetProtocolHandler"); SetParam("Type","IRC_DCC_Client"); SetParam("Name","-"); SupervisorId=0; Engine=_Engine; CustomHandler=NULL; LOGGER->LogMsg("NH_IRC: Open"); };
////////////////////////////////////////////////////////////////////////////// // // CGargle::SetAllParameters // STDMETHODIMP CGargle::SetAllParameters(THIS_ LPCGargleFX pParm) { HRESULT hr = S_OK; // Check that the pointer is not NULL if (pParm == NULL) hr = E_POINTER; // Set the parameters if (SUCCEEDED(hr)) hr = SetParam(GFP_Rate, static_cast<MP_DATA>(pParm->dwRateHz)); if (SUCCEEDED(hr)) hr = SetParam(GFP_Shape, static_cast<MP_DATA>(pParm->dwWaveShape)); m_fDirty = true; return hr; }
CCommCtrl::CCommCtrl(CTRLDATA* data,CSkinForm* parent,string typeName) :CCtrl(parent,typeName), _alloc_desc(false) { SetParam(data,parent,typeName); }
double TSirModel::RunCalcErr(const TFltV& ParamV) { SetParam(ParamV); const int EndT = TrueInfectV.Len() - T0 + 2; RunModel(TFltV::GetV(N0-I0, I0), 0, EndT, EndT, OutValV); //RunModel10(TFltV::GetV(N0-I0, I0), 0, EndT, EndT, OutValV); return GetErr(); }
/* Function: ProcessSetParamPkt ================================================ * Receive and process the EXT_SETPARAM packet. */ PRIVATE boolean_T ProcessSetParamPkt(RTWExtModeInfo *ei, const int pktSize) { int32_T msg; const char *pkt; boolean_T error = EXT_NO_ERROR; /* * Receive packet and set parameters. */ pkt = GetPkt(pktSize); if (pkt == NULL) { msg = (int32_T)NOT_ENOUGH_MEMORY; SendPktToHost(EXT_SETPARAM_RESPONSE,sizeof(int32_T),(char_T *)&msg); error = EXT_ERROR; goto EXIT_POINT; } SetParam(ei, pkt); msg = (int32_T)STATUS_OK; error = SendPktToHost(EXT_SETPARAM_RESPONSE,sizeof(int32_T),(char_T *)&msg); if (error != EXT_NO_ERROR) goto EXIT_POINT; EXIT_POINT: return(error); } /* end ProcessSetParamPkt */
bool ParamUtils::ReadParamsFromFp(SetParamConstraint constraint, TFile *fp, ParamsVectors *member_params) { char line[MAX_PATH]; // input line bool anyerr = false; // true if any error bool foundit; // found parameter char *valptr; // value field while (fp->FGets(line, MAX_PATH) != nullptr) { if (line[0] != '\r' && line[0] != '\n' && line[0] != '#') { chomp_string(line); // remove newline for (valptr = line; *valptr && *valptr != ' ' && *valptr != '\t'; valptr++); if (*valptr) { // found blank *valptr = '\0'; // make name a string do valptr++; // find end of blanks while (*valptr == ' ' || *valptr == '\t'); } foundit = SetParam(line, valptr, constraint, member_params); if (!foundit) { anyerr = true; // had an error tprintf("Warning: Parameter not found: %s\n", line); } } } return anyerr; }
double TSirSR2Model::RunCalcErr(const TFltV& ParamV) { SetParam(ParamV); const int EndT = BlogV.Len() - T0 + 2; RunModel(TFltV::GetV(N0M-I0M, N0B-I0B, I0M, I0B), 0, EndT, EndT, OutValV); //RunModel10(TFltV::GetV(N0M-I0M, N0B-I0B, I0M, I0B), 0, EndT, EndT, OutValV); return GetErr(); }
void CDB_ODBC_ConnParams::x_MapPairToParam(const string& key, const string& value) { // MS SQL Server related attributes ... if (NStr::Equal(key, "SERVER", NStr::eNocase)) { SetServerName(value); } else if (NStr::Equal(key, "UID", NStr::eNocase)) { SetUserName(value); } else if (NStr::Equal(key, "PWD", NStr::eNocase)) { SetPassword(value); } else if (NStr::Equal(key, "DRIVER", NStr::eNocase)) { SetDriverName(value); } else if (NStr::Equal(key, "DATABASE", NStr::eNocase)) { SetDatabaseName(value); } else if (NStr::Equal(key, "ADDRESS", NStr::eNocase)) { string host; string port; NStr::SplitInTwo(value, ",", host, port); NStr::TruncateSpacesInPlace(host); NStr::TruncateSpacesInPlace(port); // SetHost(host); SetPort(static_cast<Uint2>(NStr::StringToInt(port))); } else { SetParam(key, value); } }
void UDataInd(QVector<byte> l2data) // override { TUT_ASSERT(m_state == RECV_U); if(!m_synchro) { SetParam(l2data); return; } TUT_ASSERT(m_synchro || m_sendSessionCount || m_PacketSize || m_seed); if (l2data.size() != m_PacketSize) { TUT_ASSERT(0 && "Error3 in Exchange test"); } for(int i = 0; i < m_PacketSize; ++i) if (l2data.at(i) != m_random.NextByte()) { TUT_ASSERT(0 && "Error4 in Exchange test"); } m_recvied++; if (m_recvied == m_sendSessionCount) m_completed = true; }
void L6470::setStallCurrent(float ma_current) { byte STHValue = (byte)floor(ma_current / 31.25); if(STHValue > 0x80)STHValue = 0x80; if(STHValue < 0)STHValue = 0; SetParam(STALL_TH, STHValue); }
CIpAddr::CIpAddr(COMM_CTRL_DESC* desc,CSkinForm* parent,string typeName) { CTRLDATA* data = new CTRLDATA(); char* tmp = new char[strlen(desc->caption) + 1]; memset(tmp,0,strlen(desc->caption) + 1); strcpy(tmp,desc->caption); data->caption = tmp; tmp = new char[typeName.size() + 1]; memset(tmp,0,strlen(desc->caption) + 1); strcpy(tmp,typeName.c_str()); data->class_name=tmp; data->dwAddData = 0; data->dwExStyle = DEF_IPADDR_EXSTYLE; data->dwStyle = DEF_IPADDR_STYLE; data->id = -1; //auto alloc id data->w = desc->w; data->h = desc->h; data->x = desc->x; data->y = desc->y; SetParam(data,parent,typeName); _alloc_desc = true; }
int RigidRegistration::StartRegistration(vnl_vector<double>& params) { vnl_lbfgsb minimizer(*func_); SetRigidTransformBound(this->d_, &minimizer); //double fxval; func_->SetBase(this); for (unsigned int k = 0; k < this->level_; ++k) { func_->SetScale(this->v_scale_[k]); SetParam(params); minimizer.set_max_function_evals(this->v_func_evals_[k]); // For more options, see // http://public.kitware.com/vxl/doc/release/core/vnl/html/vnl__nonlinear__minimizer_8h-source.html minimizer.minimize(params); if (minimizer.get_failure_code() < 0) { /* fxval = func->f( params ); vcl_cout << "break Minimized to " << fxval << vcl_endl << "Iterations: " << minimizer.get_num_iterations() << "; " << "Evaluations: " << minimizer.get_num_evaluations() << vcl_endl; vcl_cout << params << vcl_endl; */ return -1; } /* fxval = func->f( params ); vcl_cout << "Minimized to " << fxval << vcl_endl << "Iterations: " << minimizer.get_num_iterations() << "; " << "Evaluations: " << minimizer.get_num_evaluations() << vcl_endl; */ } vcl_cout << "Solution: " << params << vcl_endl; return 0; }
// Редактируем строку void __fastcall TDocStr::Set(int IdType, int IdTarget, double Summa, double Qty, const String &Note, int IdDeposit) const { TSQLPtr SQL = TConnect::Instance->GetWriteSQL(SetQuery, false); TTranPtr TR(SQL->Transaction); SQL->ParamByName("id")->AsInteger = _data->FieldByName("id")->AsInteger; SetParam(SQL.get(), IdType, IdTarget, Summa, Qty, Note, IdDeposit); SQL->Transaction->Commit(); }
//=========================================================================== void __fastcall TfrmTargetList::FormShow(TObject *Sender) { Caption = ProjectCaption + "Целевая обстановка"; TPoint aPos = frmMain->ClientToScreen(Point(frmMain->Width - Width - 10, frmMain->cbWork->BoundsRect.Bottom)); // + GetSystemMetrics(SM_CYCAPTION) Left = aPos.x; Top = aPos.y; aCurrentWindowPos = frmMain->ClientToScreen(Point(0, frmMain->cbWork->BoundsRect.Bottom)); if (TargetIndicatorList->Count == 0) { int LastIndex = 3; TPoint PosWindow[3]; PosWindow[0] = frmMain->ClientToScreen(Point(0, frmMain->cbWork->BoundsRect.Bottom)); PosWindow[1] = frmMain->ClientToScreen(Point(0, frmMain->cbWork->BoundsRect.Bottom)); PosWindow[2] = frmMain->ClientToScreen(Point(0, frmMain->cbWork->BoundsRect.Bottom)); if (CheckListBox1->Items->Count < 3) LastIndex = CheckListBox1->Items->Count; for (int i = 0; i < LastIndex; i ++) { if (i == 1) PosWindow[1].y = PosWindow[0].y + frmTargetIndicator->Height + 0; if (i == 2) PosWindow[2].y = PosWindow[1].y + frmTargetIndicator->Height + 0; CheckListBox1->ItemIndex = i; CheckListBox1->Checked[i] = true; SetParamTargetWindow(i); ((TfrmTargetIndicator*)TargetIndicatorList->Items[i])->Left = PosWindow[i].x; ((TfrmTargetIndicator*)TargetIndicatorList->Items[i])->Top = PosWindow[i].y; ((TfrmTargetIndicator*)TargetIndicatorList->Items[i])->N1Click(Sender); } } SetParam(); }
CComBox::CComBox(COMM_CTRL_DESC* desc,CSkinForm* parent,string typeName) { CTRLDATA *data = new CTRLDATA(); char* tmp = new char[strlen(desc->caption) + 1]; memset(tmp,0,strlen(desc->caption) + 1); strcpy(tmp,desc->caption); data->caption = tmp; tmp = new char[typeName.size() + 1]; memset(tmp,0,strlen(desc->caption) + 1); strcpy(tmp,typeName.c_str()); data->class_name=tmp; data->dwAddData = 0; data->dwExStyle = DEF_COMBOX_EXSTYLE; data->dwStyle = DEF_COMBOX_STYLE; data->id = -1; //auto alloc id data->w = desc->w; data->h = desc->h; data->x = desc->x; data->y = desc->y; //std::cout << "b parent = " <<_parent << std::endl; SetParam(data,parent,typeName); //std::cout << "a parent = " <<_parent << std::endl; //std::cout << "CListView parent = " << &_parent << std::endl; _alloc_desc = true; }
bool ParamUtils::ReadParamsFromFp(FILE *fp, inT64 end_offset, SetParamConstraint constraint, ParamsVectors *member_params) { char line[MAX_PATH]; // input line bool anyerr = false; // true if any error bool foundit; // found parameter inT16 length; // length of line char *valptr; // value field while ((end_offset < 0 || ftell(fp) < end_offset) && fgets(line, MAX_PATH, fp)) { if (line[0] != '\n' && line[0] != '#') { length = strlen (line); chomp_string(line); // remove newline for (valptr = line; *valptr && *valptr != ' ' && *valptr != '\t'; valptr++); if (*valptr) { // found blank *valptr = '\0'; // make name a string do valptr++; // find end of blanks while (*valptr == ' ' || *valptr == '\t'); } foundit = SetParam(line, valptr, constraint, member_params); if (!foundit) { anyerr = true; // had an error tprintf("read_params_file: parameter not found: %s\n", line); exit(1); } } } return anyerr; }
inline void ShaderManager::SetParam( const char *parameter_name, const std::vector<float>& float_param ) { if( float_param.empty() ) return; SetParam( parameter_name, &float_param[0], (uint)float_param.size() ); }
void DYN_PARAM_SWITCH_CLASS::ProcessSwitchString(const char *arg) { char *name = strdup(arg); char *eq = index(name, '='); if ( ! eq ) { ASIMERROR("Invalid parameter specification in '" << "--param " << name << "'" << endl << " Correct syntax: -param <name>=<value>" << endl); } else { char *value = eq + 1; *eq = '\0'; if ( ! SetParam(name, value)) { *eq = '='; ASIMERROR("Don't know about dynamic parameter " << name << endl); } *eq = '='; } free(name); }
void CStrategyGrid::SetParam(CString value) { CStringArray list; CFunctionPub pub; pub.ParseParam(value,list,';'); CStringArray listField; pub.ParseParam( m_strParamList,listField,';'); for(int i=0;i<listField.GetSize()&&i<list.GetSize();i++) { SetParam(listField[i],list[i]); } if( m_TradeDirection == 0 ) { if(m_kp==0) m_strModelName = m_strStrategyName + m_strInstrument + "开多"; //modelname else if(m_kp==1) m_strModelName = m_strStrategyName + m_strInstrument + "平多"; //modelname } else if( m_TradeDirection == 1 ) { if(m_kp==0) m_strModelName = m_strStrategyName + m_strInstrument + "开空"; //modelname else if(m_kp==1) m_strModelName = m_strStrategyName + m_strInstrument + "平空"; //modelname } }